libMesh
Enumerations | Functions
libMesh::TriangleWrapper Namespace Reference

A special namespace for wrapping the standard Triangle API, as well as some helper functions for initializing/destroying the structs triangle uses to communicate. More...

Enumerations

enum  IO_Type { INPUT = 0, OUTPUT = 1, BOTH = 2 }
 

Functions

void init (triangulateio &t)
 Initializes the fields of t to nullptr/0 as necessary. More...
 
void destroy (triangulateio &t, IO_Type)
 Frees any memory which has been dynamically allocated by Triangle. More...
 
void copy_tri_to_mesh (const triangulateio &triangle_data_input, UnstructuredMesh &mesh_output, const ElemType type)
 Copies triangulation data computed by triangle from a triangulateio object to a LibMesh mesh. More...
 

Detailed Description

A special namespace for wrapping the standard Triangle API, as well as some helper functions for initializing/destroying the structs triangle uses to communicate.

Author
John W. Peterson
Date
2011 Namespace that wraps the Triangle mesh generator's API.

Enumeration Type Documentation

◆ IO_Type

Enumerator
INPUT 
OUTPUT 
BOTH 

Definition at line 65 of file mesh_triangle_wrapper.h.

Function Documentation

◆ copy_tri_to_mesh()

void libMesh::TriangleWrapper::copy_tri_to_mesh ( const triangulateio &  triangle_data_input,
UnstructuredMesh mesh_output,
const ElemType  type 
)

Copies triangulation data computed by triangle from a triangulateio object to a LibMesh mesh.

This routine is used internally by the MeshTools::Generation::build_delaunay_square(...) and MeshTools::Generation::build_delaunay_square_with_hole(...) routines.

◆ destroy()

void libMesh::TriangleWrapper::destroy ( triangulateio &  t,
IO_Type   
)

Frees any memory which has been dynamically allocated by Triangle.

Note
Triangle does not free any memory itself.
It is always safe to call free on a nullptr.
Triangle does shallow-copy (for example) the holelist pointer from the input to output struct without performing a deep copy of the holelist itself. Therefore, double-free will occur without additional care!

◆ init()

void libMesh::TriangleWrapper::init ( triangulateio &  t)

Initializes the fields of t to nullptr/0 as necessary.

This is helpful for preventing the access of uninitialized memory when working with C, which has no constructors or destructors.

Referenced by libMesh::EigenSparseVector< T >::init(), libMesh::LaspackVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::PetscVector< libMesh::Real >::init(), libMesh::EpetraVector< T >::init(), and libMesh::PetscVector< libMesh::Real >::PetscVector().