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 202 of file VoxelGridFromLayeredMeshes.cpp.

208{
209 for (auto const& layer : layers)
210 {
211 adjustExtent(extent, *layer);
212 }
213
214 std::unique_ptr<MeshLib::Mesh> mesh(generateInitialMesh(extent, cellsize));
215 if (mesh == nullptr)
216 {
217 return nullptr;
218 }
219 setMaterialIDs(*mesh, layers, dilate);
220 auto const marked_elements = markSpecificElements(*mesh, -1);
221 if (marked_elements.size() == mesh->getNumberOfElements())
222 {
223 return nullptr;
224 }
225 std::unique_ptr<MeshLib::Mesh> new_mesh(
226 MeshToolsLib::removeElements(*mesh, marked_elements, "mesh"));
227 return new_mesh;
228}
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().