Go to the documentation of this file.
   18 #include "libmesh/libmesh_config.h" 
   19 #ifdef LIBMESH_HAVE_TETGEN 
   25 #include "libmesh/libmesh_common.h" 
   26 #include "libmesh/mesh_tetgen_wrapper.h" 
   27 #include "libmesh/auto_ptr.h"  
   33   tetgen_output(libmesh_make_unique<tetgenio>())
 
   79   if (i >= static_cast<unsigned>(
tetgen_output->numberofpoints))
 
   80     libmesh_error_msg(
"Error, requested point "        \
 
   82                       << 
", but there are only "       \
 
   84                       << 
" points available.");
 
  146         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  162   if (s.size() >= 
sizeof(buffer)-1)
 
  163     libmesh_error_msg(
"Fixed size buffer of length "                  \
 
  165                       << 
" not large enough to hold TetGen switches.");
 
  168   buffer[ s.copy( buffer , 
sizeof( buffer ) - 1 ) ] = 
'\0' ;
 
  170   if (!
tetgen_be.parse_commandline(buffer))
 
  171     libMesh::out << 
"TetGen replies: Wrong switches!" << std::endl;
 
  219         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  224       for (
int i=0; i<numoffacets; i++)
 
  225         this->
tetgen_data.init(&(this->tetgen_data.facetlist[i]));
 
  234         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  251         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  263   this->
tetgen_data.facetlist[i].numberofpolygons = num;
 
  271   this->
tetgen_data.facetlist[i].numberofholes = num;
 
  283   if (numofpolygons > 0)
 
  286       if (this->
tetgen_data.facetlist[i].polygonlist != 
nullptr)
 
  287         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  290       this->
tetgen_data.facetlist[i].polygonlist = 
new tetgenio::polygon[numofpolygons];
 
  292       for (
int j=0; j<this->
tetgen_data.facetlist[i].numberofpolygons; j++)
 
  293         this->
tetgen_data.init(&(this->tetgen_data.facetlist[i].polygonlist[j]));
 
  302   this->
tetgen_data.facetlist[i].polygonlist[j].numberofvertices = num;
 
  312   if (numofvertices > 0)
 
  315       if (this->
tetgen_data.facetlist[i].polygonlist[j].vertexlist != 
nullptr)
 
  316         libmesh_error_msg(
"Cannot allocate on top of previously allocated memory!");
 
  319       this->
tetgen_data.facetlist[i].polygonlist[j].vertexlist = 
new int[numofvertices];
 
  329   this->
tetgen_data.facetlist[i].polygonlist[j].vertexlist[k] = nodeindex;
 
  335                                REAL attribute, 
REAL vol_constraint)
 
  337   unsigned index = i*5;
 
  348 #endif // LIBMESH_HAVE_TETGEN 
  
TetGenWrapper()
Constructor.
 
void set_numberofholes(int i)
Sets the number of holes in the TetGen input.
 
void set_facet_numberofpolygons(unsigned i, int num)
Sets the number of polygons for facet i in the TetGen input.
 
The libMesh namespace provides an interface to certain functionality in the library.
 
void set_facet_numberofholes(unsigned i, int num)
Sets the number of holes for facet i in the TetGen input.
 
int get_element_node(unsigned i, unsigned j)
 
std::unique_ptr< tetgenio > tetgen_output
TetGen output structure.
 
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 set_hole(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of hole i in the TetGen input.
 
tetgenbehavior tetgen_be
TetGen control class (from the TetGen library).
 
void allocate_pointlist(int numofpoints)
Allocates memory, sets number of nodes 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.
 
void set_node(unsigned i, REAL x, REAL y, REAL z)
Sets coordinates of point i in the TetGen input.
 
int get_numberoftetrahedra()
 
void set_numberofregions(int i)
Sets the number of regions in the TetGen input.
 
REAL get_element_attribute(unsigned i)
 
void get_output_node(unsigned i, REAL &x, REAL &y, REAL &z)
 
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 set_numberofpoints(int i)
Sets the number of nodes in the TetGen input.
 
tetgenio tetgen_data
TetGen input structure.
 
void allocate_regionlist(int numofregions)
Allocates memory, sets number of regions in the TetGen input.
 
void set_switches(const std::string &s)
Method to set TetGen commandline switches -p Tetrahedralizes a piecewise linear complex (....
 
int get_triface_node(unsigned i, unsigned j)
 
int get_numberoftrifaces()
 
~TetGenWrapper()
Destructor.
 
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_numberoffacets(int i)
Sets the number of facets in the TetGen input.
 
void allocate_facet_polygonlist(unsigned i, int numofpolygons)
Allocates memory, sets number of polygons for facet i in the TetGen input.
 
void allocate_facetlist(int numoffacets, int numofholes)
Allocates memory, sets number of facets, holes in the TetGen input.
 
void run_tetgen()
Starts the triangulation.