libMesh
|
Class TetGenMeshInterface
provides an interface for tetrahedralization of meshes using the TetGen library.
More...
#include <mesh_tetgen_interface.h>
Public Member Functions | |
TetGenMeshInterface (UnstructuredMesh &mesh) | |
Constructor. More... | |
~TetGenMeshInterface ()=default | |
Empty destructor. More... | |
void | set_switches (std::string new_switches) |
Method to set switches to tetgen, allowing for different behaviours. More... | |
void | triangulate_pointset () |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set. More... | |
void | pointset_convexhull () |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set. More... | |
void | triangulate_conformingDelaunayMesh (double quality_constraint=0., double volume_constraint=0.) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set. More... | |
void | triangulate_conformingDelaunayMesh_carvehole (const std::vector< Point > &holes, double quality_constraint=0., double volume_constraint=0.) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set. More... | |
Protected Member Functions | |
void | fill_pointlist (TetGenWrapper &wrapper) |
This function copies nodes from the _mesh into TetGen's pointlist. More... | |
void | assign_nodes_to_elem (unsigned *node_labels, Elem *elem) |
Assigns the node IDs contained in the 'node_labels' array to 'elem'. More... | |
unsigned | check_hull_integrity () |
This function checks the integrity of the current set of elements in the Mesh to see if they comprise a convex hull, that is: More... | |
void | process_hull_integrity_result (unsigned result) |
This function prints an informative message and crashes based on the output of the check_hull_integrity() function. More... | |
void | delete_2D_hull_elements () |
Delete original convex hull elements from the Mesh after performing a Delaunay tetrahedralization. More... | |
Protected Attributes | |
UnstructuredMesh & | _mesh |
Local reference to the mesh we are working with. More... | |
std::vector< unsigned > | _sequential_to_libmesh_node_map |
We should not assume libmesh nodes are numbered sequentially... More... | |
MeshSerializer | _serializer |
Tetgen only operates on serial meshes. More... | |
std::string | _switches |
Parameter controlling the behaviour of tetgen. More... | |
Class TetGenMeshInterface
provides an interface for tetrahedralization of meshes using the TetGen library.
For information about TetGen cf. TetGen home page.
Definition at line 54 of file mesh_tetgen_interface.h.
|
explicit |
Constructor.
Takes a reference to the mesh.
Definition at line 40 of file mesh_tetgen_interface.C.
|
default |
Empty destructor.
|
protected |
Assigns the node IDs contained in the 'node_labels' array to 'elem'.
Definition at line 381 of file mesh_tetgen_interface.C.
References _mesh, _sequential_to_libmesh_node_map, libMesh::Elem::node_index_range(), libMesh::MeshBase::node_ptr(), and libMesh::Elem::set_node().
Referenced by pointset_convexhull(), triangulate_conformingDelaunayMesh_carvehole(), and triangulate_pointset().
|
protected |
This function checks the integrity of the current set of elements in the Mesh to see if they comprise a convex hull, that is:
Definition at line 398 of file mesh_tetgen_interface.C.
References _mesh, libMesh::MeshBase::n_elem(), and libMesh::TRI3.
Referenced by triangulate_conformingDelaunayMesh_carvehole().
|
protected |
Delete original convex hull elements from the Mesh after performing a Delaunay tetrahedralization.
Definition at line 453 of file mesh_tetgen_interface.C.
References _mesh, libMesh::MeshBase::delete_elem(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::regenerate_id_sets(), and libMesh::TRI3.
Referenced by triangulate_conformingDelaunayMesh_carvehole().
|
protected |
This function copies nodes from the _mesh into TetGen's pointlist.
Takes some pains to ensure that non-sequential node numberings (which can happen with e.g. DistributedMesh) are handled.
Definition at line 353 of file mesh_tetgen_interface.C.
References _mesh, _sequential_to_libmesh_node_map, libMesh::TetGenWrapper::allocate_pointlist(), libMesh::MeshBase::n_nodes(), and libMesh::TetGenWrapper::set_node().
Referenced by pointset_convexhull(), triangulate_conformingDelaunayMesh_carvehole(), and triangulate_pointset().
void libMesh::TetGenMeshInterface::pointset_convexhull | ( | ) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Stores only 2D hull surface elements.
Definition at line 115 of file mesh_tetgen_interface.C.
References _mesh, _switches, libMesh::MeshBase::add_elem(), assign_nodes_to_elem(), libMesh::Elem::build(), libMesh::MeshBase::delete_elem(), fill_pointlist(), libMesh::MeshBase::get_boundary_info(), libMesh::TetGenWrapper::get_numberoftrifaces(), libMesh::TetGenWrapper::get_triface_node(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::TetGenWrapper::run_tetgen(), libMesh::TetGenWrapper::set_switches(), and libMesh::TRI3.
Referenced by add_cube_convex_hull_to_mesh().
|
protected |
This function prints an informative message and crashes based on the output of the check_hull_integrity() function.
It is a separate function so that you can check hull integrity without crashing if you desire.
Definition at line 434 of file mesh_tetgen_interface.C.
References libMesh::err.
Referenced by triangulate_conformingDelaunayMesh_carvehole().
void libMesh::TetGenMeshInterface::set_switches | ( | std::string | new_switches | ) |
Method to set switches to tetgen, allowing for different behaviours.
Definition at line 47 of file mesh_tetgen_interface.C.
References _switches.
Referenced by tetrahedralize_domain().
void libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh | ( | double | quality_constraint = 0. , |
double | volume_constraint = 0. |
||
) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Boundary constraints are taken from elements array.
Definition at line 167 of file mesh_tetgen_interface.C.
References triangulate_conformingDelaunayMesh_carvehole().
void libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole | ( | const std::vector< Point > & | holes, |
double | quality_constraint = 0. , |
||
double | volume_constraint = 0. |
||
) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Boundary constraints are taken from elements array. Include carve-out functionality.
Definition at line 177 of file mesh_tetgen_interface.C.
References _mesh, _sequential_to_libmesh_node_map, _switches, libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::TetGenWrapper::allocate_facet_polygonlist(), libMesh::TetGenWrapper::allocate_facetlist(), libMesh::TetGenWrapper::allocate_polygon_vertexlist(), assign_nodes_to_elem(), libMesh::Utility::binary_find(), libMesh::Elem::build(), check_hull_integrity(), delete_2D_hull_elements(), distance(), fill_pointlist(), libMesh::TetGenWrapper::get_element_node(), libMesh::TetGenWrapper::get_numberofpoints(), libMesh::TetGenWrapper::get_numberoftetrahedra(), libMesh::TetGenWrapper::get_output_node(), libMesh::DofObject::id(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), process_hull_integrity_result(), libMesh::TetGenWrapper::run_tetgen(), libMesh::TetGenWrapper::set_hole(), libMesh::TetGenWrapper::set_switches(), libMesh::TetGenWrapper::set_vertex(), and libMesh::TET4.
Referenced by tetrahedralize_domain(), and triangulate_conformingDelaunayMesh().
void libMesh::TetGenMeshInterface::triangulate_pointset | ( | ) |
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Definition at line 61 of file mesh_tetgen_interface.C.
References _mesh, _switches, libMesh::MeshBase::add_elem(), assign_nodes_to_elem(), libMesh::Elem::build(), fill_pointlist(), libMesh::TetGenWrapper::get_element_node(), libMesh::TetGenWrapper::get_numberoftetrahedra(), libMesh::TetGenWrapper::run_tetgen(), libMesh::TetGenWrapper::set_switches(), and libMesh::TET4.
|
protected |
Local reference to the mesh we are working with.
Definition at line 151 of file mesh_tetgen_interface.h.
Referenced by assign_nodes_to_elem(), check_hull_integrity(), delete_2D_hull_elements(), fill_pointlist(), pointset_convexhull(), triangulate_conformingDelaunayMesh_carvehole(), and triangulate_pointset().
|
protected |
We should not assume libmesh nodes are numbered sequentially...
This is not the default behavior of DistributedMesh, for example, unless you specify node IDs explicitly. So this array allows us to keep a mapping between the sequential numbering in tetgen_data.pointlist.
Definition at line 160 of file mesh_tetgen_interface.h.
Referenced by assign_nodes_to_elem(), fill_pointlist(), and triangulate_conformingDelaunayMesh_carvehole().
|
protected |
Tetgen only operates on serial meshes.
Definition at line 165 of file mesh_tetgen_interface.h.
|
protected |
Parameter controlling the behaviour of tetgen.
By default quiet.
Definition at line 171 of file mesh_tetgen_interface.h.
Referenced by pointset_convexhull(), set_switches(), triangulate_conformingDelaunayMesh_carvehole(), and triangulate_pointset().