libMesh
|
A C++ interface between LibMesh and the Triangle library written by J.R. More...
#include <mesh_triangle_interface.h>
Classes | |
class | ArbitraryHole |
Another concrete instantiation of the hole, this one should be sufficiently general for most non-polygonal purposes. More... | |
class | Hole |
An abstract class for defining a 2-dimensional hole. More... | |
class | PolygonHole |
A concrete instantiation of the Hole class that describes polygonal (triangular, square, pentagonal, ...) holes. More... | |
class | Region |
A class for defining a 2-dimensional region for Triangle. More... | |
Public Types | |
enum | TriangulationType { GENERATE_CONVEX_HULL = 0, PSLG = 1, INVALID_TRIANGULATION_TYPE } |
The TriangulationType is used with the general triangulate function defined below. More... | |
Public Member Functions | |
TriangleInterface (UnstructuredMesh &mesh) | |
The constructor. More... | |
~TriangleInterface () | |
Empty destructor. More... | |
void | triangulate () |
This is the main public interface for this function. More... | |
ElemType & | elem_type () |
Sets and/or gets the desired element type. More... | |
Real & | desired_area () |
Sets and/or gets the desired triangle area. More... | |
Real & | minimum_angle () |
Sets and/or gets the minimum angle. More... | |
std::string & | extra_flags () |
Sets and/or gets additional flags to be passed to triangle. More... | |
TriangulationType & | triangulation_type () |
Sets and/or gets the desired triangulation type. More... | |
bool & | insert_extra_points () |
Sets and/or gets the flag for inserting add'l points. More... | |
bool & | smooth_after_generating () |
Sets/gets flag which tells whether to do Delaunay mesh smoothing after generating the grid. More... | |
bool & | quiet () |
Whether or not to make Triangle quiet. More... | |
void | attach_hole_list (const std::vector< Hole * > *holes) |
Attaches a vector of Hole* pointers which will be meshed around. More... | |
void | attach_boundary_marker (const std::vector< int > *markers) |
Attaches boundary markers. More... | |
void | attach_region_list (const std::vector< Region * > *regions) |
Attaches regions for using attribute to set subdomain IDs and better controlling the triangle sizes within the regions. More... | |
Public Attributes | |
std::vector< std::pair< unsigned int, unsigned int > > | segments |
When constructing a PSLG, it is often not possible to do so implicitly through the ordering of the points. More... | |
Private Attributes | |
UnstructuredMesh & | _mesh |
Reference to the mesh which is to be created by triangle. More... | |
const std::vector< Hole * > * | _holes |
A pointer to a vector of Hole*s. More... | |
const std::vector< int > * | _markers |
Boundary markers. More... | |
const std::vector< Region * > * | _regions |
A pointer to a vector of Regions*s. More... | |
ElemType | _elem_type |
The type of elements to generate. More... | |
Real | _desired_area |
The desired area for the elements in the resulting mesh. More... | |
Real | _minimum_angle |
Minimum angle in triangles. More... | |
std::string | _extra_flags |
Additional flags to be passed to triangle. More... | |
TriangulationType | _triangulation_type |
The type of triangulation to perform: choices are: convex hull PSLG. More... | |
bool | _insert_extra_points |
Flag which tells whether or not to insert additional nodes before triangulation. More... | |
bool | _smooth_after_generating |
Flag which tells whether we should smooth the mesh after it is generated. More... | |
bool | _quiet |
Flag which tells if we want to suppress Triangle outputs. More... | |
MeshSerializer | _serializer |
Triangle only operates on serial meshes. More... | |
A C++ interface between LibMesh and the Triangle library written by J.R.
Shewchuk.
Definition at line 57 of file mesh_triangle_interface.h.
The TriangulationType is used with the general triangulate function defined below.
Enumerator | |
---|---|
GENERATE_CONVEX_HULL | Uses the triangle library to first generate a convex hull from the set of points passed in, and then triangulate this set of points. This is probably the most common type of usage. |
PSLG | Use the triangle library to triangulate a Planar Straight Line Graph which is defined implicitly by the order of the "points" vector: a straight line is assumed to lie between each successive pair of points, with an additional line joining the final and first points. In case your triangulation is a little too "structured" looking (which can happen when the initial PSLG is really simple) you can try to make the resulting triangulation a little more "unstructured" looking by setting insert_points to true in the triangulate() function. |
INVALID_TRIANGULATION_TYPE | Does nothing, used as a default value. |
Definition at line 78 of file mesh_triangle_interface.h.
|
explicit |
The constructor.
A reference to the mesh containing the points which are to be triangulated must be provided. Unless otherwise specified, a convex hull will be computed for the set of input points and the convex hull will be meshed.
Definition at line 44 of file mesh_triangle_interface.C.
|
inline |
|
inline |
Attaches boundary markers.
If segments is set, the number of markers must be equal to the size of segments, otherwise, it is equal to the number of points.
Definition at line 194 of file mesh_triangle_interface.h.
References _markers.
|
inline |
Attaches a vector of Hole* pointers which will be meshed around.
Definition at line 174 of file mesh_triangle_interface.h.
References _holes.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), and triangulate_domain().
|
inline |
Attaches regions for using attribute to set subdomain IDs and better controlling the triangle sizes within the regions.
Definition at line 200 of file mesh_triangle_interface.h.
References _regions.
|
inline |
Sets and/or gets the desired triangle area.
Set to zero to disable area constraint.
Definition at line 136 of file mesh_triangle_interface.h.
References _desired_area.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), and triangulate_domain().
|
inline |
Sets and/or gets the desired element type.
Definition at line 130 of file mesh_triangle_interface.h.
References _elem_type.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square().
|
inline |
Sets and/or gets additional flags to be passed to triangle.
Definition at line 147 of file mesh_triangle_interface.h.
References _extra_flags.
|
inline |
Sets and/or gets the flag for inserting add'l points.
Definition at line 157 of file mesh_triangle_interface.h.
References _insert_extra_points.
|
inline |
Sets and/or gets the minimum angle.
Set to zero to disable area constraint.
Definition at line 142 of file mesh_triangle_interface.h.
References _minimum_angle.
|
inline |
Whether or not to make Triangle quiet.
Definition at line 168 of file mesh_triangle_interface.h.
References _quiet.
|
inline |
Sets/gets flag which tells whether to do Delaunay mesh smoothing after generating the grid.
Definition at line 163 of file mesh_triangle_interface.h.
References _smooth_after_generating.
Referenced by triangulate_domain().
void libMesh::TriangleInterface::triangulate | ( | ) |
This is the main public interface for this function.
Internally, it calls Triangle's triangulate routine.
Definition at line 63 of file mesh_triangle_interface.C.
References _desired_area, _elem_type, _extra_flags, _holes, _insert_extra_points, _markers, _mesh, _minimum_angle, _quiet, _regions, _smooth_after_generating, _triangulation_type, libMesh::MeshBase::add_point(), libMesh::MeshBase::clear(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::TriangleWrapper::destroy(), GENERATE_CONVEX_HULL, libMesh::TriangleWrapper::init(), libMesh::TriangleWrapper::INPUT, INVALID_TRIANGULATION_TYPE, libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr_range(), libMesh::TriangleWrapper::OUTPUT, libMesh::MeshBase::prepare_for_use(), PSLG, segments, libMesh::MeshBase::set_mesh_dimension(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::TOLERANCE, libMesh::TRI3, and libMesh::TRI6.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), and triangulate_domain().
|
inline |
Sets and/or gets the desired triangulation type.
Definition at line 152 of file mesh_triangle_interface.h.
References _triangulation_type.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), and triangulate_domain().
|
private |
The desired area for the elements in the resulting mesh.
Definition at line 234 of file mesh_triangle_interface.h.
Referenced by desired_area(), and triangulate().
|
private |
The type of elements to generate.
(Defaults to TRI3).
Definition at line 229 of file mesh_triangle_interface.h.
Referenced by elem_type(), and triangulate().
|
private |
Additional flags to be passed to triangle.
Definition at line 244 of file mesh_triangle_interface.h.
Referenced by extra_flags(), and triangulate().
|
private |
A pointer to a vector of Hole*s.
If this is nullptr, there are no holes!
Definition at line 212 of file mesh_triangle_interface.h.
Referenced by attach_hole_list(), and triangulate().
|
private |
Flag which tells whether or not to insert additional nodes before triangulation.
This can sometimes be used to "de-regularize" the resulting triangulation.
Definition at line 258 of file mesh_triangle_interface.h.
Referenced by insert_extra_points(), and triangulate().
|
private |
Boundary markers.
Definition at line 217 of file mesh_triangle_interface.h.
Referenced by attach_boundary_marker(), and triangulate().
|
private |
Reference to the mesh which is to be created by triangle.
Definition at line 206 of file mesh_triangle_interface.h.
Referenced by triangulate().
|
private |
Minimum angle in triangles.
Definition at line 239 of file mesh_triangle_interface.h.
Referenced by minimum_angle(), and triangulate().
|
private |
Flag which tells if we want to suppress Triangle outputs.
Definition at line 269 of file mesh_triangle_interface.h.
Referenced by quiet(), and triangulate().
|
private |
A pointer to a vector of Regions*s.
If this is nullptr, there are no regions!
Definition at line 223 of file mesh_triangle_interface.h.
Referenced by attach_region_list(), and triangulate().
|
private |
Triangle only operates on serial meshes.
Definition at line 274 of file mesh_triangle_interface.h.
|
private |
Flag which tells whether we should smooth the mesh after it is generated.
True by default.
Definition at line 264 of file mesh_triangle_interface.h.
Referenced by smooth_after_generating(), and triangulate().
|
private |
The type of triangulation to perform: choices are: convex hull PSLG.
Definition at line 251 of file mesh_triangle_interface.h.
Referenced by triangulate(), and triangulation_type().
When constructing a PSLG, it is often not possible to do so implicitly through the ordering of the points.
You can use the segments vector to specify the segments explicitly, Ex: unit square numbered counter-clockwise starting from origin segments[0] = (0,1) segments[1] = (1,2) segments[2] = (2,3) segments[3] = (3,0) For this case you could actually use the implicit ordering!
Definition at line 187 of file mesh_triangle_interface.h.
Referenced by triangulate().