libMesh
mesh_tetgen_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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
libMesh::TetGenWrapper
The TetGenWrapper provides an interface for basic access to TetGen data structures and methods.
Definition: mesh_tetgen_wrapper.h:45
libMesh::TetGenMeshInterface::TetGenMeshInterface
TetGenMeshInterface(UnstructuredMesh &mesh)
Constructor.
Definition: mesh_tetgen_interface.C:38
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TetGenMeshInterface::fill_pointlist
void fill_pointlist(TetGenWrapper &wrapper)
This function copies nodes from the _mesh into TetGen's pointlist.
Definition: mesh_tetgen_interface.C:349
libMesh::TetGenMeshInterface::check_hull_integrity
unsigned check_hull_integrity()
This function checks the integrity of the current set of elements in the Mesh to see if they comprise...
Definition: mesh_tetgen_interface.C:394
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole
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.
Definition: mesh_tetgen_interface.C:175
libMesh::TetGenMeshInterface::_mesh
UnstructuredMesh & _mesh
Local reference to the mesh we are working with.
Definition: mesh_tetgen_interface.h:151
libMesh::TetGenMeshInterface::_sequential_to_libmesh_node_map
std::vector< unsigned > _sequential_to_libmesh_node_map
We should not assume libmesh nodes are numbered sequentially...
Definition: mesh_tetgen_interface.h:160
libMesh::MeshSerializer
Temporarily serialize a DistributedMesh for output; a distributed mesh is allgathered by the MeshSeri...
Definition: mesh_serializer.h:42
libMesh::TetGenMeshInterface::process_hull_integrity_result
void process_hull_integrity_result(unsigned result)
This function prints an informative message and crashes based on the output of the check_hull_integri...
Definition: mesh_tetgen_interface.C:430
libMesh::TetGenMeshInterface::_switches
std::string _switches
Parameter controlling the behaviour of tetgen.
Definition: mesh_tetgen_interface.h:171
libMesh::TetGenMeshInterface::_serializer
MeshSerializer _serializer
Tetgen only operates on serial meshes.
Definition: mesh_tetgen_interface.h:165
libMesh::TetGenMeshInterface::delete_2D_hull_elements
void delete_2D_hull_elements()
Delete original convex hull elements from the Mesh after performing a Delaunay tetrahedralization.
Definition: mesh_tetgen_interface.C:449
libMesh::TetGenMeshInterface::~TetGenMeshInterface
~TetGenMeshInterface()
Empty destructor.
Definition: mesh_tetgen_interface.h:67
libMesh::TetGenMeshInterface::assign_nodes_to_elem
void assign_nodes_to_elem(unsigned *node_labels, Elem *elem)
Assigns the node IDs contained in the 'node_labels' array to 'elem'.
Definition: mesh_tetgen_interface.C:377
libMesh::UnstructuredMesh
The UnstructuredMesh class is derived from the MeshBase class.
Definition: unstructured_mesh.h:48
libMesh::TetGenMeshInterface
Class TetGenMeshInterface provides an interface for tetrahedralization of meshes using the TetGen lib...
Definition: mesh_tetgen_interface.h:54
libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh
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.
Definition: mesh_tetgen_interface.C:165
libMesh::TetGenMeshInterface::triangulate_pointset
void triangulate_pointset()
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Definition: mesh_tetgen_interface.C:59
libMesh::TetGenMeshInterface::set_switches
void set_switches(const std::string &)
Method to set switches to tetgen, allowing for different behaviours.
Definition: mesh_tetgen_interface.C:45
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::TetGenMeshInterface::pointset_convexhull
void pointset_convexhull()
Method invokes TetGen library to compute a Delaunay tetrahedralization from the nodes point set.
Definition: mesh_tetgen_interface.C:113