libMesh
mesh_tetgen_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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_TETGEN_INTERFACE_H
20 #define LIBMESH_MESH_TETGEN_INTERFACE_H
21 
22 #include "libmesh/libmesh_config.h"
23 #ifdef LIBMESH_HAVE_TETGEN
24 
25 
26 // Local includes
27 #include "libmesh/mesh_serializer.h"
28 #include "libmesh/mesh_tet_interface.h"
29 #include "libmesh/point.h" // used for specifying holes
30 
31 // C++ includes
32 #include <cstddef>
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 namespace libMesh
38 {
39 // Forward Declarations
40 class UnstructuredMesh;
41 class TetGenWrapper;
42 class Elem;
43 
56 {
57 public:
58 
62  explicit
64 
68  virtual ~TetGenMeshInterface() override = default;
69 
73  void set_switches(std::string new_switches);
74 
78  virtual void triangulate () override;
79 
84  void triangulate_pointset ();
85 
90  void pointset_convexhull ();
91 
97  void triangulate_conformingDelaunayMesh (double quality_constraint=0.,
98  double volume_constraint=0.);
99 
105  void triangulate_conformingDelaunayMesh_carvehole (const std::vector<Point> & holes,
106  double quality_constraint=0.,
107  double volume_constraint=0.);
108 
109 
110 
111 protected:
118  void fill_pointlist(TetGenWrapper & wrapper);
119 
124  void assign_nodes_to_elem(unsigned * node_labels, Elem * elem);
125 
133  std::vector<unsigned> _sequential_to_libmesh_node_map;
134 
139 
144  std::string _switches;
145 };
146 
147 } // namespace libMesh
148 
149 #endif // LIBMESH_HAVE_TETGEN
150 
151 #endif // LIBMESH_MESH_TETGEN_INTERFACE_H
MeshSerializer _serializer
Tetgen only operates on serial meshes.
Class TetGenMeshInterface provides an interface for tetrahedralization of meshes using the TetGen lib...
virtual ~TetGenMeshInterface() override=default
Empty destructor.
void set_switches(std::string new_switches)
Method to set switches to tetgen, allowing for different behaviours.
std::string _switches
Parameter controlling the behaviour of tetgen.
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...
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
std::vector< unsigned > _sequential_to_libmesh_node_map
We should not assume libmesh nodes are numbered sequentially...
MeshBase & mesh
TetGenMeshInterface(UnstructuredMesh &mesh)
Constructor.
The libMesh namespace provides an interface to certain functionality in the library.
void triangulate_pointset()
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set...
The TetGenWrapper provides an interface for basic access to TetGen data structures and methods...
The UnstructuredMesh class is derived from the MeshBase class.
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...
void assign_nodes_to_elem(unsigned *node_labels, Elem *elem)
Assigns the node IDs contained in the &#39;node_labels&#39; array to &#39;elem&#39;.
Temporarily serialize a DistributedMesh for non-distributed-mesh capable code paths.
void fill_pointlist(TetGenWrapper &wrapper)
This function copies nodes from the _mesh into TetGen&#39;s pointlist.
void pointset_convexhull()
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set...
virtual void triangulate() override
Method invokes TetGen library to compute a Delaunay tetrahedralization.
Class MeshTetInterface provides an abstract interface for tetrahedralization of meshes by subclasses...