Loading [MathJax]/extensions/tex2jax.js
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 208 of file VoxelGridFromLayeredMeshes.cpp.

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