walberla::postprocessing Namespace Reference

Functions

shared_ptr< TriangleMeshgatherMesh (const shared_ptr< TriangleMesh > &mesh, bool gatherNormals, int targetRank, MPI_Comm comm)
 Gathers parts of a TriangleMesh on a single process and merges them into a single mesh. More...
 
shared_ptr< TriangleMeshgatherMeshIntoMultiplePieces (int &pieceOut, const shared_ptr< TriangleMesh > &mesh, bool gatherNormals, uint_t pieces, MPI_Comm comm)
 Similar to gatherMesh but meshes is reduced into n pieces (instead of 1 piece ) More...
 
template<typename Field_T >
shared_ptr< geometry::TriangleMeshflagFieldToSurfaceMesh (const shared_ptr< StructuredBlockStorage > &bs, ConstBlockDataID fieldID, typename Field_T::value_type mask, bool calcNormals=false, int targetRank=0, MPI_Comm comm=MPI_COMM_WORLD)
 Generates isosurface mesh out of a flag field and gathers the mesh on a single process. More...
 
template<typename Field_T >
shared_ptr< geometry::TriangleMeshrealFieldToSurfaceMesh (const shared_ptr< StructuredBlockStorage > &bs, ConstBlockDataID fieldID, real_t threshold, uint_t fCoord=0, bool calcNormals=false, int targetRank=0, MPI_Comm comm=MPI_COMM_WORLD)
 Generates isosurface mesh out of a real valued field and gathers the mesh on a single process. More...
 
template<typename Field_T >
void generateIsoSurface (const Field_T &field, real_t threshold, geometry::TriangleMesh &mesh, const Vector3< real_t > &dx=Vector3< real_t >(real_t(1)), uint_t fCoord=uint_t(0), const Vector3< real_t > &offset=Vector3< real_t >(real_t(0)), const CellInterval &cellInterval=CellInterval(), bool calcNormals=true)
 Creates an iso-surface mesh from a scalar field using the Marching Cubes algorithm. More...
 
template<typename Field_T >
static Vector3< real_tcalcNormal (const Field_T &f, cell_idx_t i, cell_idx_t j, cell_idx_t k, uint_t fCoord)
 
template<typename Field_T , bool calcNormals>
void generateIsoSurface_internal (const Field_T &f, real_t threshold, TriangleMesh &mesh, const Vector3< real_t > &dx, uint_t fCoord, const Vector3< real_t > &posOffset, const CellInterval &cellInterval)
 

Function Documentation

◆ calcNormal()

template<typename Field_T >
static Vector3<real_t> walberla::postprocessing::calcNormal ( const Field_T &  f,
cell_idx_t  i,
cell_idx_t  j,
cell_idx_t  k,
uint_t  fCoord 
)
inlinestatic

◆ flagFieldToSurfaceMesh()

template<typename Field_T >
shared_ptr<geometry::TriangleMesh> walberla::postprocessing::flagFieldToSurfaceMesh ( const shared_ptr< StructuredBlockStorage > &  bs,
ConstBlockDataID  fieldID,
typename Field_T::value_type  mask,
bool  calcNormals = false,
int  targetRank = 0,
MPI_Comm  comm = MPI_COMM_WORLD 
)

Generates isosurface mesh out of a flag field and gathers the mesh on a single process.

All cells where on of the bits of the mask are set, are located inside the resulting mesh.

Warning: Slow due to sub-optimal implementation - uses a temporary real field.

◆ gatherMesh()

shared_ptr< TriangleMesh > walberla::postprocessing::gatherMesh ( const shared_ptr< TriangleMesh > &  mesh,
bool  gatherNormals,
int  targetRank,
MPI_Comm  comm 
)

Gathers parts of a TriangleMesh on a single process and merges them into a single mesh.

Parameters
meshpointer to the mesh that is gathered. The coordinates of the mesh have to be already in global coordinates.
gatherNormalsBy default only vertices and faces are gathered. If this parameter is true, the resulting mesh contains also normals
targetRankrank of the process where the mesh is gathered
commMPI communicator used for the gather operation
Returns
null pointer on all processes with rank not equal targetRank. Pointer to gathered mesh on targetRank.

◆ gatherMeshIntoMultiplePieces()

shared_ptr< TriangleMesh > walberla::postprocessing::gatherMeshIntoMultiplePieces ( int &  pieceOut,
const shared_ptr< TriangleMesh > &  mesh,
bool  gatherNormals,
uint_t  pieces,
MPI_Comm  comm 
)

Similar to gatherMesh but meshes is reduced into n pieces (instead of 1 piece )

Useful if meshes get too large to fit into a the memory of a single process.

Parameters
pieceOutoutput parameter, different for each piece (can be used in output filename)
Returns
reduced mesh pieces, or null pointer on other processes

◆ generateIsoSurface()

template<typename Field_T >
void walberla::postprocessing::generateIsoSurface ( const Field_T &  field,
real_t  threshold,
geometry::TriangleMesh mesh,
const Vector3< real_t > &  dx = Vector3<real_t>( real_t(1) ),
uint_t  fCoord = uint_t(0),
const Vector3< real_t > &  offset = Vector3<real_t>( real_t(0) ),
const CellInterval cellInterval = CellInterval(),
bool  calcNormals = true 
)

Creates an iso-surface mesh from a scalar field using the Marching Cubes algorithm.

The mesh is not cleared, all vertices and faces are added.

Parameters
fieldScalar field, that should be triangulated, has to be a GhostLayerField or a class with similar interface (adaptor)
thresholdall areas with values greater than threshold, are inside the generated surface
meshthe generated vertices and triangles are added to this mesh duplicate vertices are not recognized, but added again
dxlength of a cell i.e. grid spacing in dx/dy/dz
fCoordfixed f coordinate, only scalar fields can be processed, so here a fixed f has to be chosen
offsetthis vector is added to all vertices that are inserted into the mesh
cellIntervaluse only the part specified by this CellInterval to create the mesh if the cellInterval is empty the complete field is used
Template Parameters
Field_THas to be a GhostLayerField<real_t,1> or a class with similar interface (adaptor)

◆ generateIsoSurface_internal()

template<typename Field_T , bool calcNormals>
void walberla::postprocessing::generateIsoSurface_internal ( const Field_T &  f,
real_t  threshold,
TriangleMesh mesh,
const Vector3< real_t > &  dx,
uint_t  fCoord,
const Vector3< real_t > &  posOffset,
const CellInterval cellInterval 
)

Maps vertices under iso-surface to intersecting edges The 8 bit index into this table is a bit mask that holds the information which of the 8 vertices of the cube lies under the threshold. The returned bitmask indicates which edges are intersected.

◆ realFieldToSurfaceMesh()

template<typename Field_T >
shared_ptr<geometry::TriangleMesh> walberla::postprocessing::realFieldToSurfaceMesh ( const shared_ptr< StructuredBlockStorage > &  bs,
ConstBlockDataID  fieldID,
real_t  threshold,
uint_t  fCoord = 0,
bool  calcNormals = false,
int  targetRank = 0,
MPI_Comm  comm = MPI_COMM_WORLD 
)

Generates isosurface mesh out of a real valued field and gathers the mesh on a single process.