mesh_tetgen_wrapper.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 // libMesh includes
25 #include "libmesh/auto_ptr.h" // deprecated
26 
27 // TetGen include file
28 #include "tetgen.h" // Defines REAL and other Tetgen types
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
void set_polygon_numberofvertices(unsigned i, unsigned j, int num)
REAL get_element_attribute(unsigned i)
void set_facet_numberofpolygons(unsigned i, int num)
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)
void set_facet_numberofholes(unsigned i, int num)
void set_vertex(unsigned i, unsigned j, unsigned k, int nodeindex)
void allocate_polygon_vertexlist(unsigned i, unsigned j, int numofvertices)
void allocate_pointlist(int numofpoints)
void set_node(unsigned i, REAL x, REAL y, REAL z)
void set_switches(const std::string &s)
std::unique_ptr< tetgenio > tetgen_output
void allocate_facet_polygonlist(unsigned i, int numofpolygons)
void set_hole(unsigned i, REAL x, REAL y, REAL z)
void allocate_regionlist(int numofregions)
void set_region(unsigned i, REAL x, REAL y, REAL z, REAL attribute, REAL vol_constraint)
void allocate_facetlist(int numoffacets, int numofholes)