libMesh
mesh_tetgen_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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/point.h" // used for specifying holes
29 
30 // C++ includes
31 #include <cstddef>
32 #include <map>
33 #include <string>
34 #include <vector>
35 
36 namespace libMesh
37 {
38 // Forward Declarations
39 class UnstructuredMesh;
40 class TetGenWrapper;
41 class Elem;
42 
55 {
56 public:
57 
61  explicit
63 
68 
72  void set_switches(const std::string &);
73 
78  void triangulate_pointset ();
79 
84  void pointset_convexhull ();
85 
91  void triangulate_conformingDelaunayMesh (double quality_constraint=0.,
92  double volume_constraint=0.);
93 
99  void triangulate_conformingDelaunayMesh_carvehole (const std::vector<Point> & holes,
100  double quality_constraint=0.,
101  double volume_constraint=0.);
102 
103 
104 
105 protected:
112  void fill_pointlist(TetGenWrapper & wrapper);
113 
118  void assign_nodes_to_elem(unsigned * node_labels, Elem * elem);
119 
132  unsigned check_hull_integrity();
133 
140  void process_hull_integrity_result(unsigned result);
141 
147 
152 
160  std::vector<unsigned> _sequential_to_libmesh_node_map;
161 
166 
171  std::string _switches;
172 };
173 
174 } // namespace libMesh
175 
176 #endif // LIBMESH_HAVE_TETGEN
177 
178 #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...
void set_switches(const std::string &)
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:89
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 process_hull_integrity_result(unsigned result)
This function prints an informative message and crashes based on the output of the check_hull_integri...
~TetGenMeshInterface()
Empty destructor.
UnstructuredMesh & _mesh
Local reference to the mesh we are working with.
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 output; a distributed mesh is allgathered by the MeshSeri...
unsigned check_hull_integrity()
This function checks the integrity of the current set of elements in the Mesh to see if they comprise...
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...
void delete_2D_hull_elements()
Delete original convex hull elements from the Mesh after performing a Delaunay tetrahedralization.