Create header for BoundaryLocationFunction and update ComplexGeometry.cpp

parent 6f8484de
......@@ -57,6 +57,7 @@
#include "mesh/TriangleMeshes.h"
#include "mesh/MeshOperations.h"
#include "mesh/DistanceComputations.h"
#include "mesh/DistanceFunction.h"
#include "mesh/MeshIO.h"
#include "mesh/MatrixVectorOperations.h"
#include "mesh/blockforest/BlockForestInitialization.h"
......@@ -67,6 +68,7 @@
#include "mesh/boundary/BoundarySetup.h"
#include "mesh/boundary/BoundaryInfo.h"
#include "mesh/boundary/BoundaryLocation.h"
#include "mesh/boundary/BoundaryLocationFunction.h"
#include "mesh/boundary/BoundaryUIDFaceDataSource.h"
#include "mesh/boundary/ColorToBoundaryMapper.h"
#include "mesh/vtk/VTKMeshWriter.h"
......@@ -84,47 +86,6 @@
namespace walberla {
template< typename MeshDistanceType >
struct MeshDistanceFunction
{
MeshDistanceFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject ) : meshDistanceObject_( meshDistanceObject ) { }
inline real_t operator()( const Vector3< real_t > & p ) const { return real_c( meshDistanceObject_->sqSignedDistance( mesh::toOpenMesh( p ) ) ); }
shared_ptr< MeshDistanceType > meshDistanceObject_;
};
template< typename MeshDistanceType >
inline MeshDistanceFunction< MeshDistanceType > makeMeshDistanceFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject )
{
return MeshDistanceFunction< MeshDistanceType >( meshDistanceObject );
}
template< typename MeshDistanceType, typename MeshType >
struct BoundaryLocationFunction
{
BoundaryLocationFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject, const shared_ptr< mesh::BoundaryLocation< MeshType > > & boundaryLocation )
: meshDistanceObject_( meshDistanceObject ), boundaryLocation_( boundaryLocation ) { }
inline const mesh::BoundaryInfo & operator()( const Vector3< real_t > & p ) const
{
typename MeshType::FaceHandle fh;
meshDistanceObject_->sqSignedDistance( mesh::toOpenMesh( p ), fh );
return (*boundaryLocation_)[ fh ];
}
shared_ptr< MeshDistanceType > meshDistanceObject_;
shared_ptr< mesh::BoundaryLocation< MeshType > > boundaryLocation_;
};
template< typename MeshDistanceType, typename MeshType >
inline BoundaryLocationFunction< MeshDistanceType, MeshType > makeBoundaryLocationFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject, const shared_ptr< mesh::BoundaryLocation< MeshType > > & boundaryLocation )
{
return BoundaryLocationFunction< MeshDistanceType, MeshType >( meshDistanceObject, boundaryLocation );
}
template< typename MeshType >
void vertexToFaceColor( MeshType & mesh, const typename MeshType::Color & defaultColor )
{
......
......@@ -13,19 +13,17 @@
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file BoundarySetup.h
//! \file DistanceFunction.h
//! \ingroup mesh
//! \author Christian Godenschwager <christian.godenschwager@fau.de>
//! \author Christian Godenschwager <martin.bauer@fau.de>
//! \author Martin Bauer <martin.bauer@fau.de>
//
//======================================================================================================================
#include "core/DataTypes.h"
#include "core/math/Vector3.h"
#include "mesh/MatrixVectorOperations.h"
namespace walberla {
namespace mesh {
template<typename MeshDistanceType>
struct MeshDistanceFunction
......@@ -48,5 +46,4 @@ makeMeshDistanceFunction( const shared_ptr <MeshDistanceType> & meshDistanceObje
return MeshDistanceFunction<MeshDistanceType>( meshDistanceObject );
}
} // namespace mesh
} // namespace walberla
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file BoundaryLocationFunction.h
//! \ingroup mesh
//! \author Christoph Schwarzmeier <christoph.schwarzmeier@fau.de>
//
//======================================================================================================================
namespace walberla {
template< typename MeshDistanceType, typename MeshType >
struct BoundaryLocationFunction
{
BoundaryLocationFunction(const shared_ptr< MeshDistanceType >& meshDistanceObject,
const shared_ptr< mesh::BoundaryLocation< MeshType > >& boundaryLocation)
: meshDistanceObject_(meshDistanceObject), boundaryLocation_(boundaryLocation)
{}
inline const mesh::BoundaryInfo& operator()(const Vector3< real_t >& p) const
{
typename MeshType::FaceHandle fh;
meshDistanceObject_->sqSignedDistance(mesh::toOpenMesh(p), fh);
return (*boundaryLocation_)[fh];
}
shared_ptr< MeshDistanceType > meshDistanceObject_;
shared_ptr< mesh::BoundaryLocation< MeshType > > boundaryLocation_;
};
template< typename MeshDistanceType, typename MeshType >
inline BoundaryLocationFunction< MeshDistanceType, MeshType >
makeBoundaryLocationFunction(const shared_ptr< MeshDistanceType >& meshDistanceObject,
const shared_ptr< mesh::BoundaryLocation< MeshType > >& boundaryLocation)
{
return BoundaryLocationFunction< MeshDistanceType, MeshType >(meshDistanceObject, boundaryLocation);
}
} // namespace walberla
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment