OGS
MeshToolsLib::MeshGenerators::VoxelFromLayeredMeshes Namespace Reference

Functions

std::unique_ptr< MeshLib::MeshcreateVoxelFromLayeredMesh (std::pair< MathLib::Point3d, MathLib::Point3d > &extent, std::vector< MeshLib::Mesh const * > const &layers, std::array< double, 3 > const cellsize, bool const dilate)
 

Function Documentation

◆ createVoxelFromLayeredMesh()

std::unique_ptr< MeshLib::Mesh > MeshToolsLib::MeshGenerators::VoxelFromLayeredMeshes::createVoxelFromLayeredMesh ( std::pair< MathLib::Point3d, MathLib::Point3d > & extent,
std::vector< MeshLib::Mesh const * > const & layers,
std::array< double, 3 > const cellsize,
bool const dilate )

Constructs a VoxelGrid with a specified resolution of a list of layered meshes.

Parameters
extentThe axis-aligned boundary-box (AABB) which is initially defined.
layersContaining all the meshes that will be used to create the VoxelGrid.
cellsizeContains the resolution of the Voxel (i.e. length in x-,y-,z-directions)
dilateA flag to set dilate. If dilate is True all Voxels which are not fully covered by the meshes are included in the resulting VoxelGrid.

Definition at line 206 of file VoxelGridFromLayeredMeshes.cpp.

212{
213 for (auto const& layer : layers)
214 {
215 adjustExtent(extent, *layer);
216 }
217
218 std::unique_ptr<MeshLib::Mesh> mesh(generateInitialMesh(extent, cellsize));
219 if (mesh == nullptr)
220 {
221 return nullptr;
222 }
223 setMaterialIDs(*mesh, layers, dilate);
224 auto const marked_elements = markSpecificElements(*mesh, -1);
225 if (marked_elements.size() == mesh->getNumberOfElements())
226 {
227 return nullptr;
228 }
229 std::unique_ptr<MeshLib::Mesh> new_mesh(
230 MeshToolsLib::removeElements(*mesh, marked_elements, "mesh"));
231 return new_mesh;
232}
std::vector< std::size_t > markSpecificElements(MeshLib::Mesh const &mesh, int const mat_id)
void setMaterialIDs(MeshLib::Mesh &mesh, std::vector< MeshLib::Mesh const * > const &layers, bool const dilate)
std::unique_ptr< MeshLib::Mesh > generateInitialMesh(std::pair< MathLib::Point3d, MathLib::Point3d > &extent, std::array< double, 3 > const &res)
void adjustExtent(std::pair< MathLib::Point3d, MathLib::Point3d > &extent, MeshLib::Mesh const &mesh)
MeshLib::Mesh * removeElements(const MeshLib::Mesh &mesh, const std::vector< std::size_t > &removed_element_ids, const std::string &new_mesh_name)

References adjustExtent(), generateInitialMesh(), markSpecificElements(), MeshToolsLib::removeElements(), and setMaterialIDs().

Referenced by main().