libMesh
mesh_tetgen_wrapper.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 #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 // Local includes
25 #include "auto_ptr.h"
26 
27 // TetGen include file
28 #include "tetgen.h" // Defines REAL and other Tetgen types
29 
30 // C++ includes
31 #include <string>
32 
33 namespace libMesh
34 {
45 {
46 public:
47 
51  TetGenWrapper ();
52 
56  ~TetGenWrapper ();
57 
90  void set_switches(const std::string & s);
91 
95  void run_tetgen();
96 
101 
105  int get_numberoftrifaces();
106 
110  void set_numberofpoints(int i);
111 
115  int get_numberofpoints();
116 
120  void set_numberoffacets(int i);
121 
125  void set_numberofholes(int i);
126 
130  void set_numberofregions(int i);
131 
135  void allocate_pointlist(int numofpoints);
136 
140  void allocate_facetlist(int numoffacets, int numofholes);
141 
145  void allocate_regionlist(int numofregions);
146 
150  void set_node(unsigned i, REAL x, REAL y, REAL z);
151 
155  void get_output_node(unsigned i, REAL & x, REAL & y, REAL & z);
156 
160  int get_element_node(unsigned i, unsigned j);
161 
165  int get_triface_node(unsigned i, unsigned j);
166 
170  REAL get_element_attribute(unsigned i);
171 
175  void set_hole(unsigned i, REAL x, REAL y, REAL z);
176 
180  void set_facet_numberofpolygons(unsigned i, int num);
181 
185  void set_facet_numberofholes(unsigned i, int num);
186 
191  void allocate_facet_polygonlist(unsigned i, int numofpolygons);
192 
196  void set_polygon_numberofvertices(unsigned i, unsigned j, int num);
197 
202  void allocate_polygon_vertexlist(unsigned i, unsigned j, int numofvertices);
203 
208  void set_vertex(unsigned i, unsigned j, unsigned k, int nodeindex);
209 
218  void set_region(unsigned i, REAL x, REAL y, REAL z,
219  REAL attribute, REAL vol_constraint);
220 
224  tetgenio tetgen_data;
225 
230 
234  tetgenmesh tetgen_mesh;
235 
239  tetgenbehavior tetgen_be;
240 };
241 
242 
243 
244 } // namespace libMesh
245 
246 
247 #endif // LIBMESH_HAVE_TETGEN
248 #endif // LIBMESH_MESH_TETGEN_WRAPPER_H
void set_polygon_numberofvertices(unsigned i, unsigned j, int num)
Sets the number of vertices for polygon j, facet i in the TetGen input.
void set_numberofregions(int i)
Sets the number of regions in the TetGen input.
void set_numberofpoints(int i)
Sets the number of nodes in the TetGen input.
REAL get_element_attribute(unsigned i)
void set_facet_numberofpolygons(unsigned i, int num)
Sets the number of polygons for facet i in the TetGen input.
int get_element_node(unsigned i, unsigned j)
void get_output_node(unsigned i, REAL &x, REAL &y, REAL &z)
int get_triface_node(unsigned i, unsigned j)
UniquePtr< tetgenio > tetgen_output
TetGen output structure.
void set_facet_numberofholes(unsigned i, int num)
Sets the number of holes for facet i in the TetGen input.
void set_numberoffacets(int i)
Sets the number of facets in the TetGen input.
void set_vertex(unsigned i, unsigned j, unsigned k, int nodeindex)
Sets index of ith facet, jth polygon, kth vertex in the TetGen input.
The libMesh namespace provides an interface to certain functionality in the library.
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.
void allocate_pointlist(int numofpoints)
Allocates memory, sets number of nodes in the TetGen input.
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
tetgenmesh tetgen_mesh
TetGen mesh structure (from the TetGen library).
PetscErrorCode Vec x
The TetGenWrapper provides an interface for basic access to TetGen data structures and methods...
void set_node(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of point i in the TetGen input.
tetgenio tetgen_data
TetGen input structure.
void run_tetgen()
Starts the triangulation.
void set_switches(const std::string &s)
Method to set TetGen commandline switches -p Tetrahedralizes a piecewise linear complex (...
void allocate_facet_polygonlist(unsigned i, int numofpolygons)
Allocates memory, sets number of polygons for facet i in the TetGen input.
void set_hole(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of hole i in the TetGen input.
void set_numberofholes(int i)
Sets the number of holes in the TetGen input.
void allocate_regionlist(int numofregions)
Allocates memory, sets number of regions in the TetGen input.
tetgenbehavior tetgen_be
TetGen control class (from the TetGen library).
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.
void allocate_facetlist(int numoffacets, int numofholes)
Allocates memory, sets number of facets, holes in the TetGen input.