libMesh
mesh_tetgen_wrapper.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 #ifndef LIBMESH_MESH_TETGEN_WRAPPER_H
19 #define LIBMESH_MESH_TETGEN_WRAPPER_H
20 
21 #include "libmesh/libmesh_config.h"
22 #ifdef LIBMESH_HAVE_TETGEN
23 
24 // TetGen include file
25 // tetgen.h triggers -Werror=switch-default
26 #include "libmesh/ignore_warnings.h"
27 #include "tetgen.h" // Defines REAL and other Tetgen types
28 #include "libmesh/restore_warnings.h"
29 
30 // C++ includes
31 #include <string>
32 #include <memory>
33 
34 namespace libMesh
35 {
46 {
47 public:
48 
52  TetGenWrapper ();
53 
57  ~TetGenWrapper ();
58 
91  void set_switches(const std::string & s);
92 
96  void run_tetgen();
97 
102 
106  int get_numberoftrifaces();
107 
111  void set_numberofpoints(int i);
112 
116  int get_numberofpoints();
117 
121  void set_numberoffacets(int i);
122 
126  void set_numberofholes(int i);
127 
131  void set_numberofregions(int i);
132 
136  void allocate_pointlist(int numofpoints);
137 
141  void allocate_facetlist(int numoffacets, int numofholes);
142 
146  void allocate_regionlist(int numofregions);
147 
151  void set_node(unsigned i, REAL x, REAL y, REAL z);
152 
156  void get_output_node(unsigned i, REAL & x, REAL & y, REAL & z);
157 
161  int get_element_node(unsigned i, unsigned j);
162 
166  int get_triface_node(unsigned i, unsigned j);
167 
171  REAL get_element_attribute(unsigned i);
172 
176  void set_hole(unsigned i, REAL x, REAL y, REAL z);
177 
181  void set_facet_numberofpolygons(unsigned i, int num);
182 
186  void set_facet_numberofholes(unsigned i, int num);
187 
192  void allocate_facet_polygonlist(unsigned i, int numofpolygons);
193 
197  void set_polygon_numberofvertices(unsigned i, unsigned j, int num);
198 
203  void allocate_polygon_vertexlist(unsigned i, unsigned j, int numofvertices);
204 
209  void set_vertex(unsigned i, unsigned j, unsigned k, int nodeindex);
210 
219  void set_region(unsigned i, REAL x, REAL y, REAL z,
220  REAL attribute, REAL vol_constraint);
221 
225  tetgenio tetgen_data;
226 
230  std::unique_ptr<tetgenio> tetgen_output;
231 
235  tetgenmesh tetgen_mesh;
236 
240  tetgenbehavior tetgen_be;
241 };
242 
243 
244 
245 } // namespace libMesh
246 
247 
248 #endif // LIBMESH_HAVE_TETGEN
249 #endif // LIBMESH_MESH_TETGEN_WRAPPER_H
libMesh::TetGenWrapper::tetgen_mesh
tetgenmesh tetgen_mesh
TetGen mesh structure (from the TetGen library).
Definition: mesh_tetgen_wrapper.h:235
libMesh::TetGenWrapper::get_numberofpoints
int get_numberofpoints()
Definition: mesh_tetgen_wrapper.C:107
libMesh::TetGenWrapper::TetGenWrapper
TetGenWrapper()
Constructor.
Definition: mesh_tetgen_wrapper.C:32
libMesh::TetGenWrapper
The TetGenWrapper provides an interface for basic access to TetGen data structures and methods.
Definition: mesh_tetgen_wrapper.h:45
libMesh::TetGenWrapper::set_numberofholes
void set_numberofholes(int i)
Sets the number of holes in the TetGen input.
Definition: mesh_tetgen_wrapper.C:192
libMesh::TetGenWrapper::set_facet_numberofpolygons
void set_facet_numberofpolygons(unsigned i, int num)
Sets the number of polygons for facet i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:260
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TetGenWrapper::set_facet_numberofholes
void set_facet_numberofholes(unsigned i, int num)
Sets the number of holes for facet i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:268
libMesh::TetGenWrapper::get_element_node
int get_element_node(unsigned i, unsigned j)
Definition: mesh_tetgen_wrapper.C:114
libMesh::TetGenWrapper::tetgen_output
std::unique_ptr< tetgenio > tetgen_output
TetGen output structure.
Definition: mesh_tetgen_wrapper.h:230
libMesh::TetGenWrapper::allocate_polygon_vertexlist
void allocate_polygon_vertexlist(unsigned i, unsigned j, int numofvertices)
Allocates memory, sets number of vertices for polygon j, facet i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:307
libMesh::TetGenWrapper::set_hole
void set_hole(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of hole i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:58
libMesh::TetGenWrapper::tetgen_be
tetgenbehavior tetgen_be
TetGen control class (from the TetGen library).
Definition: mesh_tetgen_wrapper.h:240
libMesh::TetGenWrapper::allocate_pointlist
void allocate_pointlist(int numofpoints)
Allocates memory, sets number of nodes in the TetGen input.
Definition: mesh_tetgen_wrapper.C:136
libMesh::TetGenWrapper::set_vertex
void set_vertex(unsigned i, unsigned j, unsigned k, int nodeindex)
Sets index of ith facet, jth polygon, kth vertex in the TetGen input.
Definition: mesh_tetgen_wrapper.C:326
libMesh::TetGenWrapper::set_node
void set_node(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of point i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:48
libMesh::TetGenWrapper::get_numberoftetrahedra
int get_numberoftetrahedra()
Definition: mesh_tetgen_wrapper.C:93
libMesh::REAL
Real REAL
Definition: mesh_triangle_wrapper.h:44
libMesh::TetGenWrapper::set_numberofregions
void set_numberofregions(int i)
Sets the number of regions in the TetGen input.
Definition: mesh_tetgen_wrapper.C:200
libMesh::TetGenWrapper::get_element_attribute
REAL get_element_attribute(unsigned i)
Definition: mesh_tetgen_wrapper.C:128
libMesh::TetGenWrapper::get_output_node
void get_output_node(unsigned i, REAL &x, REAL &y, REAL &z)
Definition: mesh_tetgen_wrapper.C:76
libMesh::TetGenWrapper::set_region
void set_region(unsigned i, REAL x, REAL y, REAL z, REAL attribute, REAL vol_constraint)
Sets coordinates, attribute, and volume constraint for region i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:334
libMesh::TetGenWrapper::set_numberofpoints
void set_numberofpoints(int i)
Sets the number of nodes in the TetGen input.
Definition: mesh_tetgen_wrapper.C:68
libMesh::TetGenWrapper::tetgen_data
tetgenio tetgen_data
TetGen input structure.
Definition: mesh_tetgen_wrapper.h:225
libMesh::TetGenWrapper::allocate_regionlist
void allocate_regionlist(int numofregions)
Allocates memory, sets number of regions in the TetGen input.
Definition: mesh_tetgen_wrapper.C:242
libMesh::TetGenWrapper::set_switches
void set_switches(const std::string &s)
Method to set TetGen commandline switches -p Tetrahedralizes a piecewise linear complex (....
Definition: mesh_tetgen_wrapper.C:155
libMesh::TetGenWrapper::get_triface_node
int get_triface_node(unsigned i, unsigned j)
Definition: mesh_tetgen_wrapper.C:121
libMesh::TetGenWrapper::get_numberoftrifaces
int get_numberoftrifaces()
Definition: mesh_tetgen_wrapper.C:100
libMesh::TetGenWrapper::~TetGenWrapper
~TetGenWrapper()
Destructor.
Definition: mesh_tetgen_wrapper.C:42
libMesh::TetGenWrapper::set_polygon_numberofvertices
void set_polygon_numberofvertices(unsigned i, unsigned j, int num)
Sets the number of vertices for polygon j, facet i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:299
libMesh::TetGenWrapper::set_numberoffacets
void set_numberoffacets(int i)
Sets the number of facets in the TetGen input.
Definition: mesh_tetgen_wrapper.C:184
libMesh::TetGenWrapper::allocate_facet_polygonlist
void allocate_facet_polygonlist(unsigned i, int numofpolygons)
Allocates memory, sets number of polygons for facet i in the TetGen input.
Definition: mesh_tetgen_wrapper.C:277
libMesh::TetGenWrapper::allocate_facetlist
void allocate_facetlist(int numoffacets, int numofholes)
Allocates memory, sets number of facets, holes in the TetGen input.
Definition: mesh_tetgen_wrapper.C:208
libMesh::TetGenWrapper::run_tetgen
void run_tetgen()
Starts the triangulation.
Definition: mesh_tetgen_wrapper.C:176