libMesh
mesh_tet_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 #ifndef LIBMESH_MESH_TET_INTERFACE_H
20 #define LIBMESH_MESH_TET_INTERFACE_H
21 
22 #include "libmesh/libmesh_config.h"
23 
24 // Local includes
25 #include "libmesh/bounding_box.h"
26 #include "libmesh/enum_elem_type.h"
27 #include "libmesh/point.h" // used for specifying holes
28 
29 // C++ includes
30 #include <cstddef>
31 #include <map>
32 #include <memory>
33 #include <string>
34 #include <vector>
35 
36 namespace libMesh
37 {
38 // Forward Declarations
39 class UnstructuredMesh;
40 class Elem;
41 
50 {
51 public:
52 
56  explicit
58 
62  virtual ~MeshTetInterface();
63 
69 
76 
82 
88  void attach_hole_list(std::unique_ptr<std::vector<std::unique_ptr<UnstructuredMesh>>> holes);
89 
93  virtual void triangulate () = 0;
94 
103  void set_verbosity(unsigned int v);
104 
105 protected:
106 
110  unsigned int _verbosity;
111 
120 
125  NON_TRI3 = 1, // a non-TRI3 element is found
126  MISSING_NEIGHBOR = 2, // an element with a nullptr-neighbor is found
127  EMPTY_MESH = 3, // the mesh is empty
128  MISSING_BACKLINK = 4, // an element neighbor isn't linked back to it
129  BAD_NEIGHBOR_NODES = 5, // an element neighbor isn't linked to expected nodes
130  NON_ORIENTED = 6, // an element neighbor has inconsistent orientation
131  BAD_NEIGHBOR_LINKS = 7, // an element neighbor has other inconsistent links
132  DEGENERATE_ELEMENT = 8, // an element has zero area
133  DEGENERATE_MESH = 9 // the mesh clearly bounds zero volume
134  };
135 
148  [[nodiscard]] std::set<SurfaceIntegrity> check_hull_integrity() const;
149 
158  [[nodiscard]] std::set<SurfaceIntegrity> improve_hull_integrity();
159 
166  void process_hull_integrity_result(const std::set<SurfaceIntegrity> & result) const;
167 
173 
179 
185 
190 
195 
200  std::unique_ptr<std::vector<std::unique_ptr<UnstructuredMesh>>> _holes;
201 };
202 
203 
204 // ------------------------------------------------------------
205 // MeshTetInterface class member functions
206 inline
207 void
209 {
210  this->_verbosity = v;
211 }
212 
213 
214 } // namespace libMesh
215 
216 #endif // LIBMESH_MESH_TET_INTERFACE_H
ElemType
Defines an enum for geometric element types.
ElemType _elem_type
The exact type of tetrahedra we intend to construct.
std::unique_ptr< std::vector< std::unique_ptr< UnstructuredMesh > > > _holes
A pointer to a vector of meshes each defining a hole.
Real & desired_volume()
Sets and/or gets the desired tetrahedron volume.
void set_verbosity(unsigned int v)
Sets a verbosity level, defaulting to 0 (print nothing), to be set as high as 100 (print everything)...
MeshBase & mesh
void process_hull_integrity_result(const std::set< SurfaceIntegrity > &result) const
This function prints an informative message and throws an exception based on the output of the check_...
The libMesh namespace provides an interface to certain functionality in the library.
MeshTetInterface(UnstructuredMesh &mesh)
Constructor.
SurfaceIntegrity
Enumeration of possible surface mesh integrity issues.
ElemType & elem_type()
Sets and/or gets the desired element type.
The UnstructuredMesh class is derived from the MeshBase class.
virtual ~MeshTetInterface()
Default destructor in base class.
static BoundingBox volume_to_surface_mesh(UnstructuredMesh &mesh)
Remove volume elements from the given mesh, after converting their outer boundary faces to surface el...
void attach_hole_list(std::unique_ptr< std::vector< std::unique_ptr< UnstructuredMesh >>> holes)
Attaches a vector of Mesh pointers defining holes which will be meshed around.
Defines a Cartesian bounding box by the two corner extremum.
Definition: bounding_box.h:40
Real _desired_volume
The desired volume for the elements in the resulting mesh.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::set< SurfaceIntegrity > check_hull_integrity() const
This function checks the integrity of the current set of elements in the Mesh to see if they comprise...
virtual void triangulate()=0
This is the main public interface for this function.
bool & smooth_after_generating()
Sets/gets flag which tells whether to do two steps of Laplace mesh smoothing after generating the gri...
std::set< SurfaceIntegrity > improve_hull_integrity()
This function checks the integrity of the current set of elements in the Mesh, and corrects what it c...
unsigned int _verbosity
verbosity setting
UnstructuredMesh & _mesh
Local reference to the mesh we are working with.
void delete_2D_hull_elements()
Delete original convex hull elements from the Mesh after performing a Delaunay tetrahedralization.
bool _smooth_after_generating
Flag which tells whether we should smooth the mesh after it is generated.
Class MeshTetInterface provides an abstract interface for tetrahedralization of meshes by subclasses...