Functions | |
shared_ptr< TriangleMesh > | 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. More... | |
shared_ptr< TriangleMesh > | 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 ) More... | |
template<typename Field_T > | |
shared_ptr< geometry::TriangleMesh > | 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. More... | |
template<typename Field_T > | |
shared_ptr< geometry::TriangleMesh > | 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. 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_t > | calcNormal (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) |
|
inlinestatic |
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.
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.
mesh | pointer to the mesh that is gathered. The coordinates of the mesh have to be already in global coordinates. |
gatherNormals | By default only vertices and faces are gathered. If this parameter is true, the resulting mesh contains also normals |
targetRank | rank of the process where the mesh is gathered |
comm | MPI communicator used for the gather operation |
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.
pieceOut | output parameter, different for each piece (can be used in output filename) |
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.
field | Scalar field, that should be triangulated, has to be a GhostLayerField or a class with similar interface (adaptor) |
threshold | all areas with values greater than threshold, are inside the generated surface |
mesh | the generated vertices and triangles are added to this mesh duplicate vertices are not recognized, but added again |
dx | length of a cell i.e. grid spacing in dx/dy/dz |
fCoord | fixed f coordinate, only scalar fields can be processed, so here a fixed f has to be chosen |
offset | this vector is added to all vertices that are inserted into the mesh |
cellInterval | use only the part specified by this CellInterval to create the mesh if the cellInterval is empty the complete field is used |
Field_T | Has to be a GhostLayerField<real_t,1> or a class with similar interface (adaptor) |
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.
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.