#include <mesh_triangle_interface.h>
Classes | |
class | ArbitraryHole |
class | Hole |
Class for parameterizing 2D holes to be meshed with Triangle. More... | |
class | PolygonHole |
Public Types | |
enum | TriangulationType { GENERATE_CONVEX_HULL = 0, PSLG = 1, INVALID_TRIANGULATION_TYPE } |
Public Member Functions | |
TriangleInterface (UnstructuredMesh &mesh) | |
~TriangleInterface () | |
void | triangulate () |
ElemType & | elem_type () |
Real & | desired_area () |
Real & | minimum_angle () |
std::string & | extra_flags () |
TriangulationType & | triangulation_type () |
bool & | insert_extra_points () |
bool & | smooth_after_generating () |
void | attach_hole_list (const std::vector< Hole *> *holes) |
Public Attributes | |
std::vector< std::pair< unsigned int, unsigned int > > | segments |
Private Attributes | |
UnstructuredMesh & | _mesh |
const std::vector< Hole * > * | _holes |
ElemType | _elem_type |
Real | _desired_area |
Real | _minimum_angle |
std::string | _extra_flags |
TriangulationType | _triangulation_type |
bool | _insert_extra_points |
bool | _smooth_after_generating |
MeshSerializer | _serializer |
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 a vector of Hole* pointers which will be meshed around.
Definition at line 162 of file mesh_triangle_interface.h.
References _holes.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square().
|
inline |
Sets and/or gets the desired triangle area. Set to zero to disable area constraint.
Definition at line 129 of file mesh_triangle_interface.h.
References _desired_area.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square().
|
inline |
Sets and/or gets the desired element type.
Definition at line 123 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 140 of file mesh_triangle_interface.h.
References _extra_flags.
|
inline |
Sets and/or gets the flag for inserting add'l points.
Definition at line 150 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 135 of file mesh_triangle_interface.h.
References _minimum_angle.
|
inline |
Sets/gets flag which tells whether to do Delaunay mesh smoothing after generating the grid.
Definition at line 156 of file mesh_triangle_interface.h.
References _smooth_after_generating.
void libMesh::TriangleInterface::triangulate | ( | ) |
This is the main public interface for this function. Internally, it calls Triangle's triangulate routine.
Definition at line 60 of file mesh_triangle_interface.C.
References _desired_area, _elem_type, _extra_flags, _holes, _insert_extra_points, _mesh, _minimum_angle, _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().
|
inline |
Sets and/or gets the desired triangulation type.
Definition at line 145 of file mesh_triangle_interface.h.
References _triangulation_type.
Referenced by libMesh::MeshTools::Generation::build_delaunay_square().
|
private |
The desired area for the elements in the resulting mesh.
Definition at line 198 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 193 of file mesh_triangle_interface.h.
Referenced by elem_type(), and triangulate().
|
private |
Additional flags to be passed to triangle
Definition at line 208 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 187 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 222 of file mesh_triangle_interface.h.
Referenced by insert_extra_points(), and triangulate().
|
private |
Reference to the mesh which is to be created by triangle.
Definition at line 181 of file mesh_triangle_interface.h.
Referenced by triangulate().
|
private |
Minimum angle in triangles
Definition at line 203 of file mesh_triangle_interface.h.
Referenced by minimum_angle(), and triangulate().
|
private |
Triangle only operates on serial meshes.
Definition at line 233 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 228 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 215 of file mesh_triangle_interface.h.
Referenced by triangulate(), and triangulation_type().
std::vector<std::pair<unsigned int, unsigned int> > libMesh::TriangleInterface::segments |
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 175 of file mesh_triangle_interface.h.
Referenced by triangulate().