libMesh
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
libMesh::TriangulatorInterface Class Referenceabstract

#include <triangulator_interface.h>

Inheritance diagram for libMesh::TriangulatorInterface:
[legend]

Classes

class  AffineHole
 A way to translate and/or rotate an existing hole; perhaps to tile it in many places or to put it at an angle that the underlying hole doesn't support. More...
 
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  MeshedHole
 Another concrete instantiation of the hole, as general as ArbitraryHole, but based on an existing 1D or 2D mesh. 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

 TriangulatorInterface (UnstructuredMesh &mesh)
 The constructor.
 
virtual ~TriangulatorInterface ()=default
 Empty destructor.
 
virtual void triangulate ()=0
 This is the main public interface for this function.
 
ElemType & elem_type ()
 Sets and/or gets the desired element type.
 
Real & desired_area ()
 Sets and/or gets the desired triangle area.
 
virtual void set_desired_area_function (FunctionBase< Real > *)
 Set a function giving desired triangle area as a function of position.
 
virtual FunctionBase< Real > * get_desired_area_function ()
 Get the function giving desired triangle area as a function of position, or nullptr if no such function has been set.
 
Real & minimum_angle ()
 Sets and/or gets the minimum desired angle.
 
TriangulationType & triangulation_type ()
 Sets and/or gets the desired triangulation type.
 
bool & insert_extra_points ()
 Sets and/or gets the flag for inserting add'l points.
 
void set_interpolate_boundary_points (int n_points)
 Complicated setter, for compatibility with insert_extra_points()
 
int get_interpolate_boundary_points () const
 Complicated getter, for compatibility with insert_extra_points()
 
virtual void set_refine_boundary_allowed (bool)
 Set whether or not the triangulation is allowed to refine the mesh boundary when refining the interior.
 
virtual bool refine_boundary_allowed () const
 Get whether or not the triangulation is allowed to refine the mesh boundary when refining the interior.
 
bool & smooth_after_generating ()
 Sets/gets flag which tells whether to do two steps of Laplace mesh smoothing after generating the grid.
 
bool & quiet ()
 Whether not to silence internal messages to stdout.
 
void attach_hole_list (const std::vector< Hole * > *holes)
 Attaches a vector of Hole* pointers which will be meshed around.
 
void set_verify_hole_boundaries (bool v)
 Verifying that hole boundaries don't cross the outer boundary or each other is something like O(N_bdys^2*N_points_per_bdy^2), so we only do it if requested.
 
bool get_verify_hole_boundaries () const
 
void set_fixup_tri7_center_nodes (bool v)
 For TRI7 elements, after boundary mid-edge nodes have been snapped to a curved boundary in increase_triangle_order(), the interior node can be repositioned to the curved-mapping image of the reference centroid.
 
bool get_fixup_tri7_center_nodes () const
 
void attach_boundary_marker (const std::vector< int > *markers)
 Attaches boundary markers.
 
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.
 
void set_auto_area_function (const Parallel::Communicator &comm, const unsigned int num_nearest_pts, const unsigned int power, const Real background_value, const Real background_eff_dist)
 Generate an auto area function based on spacing of boundary points.
 
bool has_auto_area_function ()
 Whether or not an auto area function has been set.
 
FunctionBase< Real > * get_auto_area_function ()
 Get the auto area function.
 
void calculate_auto_desired_area_samples (std::vector< Point > &function_points, std::vector< Real > &function_sizes, const Real &area_factor=1.5)
 The external boundary and all hole boundaries are collected.
 
void set_outer_boundary_ids (std::set< std::size_t > bdy_ids)
 A set of ids to allow on the outer boundary loop: interpreted as boundary ids of 2D elements and/or subdomain ids of 1D edges.
 
const std::set< std::size_t > & get_outer_boundary_ids () const
 

Public Attributes

std::vector< std::pair< unsigned int, unsigned int > > segments
 When constructing a PSLG, if the node numbers do not define the desired boundary segments 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 the above case you could actually use the implicit ordering!)
 
std::vector< Point > segment_midpoints
 When constructing a second-order triangulation from a second-order boundary, we may do the triangulation using first-order elements, in which case we need to save midpoint location data in order to reconstruct curvature along boundaries.
 
std::vector< Point > segment_midpoints_keys
 When saving the midpoint location data, we need to save the corresponding segment information too.
 

Protected Member Functions

void elems_to_segments ()
 Helper function to create PSLG segments from our other boundary-defining options (1D mesh edges, 2D mesh boundary sides), if no segments already exist.
 
void nodes_to_segments (dof_id_type max_node_id)
 Helper function to create PSLG segments from our node ordering, up to the maximum node id, if no segments already exist.
 
void insert_any_extra_boundary_points ()
 Helper function to add extra points (midpoints of initial segments) to a PSLG triangulation.
 
void increase_triangle_order ()
 Helper function to upconvert Tri3 to any higher order triangle type if requested via _elem_type.
 
void fixup_tri7_center_nodes ()
 Helper called at the end of increase_triangle_order() for TRI7 to reposition the interior node to the curved-mapping image of the reference centroid after boundary midpoints have been snapped.
 
void verify_quadratic_elements ()
 Helper called at the end of increase_triangle_order() to verify that no boundary-midpoint snap has tangled a quadratic triangle, by sampling the signed element Jacobian at the reference nodes and centroid.
 
void verify_holes (const Hole &outer_bdy)
 Helper function to check holes for intersections if requested.
 
unsigned int total_hole_points ()
 Helper function to count points in and verify holes.
 

Protected Attributes

UnstructuredMesh & _mesh
 Reference to the mesh which is to be created by triangle.
 
const std::vector< Hole * > * _holes
 A pointer to a vector of Hole*s.
 
const std::vector< int > * _markers
 Boundary markers.
 
const std::vector< Region * > * _regions
 A pointer to a vector of Regions*s.
 
std::set< std::size_t > _bdy_ids
 A set of ids to allow on the outer boundary loop.
 
ElemType _elem_type
 The type of elements to generate.
 
Real _desired_area
 The desired area for the elements in the resulting mesh.
 
Real _minimum_angle
 Minimum angle in triangles.
 
TriangulationType _triangulation_type
 The type of triangulation to perform: choices are: convex hull PSLG.
 
bool _insert_extra_points
 Flag which tells whether or not to insert additional nodes before triangulation.
 
int _interpolate_boundary_points
 Flag which tells how many additional nodes should be inserted between each pair of original mesh points.
 
bool _smooth_after_generating
 Flag which tells whether we should smooth the mesh after it is generated.
 
bool _quiet
 Flag which tells if we want to suppress stdout outputs.
 
bool _verify_hole_boundaries
 Flag which tells if we want to check hole geometry.
 
bool _fixup_tri7_center_nodes
 Flag which tells if we want to relocate TRI7 interior nodes to the curved-mapping centroid after snapping boundary midpoints.
 
std::unique_ptr< AutoAreaFunction > _auto_area_function
 The auto area function based on the spacing of boundary points.
 

Detailed Description

Definition at line 90 of file triangulator_interface.h.

Member Enumeration Documentation

◆ TriangulationType

The TriangulationType is used with the general triangulate function defined below.

Enumerator
GENERATE_CONVEX_HULL 

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 

Triangulate the interior of 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.

Explicitly telling the triangulator to add additional points may be important for this option.

INVALID_TRIANGULATION_TYPE 

Does nothing, used as a "null" value.

Definition at line 111 of file triangulator_interface.h.

112 {
119
130 PSLG = 1,
131
136 };
@ PSLG
Triangulate the interior of a Planar Straight Line Graph, which is defined implicitly by the order of...
@ INVALID_TRIANGULATION_TYPE
Does nothing, used as a "null" value.
@ GENERATE_CONVEX_HULL
First generate a convex hull from the set of points passed in, and then triangulate this set of point...

Constructor & Destructor Documentation

◆ TriangulatorInterface()

libMesh::TriangulatorInterface::TriangulatorInterface ( UnstructuredMesh &  mesh)
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 113 of file triangulator_interface.C.

114 : _mesh(mesh),
115 _holes(nullptr),
116 _markers(nullptr),
117 _regions(nullptr),
119 _desired_area(0.1),
120 _minimum_angle(20.0),
124 _quiet(true),
126 _auto_area_function(nullptr)
127{}
ElemType _elem_type
The type of elements to generate.
bool _smooth_after_generating
Flag which tells whether we should smooth the mesh after it is generated.
Real _desired_area
The desired area for the elements in the resulting mesh.
Real _minimum_angle
Minimum angle in triangles.
const std::vector< Hole * > * _holes
A pointer to a vector of Hole*s.
const std::vector< int > * _markers
Boundary markers.
bool _fixup_tri7_center_nodes
Flag which tells if we want to relocate TRI7 interior nodes to the curved-mapping centroid after snap...
const std::vector< Region * > * _regions
A pointer to a vector of Regions*s.
UnstructuredMesh & _mesh
Reference to the mesh which is to be created by triangle.
TriangulationType _triangulation_type
The type of triangulation to perform: choices are: convex hull PSLG.
std::unique_ptr< AutoAreaFunction > _auto_area_function
The auto area function based on the spacing of boundary points.
bool _insert_extra_points
Flag which tells whether or not to insert additional nodes before triangulation.
bool _quiet
Flag which tells if we want to suppress stdout outputs.
MeshBase & mesh

◆ ~TriangulatorInterface()

virtual libMesh::TriangulatorInterface::~TriangulatorInterface ( )
virtualdefault

Empty destructor.

Member Function Documentation

◆ attach_boundary_marker()

void libMesh::TriangulatorInterface::attach_boundary_marker ( const std::vector< int > *  markers)
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 313 of file triangulator_interface.h.

313{ _markers = markers; }

References _markers.

◆ attach_hole_list()

void libMesh::TriangulatorInterface::attach_hole_list ( const std::vector< Hole * > *  holes)
inline

◆ attach_region_list()

void libMesh::TriangulatorInterface::attach_region_list ( const std::vector< Region * > *  regions)
inline

Attaches regions for using attribute to set subdomain IDs and better controlling the triangle sizes within the regions.

Definition at line 319 of file triangulator_interface.h.

319{ _regions = regions; }

References _regions.

◆ calculate_auto_desired_area_samples()

void libMesh::TriangulatorInterface::calculate_auto_desired_area_samples ( std::vector< Point > &  function_points,
std::vector< Real > &  function_sizes,
const Real &  area_factor = 1.5 
)

The external boundary and all hole boundaries are collected.

The centroid of each EDGE element is used as the point position and the desired area is calculated as the area of the equilateral triangle with the edge length as the length of the EDGE element times an area_factor (default is 1.5).

Definition at line 635 of file triangulator_interface.C.

638{
639 // Get the hole mesh of the outer boundary
640 // Holes should already be attached if applicable when this function is called
641 const TriangulatorInterface::MeshedHole bdry_mh { _mesh, this->_bdy_ids };
642 // Collect all the centroid points of the outer boundary segments
643 // and the corresponding element sizes
644 for (unsigned int i = 0; i < bdry_mh.n_points(); i++)
645 {
646 function_points.push_back((bdry_mh.point(i) + bdry_mh.point((i + 1) % bdry_mh.n_points())) /
647 Real(2.0));
648 function_sizes.push_back(
649 (bdry_mh.point(i) - bdry_mh.point((i + 1) % bdry_mh.n_points())).norm());
650 }
651 // If holes are present, do the same for the hole boundaries
652 if(_holes)
653 for (const Hole * hole : *_holes)
654 {
655 for (unsigned int i = 0; i < hole->n_points(); i++)
656 {
657 function_points.push_back(
658 (hole->point(i) + hole->point((i + 1) % hole->n_points())) / Real(2.0));
659 function_sizes.push_back(
660 (hole->point(i) - hole->point((i + 1) % hole->n_points())).norm());
661 }
662 }
663
664 std::for_each(
665 function_sizes.begin(), function_sizes.end(), [&area_factor](Real & a) { a = a * a * area_factor * std::sqrt(3.0) / 4.0; });
666
667}
std::set< std::size_t > _bdy_ids
A set of ids to allow on the outer boundary loop.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::Real.

◆ desired_area()

Real & libMesh::TriangulatorInterface::desired_area ( )
inline

Sets and/or gets the desired triangle area.

Set to zero to disable area constraint.

If a desired_area_function is set, then desired_area() should be used to set a minimum desired area; this will reduce "false negatives" by suggesting how finely to sample desired_area_function inside large triangles, where ideally the desired_area_function will be satisfied in the triangle interior and not just at the triangle vertices.

Definition at line 177 of file triangulator_interface.h.

177{return _desired_area;}

References _desired_area.

Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), MeshTriangulationTest::commonSettings(), libMesh::Poly2TriTriangulator::insert_refinement_points(), main(), libMesh::Poly2TriTriangulator::should_refine_elem(), MeshTriangulationTest::testPoly2TriLargeCocircular(), MeshTriangulationTest::testPoly2TriRefinementBase(), MeshTriangulationTest::testTriangulatorHolePerturbed(), MeshTriangulationTest::testTriangulatorHoleTangentPerturbed(), MeshTriangulationTest::testTriangulatorInterp(), and triangulate_domain().

◆ elem_type()

ElemType & libMesh::TriangulatorInterface::elem_type ( )
inline

◆ elems_to_segments()

void libMesh::TriangulatorInterface::elems_to_segments ( )
protected

Helper function to create PSLG segments from our other boundary-defining options (1D mesh edges, 2D mesh boundary sides), if no segments already exist.

Definition at line 156 of file triangulator_interface.C.

157{
158 // Don't try to override manually specified segments
159 if (!this->segments.empty())
160 return;
161
162 // If we have edges, they should form the polyline with the ordering
163 // we want. Let's turn them into segments for later use, because
164 // we're going to delete the original elements to replace with our
165 // triangulation.
166 if (_mesh.n_elem())
167 {
168 // Mapping from points to node ids, to back those out from
169 // MeshedHole results later
170 std::map<Point, dof_id_type> point_id_map;
171
172 for (Node * node : _mesh.node_ptr_range())
173 {
174 // We're not going to support overlapping nodes on the boundary
175 libmesh_error_msg_if
176 (point_id_map.count(*node),
177 "TriangulatorInterface does not support overlapping nodes found at "
178 << static_cast<Point&>(*node));
179
180 point_id_map.emplace(*node, node->id());
181 }
182
183 // We don't support directly generating Tri6, so for
184 // compatibility with future stitching we need to be working
185 // with first-order elements. Let's get rid of any non-vertex
186 // nodes we just added.
187 for (Elem * elem : _mesh.element_ptr_range())
188 for (auto n : make_range(elem->n_vertices(), elem->n_nodes()))
189 point_id_map.erase(elem->point(n));
190
191 // We'll steal the ordering calculation from
192 // the MeshedHole code
193 const TriangulatorInterface::MeshedHole mh { _mesh, this->_bdy_ids };
194
195 // If we've specified only a subset of the mesh as our outer
196 // boundary, then we may have nodes that don't actually fall
197 // inside that boundary. Triangulator code doesn't like Steiner
198 // points that aren't inside the triangulation domain, so we
199 // need to get rid of them.
200 //
201 // Also, if we're using Edge3 elements to define our outer
202 // boundary, we're only dealing with their 2 end nodes and we'll
203 // need to get rid of their central nodes.
204 std::unordered_set<Node *> nodes_to_delete;
205
206 for (Elem * elem : _mesh.element_ptr_range())
207 for (auto n : make_range(elem->n_vertices(), elem->n_nodes()))
208 nodes_to_delete.insert(elem->node_ptr(n));
209
210 if (!this->_bdy_ids.empty())
211 {
212 for (auto & node : _mesh.node_ptr_range())
213 if (!mh.contains(*node))
214 nodes_to_delete.insert(node);
215 }
216
217 // And now we're done with elements. Delete them lest they have
218 // dangling pointers to nodes we'll be deleting.
220
221 // Make segments from boundary nodes; also make sure we don't
222 // delete them.
223 const std::size_t np = mh.n_points();
224 for (auto i : make_range(np))
225 {
226 const Point pt = mh.point(i);
227 const dof_id_type id0 = libmesh_map_find(point_id_map, pt);
228 nodes_to_delete.erase(_mesh.node_ptr(id0));
229 const Point next_pt = mh.point((np+i+1)%np);
230 const dof_id_type id1 = libmesh_map_find(point_id_map, next_pt);
231 this->segments.emplace_back(id0, id1);
232 for (auto m : make_range(mh.n_midpoints()))
233 {
234 this->segment_midpoints.emplace_back(mh.midpoint(m, i));
235 this->segment_midpoints_keys.emplace_back(pt);
236 }
237 }
238
239 for (Node * node : nodes_to_delete)
240 _mesh.delete_node(node);
241
242 if (this->_verify_hole_boundaries && _holes)
243 this->verify_holes(mh);
244 }
245}
virtual const Node * node_ptr(const dof_id_type i) const =0
virtual dof_id_type n_elem() const =0
virtual void clear_elems()=0
Deletes all the element data that is currently stored.
bool _verify_hole_boundaries
Flag which tells if we want to check hole geometry.
std::vector< std::pair< unsigned int, unsigned int > > segments
When constructing a PSLG, if the node numbers do not define the desired boundary segments implicitly ...
void verify_holes(const Hole &outer_bdy)
Helper function to check holes for intersections if requested.
std::vector< Point > segment_midpoints
When constructing a second-order triangulation from a second-order boundary, we may do the triangulat...
std::vector< Point > segment_midpoints_keys
When saving the midpoint location data, we need to save the corresponding segment information too.
bool contains(std::string_view superstring, std::string_view substring)
Look for a substring within a string.
Definition utility.C:205
uint8_t dof_id_type
Definition id_types.h:67
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176
const dof_id_type n_nodes
Definition tecplot_io.C:67

References _bdy_ids, _holes, _mesh, _verify_hole_boundaries, libMesh::MeshBase::clear_elems(), libMesh::MeshBase::delete_node(), libMesh::make_range(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::node_ptr(), segment_midpoints, segment_midpoints_keys, segments, and verify_holes().

Referenced by libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ fixup_tri7_center_nodes()

void libMesh::TriangulatorInterface::fixup_tri7_center_nodes ( )
protected

Helper called at the end of increase_triangle_order() for TRI7 to reposition the interior node to the curved-mapping image of the reference centroid after boundary midpoints have been snapped.

Safe to call unconditionally for TRI7.

Definition at line 450 of file triangulator_interface.C.

451{
452 libmesh_assert_equal_to(_elem_type, TRI7);
453
454 // Place the interior node at the image of the reference centroid
455 // (xi, eta) = (1/3, 1/3) under the curved Tri6 map, using the Tri6
456 // shape function values there as weights: -1/9 on the vertices and
457 // 4/9 on the mid-edges. This reduces to the straight-edge centroid
458 // when no boundary midpoint has moved.
459 static const Real wv = -Real(1)/9;
460 static const Real wm = Real(4)/9;
461
462 for (Elem * elem : _mesh.element_ptr_range())
463 {
464 libmesh_assert_equal_to(elem->n_vertices(), 3);
465 libmesh_assert_equal_to(elem->n_nodes(), 7u);
466
467 elem->point(6) = wv * (elem->point(0) +
468 elem->point(1) +
469 elem->point(2)) +
470 wm * (elem->point(3) +
471 elem->point(4) +
472 elem->point(5));
473 }
474}

References libMesh::Real, and libMesh::TRI7.

◆ get_auto_area_function()

FunctionBase< Real > * libMesh::TriangulatorInterface::get_auto_area_function ( )

Get the auto area function.

Definition at line 622 of file triangulator_interface.C.

623{
624 if (!_auto_area_function->initialized())
625 {
626 // Points and target element sizes for the interpolation
627 std::vector<Point> function_points;
628 std::vector<Real> function_sizes;
629 calculate_auto_desired_area_samples(function_points, function_sizes);
630 _auto_area_function->init_mfi(function_points, function_sizes);
631 }
632 return _auto_area_function.get();
633}
void calculate_auto_desired_area_samples(std::vector< Point > &function_points, std::vector< Real > &function_sizes, const Real &area_factor=1.5)
The external boundary and all hole boundaries are collected.

Referenced by libMesh::Poly2TriTriangulator::should_refine_elem().

◆ get_desired_area_function()

virtual FunctionBase< Real > * libMesh::TriangulatorInterface::get_desired_area_function ( )
inlinevirtual

Get the function giving desired triangle area as a function of position, or nullptr if no such function has been set.

Reimplemented in libMesh::Poly2TriTriangulator.

Definition at line 193 of file triangulator_interface.h.

194 { return nullptr; }

◆ get_fixup_tri7_center_nodes()

bool libMesh::TriangulatorInterface::get_fixup_tri7_center_nodes ( ) const
inline

Definition at line 275 of file triangulator_interface.h.

References _fixup_tri7_center_nodes.

◆ get_interpolate_boundary_points()

int libMesh::TriangulatorInterface::get_interpolate_boundary_points ( ) const

Complicated getter, for compatibility with insert_extra_points()

Definition at line 144 of file triangulator_interface.C.

145{
146 // backwards compatibility - someone might have turned this off via
147 // the old API
149 return 0;
150
152}
int _interpolate_boundary_points
Flag which tells how many additional nodes should be inserted between each pair of original mesh poin...

References _insert_extra_points, and _interpolate_boundary_points.

Referenced by insert_any_extra_boundary_points().

◆ get_outer_boundary_ids()

const std::set< std::size_t > & libMesh::TriangulatorInterface::get_outer_boundary_ids ( ) const
inline

Definition at line 371 of file triangulator_interface.h.

371{ return _bdy_ids; }

References _bdy_ids.

◆ get_verify_hole_boundaries()

bool libMesh::TriangulatorInterface::get_verify_hole_boundaries ( ) const
inline

Definition at line 264 of file triangulator_interface.h.

References _verify_hole_boundaries.

◆ has_auto_area_function()

bool libMesh::TriangulatorInterface::has_auto_area_function ( )
inline

Whether or not an auto area function has been set.

Definition at line 348 of file triangulator_interface.h.

348{return _auto_area_function != nullptr;}

References _auto_area_function.

Referenced by libMesh::Poly2TriTriangulator::insert_refinement_points(), and libMesh::Poly2TriTriangulator::should_refine_elem().

◆ increase_triangle_order()

void libMesh::TriangulatorInterface::increase_triangle_order ( )
protected

Helper function to upconvert Tri3 to any higher order triangle type if requested via _elem_type.

Should be called at the end of triangulate()

Definition at line 342 of file triangulator_interface.C.

343{
344 switch (_elem_type)
345 {
346 case TRI3:
347 // Nothing to do if we're not requested to increase order
348 return;
349 case TRI6:
351 break;
352 case TRI7:
354 break;
355 default:
356 libmesh_not_implemented();
357 }
358
359 // If we have any midpoint location data, we'll want to look it up
360 // by point. all_midpoints[{p, m}] will be the mth midpoint
361 // location following after point p (when traversing a triangle
362 // counter-clockwise)
363 std::map<std::pair<Point, unsigned int>, Point> all_midpoints;
364 unsigned int n_midpoints =
365 this->segment_midpoints.size() / this->segments.size();
366 libmesh_assert_equal_to(this->segments.size() * n_midpoints,
367 this->segment_midpoints.size());
368 for (auto m : make_range(n_midpoints))
369 for (auto i : make_range(this->segments.size()))
370 {
371 const Point & p = segment_midpoints_keys[i*n_midpoints+m];
372 all_midpoints[{p,m}] =
373 this->segment_midpoints[i*n_midpoints+m];
374 }
375
376 if (_holes)
377 for (const Hole * hole : *_holes)
378 {
379 if (!hole->n_midpoints())
380 continue;
381 if (!n_midpoints)
382 n_midpoints = hole->n_midpoints();
383 else if (hole->n_midpoints() != n_midpoints)
384 libmesh_not_implemented_msg
385 ("Differing boundary midpoint counts " <<
386 hole->n_midpoints() << " and " << n_midpoints);
387
388 // Our inner holes are expected to have points in
389 // counter-clockwise order, which is backwards from how we
390 // want to traverse them when iterating in counter-clockwise
391 // order over a triangle, so we'll need to reverse our maps
392 // carefully here.
393 const auto n_hole_points = hole->n_points();
394 libmesh_assert(n_hole_points);
395 for (auto m : make_range(n_midpoints))
396 {
397 for (auto i : make_range(n_hole_points-1))
398 {
399 const Point & p = hole->point(i+1);
400 all_midpoints[{p,m}] = hole->midpoint(n_midpoints-m-1, i);
401 }
402 const Point & p = hole->point(0);
403 all_midpoints[{p,m}] = hole->midpoint(n_midpoints-m-1, n_hole_points-1);
404 }
405 }
406
407 // The n_midpoints > 1 case is for future proofing, but in the
408 // present we have EDGE4 and no TRI10 yet.
409 if (n_midpoints > 1)
410 libmesh_not_implemented_msg
411 ("Cannot construct triangles with more than 1 midpoint per edge");
412
413 if (!n_midpoints)
414 return;
415
418 [&all_midpoints](Elem * elem)
419 {
420 // This should only be called right after we've finished
421 // converting a triangulation to higher order
422 libmesh_assert_equal_to(elem->n_vertices(), 3);
423 libmesh_assert_not_equal_to(elem->default_order(), FIRST);
424
425 for (auto n : make_range(3))
426 {
427 // Only hole/outer boundary segments need adjusted
428 // midpoints
429 if (elem->neighbor_ptr(n))
430 continue;
431
432 const Point & p = elem->point(n);
433
434 if (const auto it = all_midpoints.find({p,0});
435 it != all_midpoints.end())
436 elem->point(n+3) = it->second;
437 }
438 });
439
440 // Moving boundary mid-edge nodes can displace the TRI7 interior node
441 // and tangle the element map. Repositioning the interior node is
442 // opt-in (off by default); the validity check always runs.
445
447}
void all_second_order(const bool full_ordered=true)
Calls the range-based version of this function with a range consisting of all elements in the mesh.
Definition mesh_base.C:1922
const ElemRange & element_stored_range()
Definition mesh_base.C:2058
virtual void all_complete_order()
Calls the range-based version of this function with a range consisting of all elements in the mesh.
Definition mesh_base.C:1927
void fixup_tri7_center_nodes()
Helper called at the end of increase_triangle_order() for TRI7 to reposition the interior node to the...
void verify_quadratic_elements()
Helper called at the end of increase_triangle_order() to verify that no boundary-midpoint snap has ta...
void parallel_for_each(Range &&range, Body &&body, unsigned int n_threads=libMesh::n_threads())
A nicer syntax for parallel_for calls in cases where no setup or teardown is needed outside the subra...
Definition threads.h:308
libmesh_assert(ctx)

References _elem_type, _holes, _mesh, libMesh::MeshBase::all_complete_order(), libMesh::MeshBase::all_second_order(), libMesh::MeshBase::element_stored_range(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::Threads::parallel_for_each(), segment_midpoints, segment_midpoints_keys, segments, libMesh::TRI3, libMesh::TRI6, and libMesh::TRI7.

Referenced by libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ insert_any_extra_boundary_points()

void libMesh::TriangulatorInterface::insert_any_extra_boundary_points ( )
protected

Helper function to add extra points (midpoints of initial segments) to a PSLG triangulation.

Definition at line 288 of file triangulator_interface.C.

289{
290 // If the initial PSLG is really simple, e.g. an L-shaped domain or
291 // a square/rectangle, the resulting triangulation may be very
292 // "structured" looking. Sometimes this is a problem if your
293 // intention is to work with an "unstructured" looking grid. We can
294 // attempt to work around this limitation by inserting midpoints
295 // into the original PSLG. Inserting additional points into a
296 // set of points meant to be a convex hull usually makes less sense.
297
298 const int n_interpolated = this->get_interpolate_boundary_points();
299 if ((_triangulation_type==PSLG) && n_interpolated)
300 {
301 // If we were lucky enough to start with contiguous node ids,
302 // let's keep them that way.
304
305 std::vector<std::pair<unsigned int, unsigned int>> old_segments =
306 std::move(this->segments);
307
308 // We expect to have converted any elems and/or nodes into
309 // segments by now.
310 libmesh_assert(!old_segments.empty());
311
312 this->segments.clear();
313
314 // Insert a new point on each segment at evenly spaced locations
315 // between existing boundary points.
316 // np=index into new points vector
317 // n =index into original points vector
318 for (auto old_segment : old_segments)
319 {
320 Node * begin_node = _mesh.node_ptr(old_segment.first);
321 Node * end_node = _mesh.node_ptr(old_segment.second);
322 dof_id_type current_id = begin_node->id();
323 for (auto i : make_range(n_interpolated))
324 {
325 // new points are equispaced along the original segments
326 const Point new_point =
327 ((n_interpolated-i) * *(Point *)(begin_node) +
328 (i+1) * *(Point *)(end_node)) /
329 (n_interpolated + 1);
330 Node * next_node = _mesh.add_point(new_point, nn++);
331 this->segments.emplace_back(current_id,
332 next_node->id());
333 current_id = next_node->id();
334 }
335 this->segments.emplace_back(current_id,
336 end_node->id());
337 }
338 }
339}
dof_id_type id() const
Definition dof_object.h:833
virtual dof_id_type max_node_id() const =0
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
int get_interpolate_boundary_points() const
Complicated getter, for compatibility with insert_extra_points()

References _mesh, _triangulation_type, libMesh::MeshBase::add_point(), get_interpolate_boundary_points(), libMesh::DofObject::id(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshBase::max_node_id(), libMesh::MeshBase::node_ptr(), PSLG, and segments.

Referenced by libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ insert_extra_points()

bool & libMesh::TriangulatorInterface::insert_extra_points ( )
inline

Sets and/or gets the flag for inserting add'l points.

Definition at line 210 of file triangulator_interface.h.

210{return _insert_extra_points;}

References _insert_extra_points.

◆ minimum_angle()

Real & libMesh::TriangulatorInterface::minimum_angle ( )
inline

Sets and/or gets the minimum desired angle.

Set to zero to disable angle constraint.

Definition at line 200 of file triangulator_interface.h.

200{return _minimum_angle;}

References _minimum_angle.

Referenced by MeshTriangulationTest::commonSettings(), libMesh::Poly2TriTriangulator::insert_refinement_points(), and main().

◆ nodes_to_segments()

void libMesh::TriangulatorInterface::nodes_to_segments ( dof_id_type  max_node_id)
protected

Helper function to create PSLG segments from our node ordering, up to the maximum node id, if no segments already exist.

Definition at line 249 of file triangulator_interface.C.

250{
251 // Don't try to override manually specified segments, or try to add
252 // segments if we're doing a convex hull
253 if (!this->segments.empty() || _triangulation_type != PSLG)
254 return;
255
256 for (auto node_it = _mesh.nodes_begin(),
257 node_end = _mesh.nodes_end();
258 node_it != node_end;)
259 {
260 Node * node = *node_it;
261
262 // If we're out of boundary nodes, the rest are going to be
263 // Steiner points or hole points
264 if (node->id() >= max_node_id)
265 break;
266
267 ++node_it;
268
269 Node * next_node = (node_it == node_end) ?
270 *_mesh.nodes_begin() : *node_it;
271
272 this->segments.emplace_back(node->id(), next_node->id());
273 }
274
275 if (this->_verify_hole_boundaries && _holes)
276 {
277 std::vector<Point> outer_pts;
278 for (auto segment : this->segments)
279 outer_pts.push_back(_mesh.point(segment.first));
280
281 ArbitraryHole ah(outer_pts);
282 this->verify_holes(ah);
283 }
284}

References _holes, _mesh, _triangulation_type, _verify_hole_boundaries, libMesh::DofObject::id(), libMesh::MeshBase::point(), PSLG, segments, and verify_holes().

Referenced by libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ quiet()

bool & libMesh::TriangulatorInterface::quiet ( )
inline

Whether not to silence internal messages to stdout.

Definition at line 249 of file triangulator_interface.h.

249{return _quiet;}

References _quiet.

◆ refine_boundary_allowed()

virtual bool libMesh::TriangulatorInterface::refine_boundary_allowed ( ) const
inlinevirtual

Get whether or not the triangulation is allowed to refine the mesh boundary when refining the interior.

True by default.

Reimplemented in libMesh::Poly2TriTriangulator.

Definition at line 237 of file triangulator_interface.h.

238 { return true; }

◆ set_auto_area_function()

void libMesh::TriangulatorInterface::set_auto_area_function ( const Parallel::Communicator &  comm,
const unsigned int  num_nearest_pts,
const unsigned int  power,
const Real  background_value,
const Real  background_eff_dist 
)

Generate an auto area function based on spacing of boundary points.

The external boundary as well as the hole boundaries are taken into consideration to generate the auto area function based on inverse distance interpolation. For each EDGE element on these boundaries, its centroid (midpoint) is used as the point position and the desired area is calculated as 1.5 times of the area of the equilateral triangle with the edge length as the length of the EDGE element. For a given position, the inverse distance interpolation only considers a number of nearest points (set by num_nearest_pts) to calculate the desired area. The weight of the value at each point is calculated as 1/distance^power.

In addition to these conventional inverse distance interpolation features, a concept of "background value" and "background effective distance" is introduced. The background value belongs to a virtual point located at a constant distance (background effective distance) from the given position. The weight of the value at this virtual point is calculated as 1/background_effective_distance^power. Effectively, the background value is the value when the given position is far away from the boundary points.

Definition at line 613 of file triangulator_interface.C.

618{
619 _auto_area_function = std::make_unique<AutoAreaFunction>(comm, num_nearest_pts, power, background_value, background_eff_dist);
620}

◆ set_desired_area_function()

virtual void libMesh::TriangulatorInterface::set_desired_area_function ( FunctionBase< Real > *  )
inlinevirtual

Set a function giving desired triangle area as a function of position.

Set this to nullptr to disable position-dependent area constraint (falling back on desired_area()).

This may not be implemented in all subclasses.

Reimplemented in libMesh::Poly2TriTriangulator.

Definition at line 186 of file triangulator_interface.h.

187 { libmesh_not_implemented(); }

◆ set_fixup_tri7_center_nodes()

void libMesh::TriangulatorInterface::set_fixup_tri7_center_nodes ( bool  v)
inline

For TRI7 elements, after boundary mid-edge nodes have been snapped to a curved boundary in increase_triangle_order(), the interior node can be repositioned to the curved-mapping image of the reference centroid.

This is off by default; enable it only if the consuming code wants the relocated interior node.

Definition at line 273 of file triangulator_interface.h.

References _fixup_tri7_center_nodes.

Referenced by MeshTriangulationTest::testPoly2TriEdge3ToTri7CenterFixup().

◆ set_interpolate_boundary_points()

void libMesh::TriangulatorInterface::set_interpolate_boundary_points ( int  n_points)

Complicated setter, for compatibility with insert_extra_points()

Definition at line 130 of file triangulator_interface.C.

131{
132 // Maybe we'll reserve a meaning for negatives later?
133 libmesh_assert(n_points >= 0);
134
136
137 // backwards compatibility - someone (including us) might want to
138 // query this via the old API.
139 _insert_extra_points = n_points;
140}

References _insert_extra_points, _interpolate_boundary_points, and libMesh::libmesh_assert().

Referenced by MeshTriangulationTest::testTriangulatorInterp().

◆ set_outer_boundary_ids()

void libMesh::TriangulatorInterface::set_outer_boundary_ids ( std::set< std::size_t >  bdy_ids)
inline

A set of ids to allow on the outer boundary loop: interpreted as boundary ids of 2D elements and/or subdomain ids of 1D edges.

If this is empty, then the outer boundary may be constructed from boundary edges of any id!

Definition at line 370 of file triangulator_interface.h.

370{ _bdy_ids = std::move(bdy_ids); }

References _bdy_ids.

Referenced by MeshTriangulationTest::testHalfDomain().

◆ set_refine_boundary_allowed()

virtual void libMesh::TriangulatorInterface::set_refine_boundary_allowed ( bool  )
inlinevirtual

Set whether or not the triangulation is allowed to refine the mesh boundary when refining the interior.

This is true by default, but may be set to false to make the mesh boundary more predictable (and so easier to stitch to other meshes) later.

This may not be implemented in all subclasses.

Reimplemented in libMesh::Poly2TriTriangulator.

Definition at line 230 of file triangulator_interface.h.

231 { libmesh_not_implemented(); }

◆ set_verify_hole_boundaries()

void libMesh::TriangulatorInterface::set_verify_hole_boundaries ( bool  v)
inline

Verifying that hole boundaries don't cross the outer boundary or each other is something like O(N_bdys^2*N_points_per_bdy^2), so we only do it if requested.

Definition at line 262 of file triangulator_interface.h.

References _verify_hole_boundaries.

Referenced by MeshTriangulationTest::commonSettings().

◆ smooth_after_generating()

bool & libMesh::TriangulatorInterface::smooth_after_generating ( )
inline

Sets/gets flag which tells whether to do two steps of Laplace mesh smoothing after generating the grid.

Definition at line 244 of file triangulator_interface.h.

References _smooth_after_generating.

Referenced by MeshTriangulationTest::commonSettings(), and triangulate_domain().

◆ total_hole_points()

unsigned int libMesh::TriangulatorInterface::total_hole_points ( )
protected

Helper function to count points in and verify holes.

Definition at line 589 of file triangulator_interface.C.

590{
591 // If the holes vector is non-nullptr (and non-empty) we need to determine
592 // the number of additional points which the holes will add to the
593 // triangulation.
594 // Note that the number of points is always equal to the number of segments
595 // that form the holes.
596 unsigned int n_hole_points = 0;
597
598 if (_holes)
599 for (const auto & hole : *_holes)
600 {
601 n_hole_points += hole->n_points();
602 // A hole at least has one enclosure.
603 // Points on enclosures are ordered so that we can add segments implicitly.
604 // Elements in segment_indices() indicates the starting points of all enclosures.
605 // The last element in segment_indices() is the number of total points.
606 libmesh_assert_greater(hole->segment_indices().size(), 1);
607 libmesh_assert_equal_to(hole->segment_indices().back(), hole->n_points());
608 }
609
610 return n_hole_points;
611}

Referenced by libMesh::TriangleInterface::triangulate().

◆ triangulate()

virtual void libMesh::TriangulatorInterface::triangulate ( )
pure virtual

◆ triangulation_type()

TriangulationType & libMesh::TriangulatorInterface::triangulation_type ( )
inline

Sets and/or gets the desired triangulation type.

Definition at line 205 of file triangulator_interface.h.

205{return _triangulation_type;}

References _triangulation_type.

Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), MeshTriangulationTest::commonSettings(), main(), and triangulate_domain().

◆ verify_holes()

void libMesh::TriangulatorInterface::verify_holes ( const Hole &  outer_bdy)
protected

Helper function to check holes for intersections if requested.

Definition at line 564 of file triangulator_interface.C.

565{
566 for (const Hole * hole : *_holes)
567 {
568 for (const Hole * hole2 : *_holes)
569 {
570 if (hole == hole2)
571 continue;
572
573 for (auto i : make_range(hole2->n_points()))
574 if (hole->contains(hole2->point(i)))
575 libmesh_error_msg
576 ("Found point " << hole2->point(i) <<
577 " on one hole boundary and another's interior");
578 }
579
580 for (auto i : make_range(hole->n_points()))
581 if (!outer_bdy.contains(hole->point(i)))
582 libmesh_error_msg
583 ("Found point " << hole->point(i) <<
584 " on hole boundary but outside outer boundary");
585 }
586}

References libMesh::TriangulatorInterface::Hole::contains(), and libMesh::make_range().

Referenced by elems_to_segments(), and nodes_to_segments().

◆ verify_quadratic_elements()

void libMesh::TriangulatorInterface::verify_quadratic_elements ( )
protected

Helper called at the end of increase_triangle_order() to verify that no boundary-midpoint snap has tangled a quadratic triangle, by sampling the signed element Jacobian at the reference nodes and centroid.

Errors out with a diagnostic naming the bad element and side if the Jacobian is non-positive.

Definition at line 477 of file triangulator_interface.C.

478{
479 if (_elem_type != TRI6 && _elem_type != TRI7)
480 return;
481
482 // Once fixup_tri7_center_nodes() has placed node 6, the TRI6 and TRI7
483 // mappings coincide and this Tri6 formula serves both.
484 static const Real xi_samples[7] = {Real(0), Real(1), Real(0),
485 Real(1)/2, Real(1)/2, Real(0),
486 Real(1)/3};
487 static const Real eta_samples[7] = {Real(0), Real(0), Real(1),
488 Real(0), Real(1)/2, Real(1)/2,
489 Real(1)/3};
490
491 for (Elem * elem : _mesh.element_ptr_range())
492 {
493 libmesh_assert_equal_to(elem->n_vertices(), 3);
494 libmesh_assert_greater_equal(elem->n_nodes(), 6u);
495
496 const Point & x0 = elem->point(0);
497 const Point & x1 = elem->point(1);
498 const Point & x2 = elem->point(2);
499 const Point & x3 = elem->point(3);
500 const Point & x4 = elem->point(4);
501 const Point & x5 = elem->point(5);
502
503 // Tri6 mapping derivative coefficients (see Tri6::volume()):
504 // dx/dxi = xi*a1 + eta*b1 + c1, dx/deta = xi*b1 + eta*b2 + c2.
505 const Point a1 = 4*x0 + 4*x1 - 8*x3;
506 const Point b1 = 4*x0 - 4*x3 + 4*x4 - 4*x5;
507 const Point c1 = -3*x0 - 1*x1 + 4*x3;
508 const Point b2 = 4*x0 + 4*x2 - 8*x5;
509 const Point c2 = -3*x0 - 1*x2 + 4*x5;
510
511 // Scale the tolerance by the straight-edge triangle area, which
512 // is strictly positive for the valid TRI3 poly2tri input.
513 const Real ref_area = 0.5 * cross_norm(x1 - x0, x2 - x0);
514 const Real jac_tol = TOLERANCE * ref_area;
515
516 Real min_jac = std::numeric_limits<Real>::max();
517 unsigned int worst_sample = 0;
518 for (unsigned int s = 0; s != 7; ++s)
519 {
520 const Real xi = xi_samples[s];
521 const Real eta = eta_samples[s];
522 const Point dxi = xi*a1 + eta*b1 + c1;
523 const Point deta = xi*b1 + eta*b2 + c2;
524 // z-component of the cross product; the elements are planar.
525 const Real jac = dxi(0)*deta(1) - dxi(1)*deta(0);
526 if (jac < min_jac)
527 {
528 min_jac = jac;
529 worst_sample = s;
530 }
531 }
532
533 if (min_jac > jac_tol)
534 continue;
535
536 // Build a diagnostic naming every snapped boundary side on this
537 // element so the user can immediately see which curved-boundary
538 // input caused the tangle.
539 std::ostringstream sides;
540 for (unsigned int n = 0; n != 3; ++n)
541 if (!elem->neighbor_ptr(n))
542 {
543 const Point straight =
544 0.5 * (elem->point(n) + elem->point((n+1) % 3));
545 sides << " (boundary side " << n
546 << ": straight midpoint " << straight
547 << ", snapped midpoint " << elem->point(n+3) << ")";
548 }
549
550 libmesh_error_msg(
551 "TriangulatorInterface: snapping a boundary midpoint produced a "
552 "tangled quadratic triangle (element " << elem->id()
553 << ", non-positive Jacobian " << min_jac
554 << " at reference sample (" << xi_samples[worst_sample] << ", "
555 << eta_samples[worst_sample] << "); reference triangle area "
556 << ref_area << ")." << sides.str()
557 << " Refine the boundary discretization so that recorded "
558 "midpoints lie closer to their straight-line midpoints, "
559 "then retry.");
560 }
561}
LIBMESH_DEVICE_INLINE T cross_norm(const TypeVector< T > &b, const TypeVector< T > &c)
Calls cross_norm_sq() and takes the square root of the result.
static constexpr Real TOLERANCE

References libMesh::cross_norm(), libMesh::Real, libMesh::TRI6, and libMesh::TRI7.

Member Data Documentation

◆ _auto_area_function

std::unique_ptr<AutoAreaFunction> libMesh::TriangulatorInterface::_auto_area_function
protected

The auto area function based on the spacing of boundary points.

Definition at line 518 of file triangulator_interface.h.

Referenced by has_auto_area_function().

◆ _bdy_ids

std::set<std::size_t> libMesh::TriangulatorInterface::_bdy_ids
protected

A set of ids to allow on the outer boundary loop.

Definition at line 452 of file triangulator_interface.h.

Referenced by elems_to_segments(), get_outer_boundary_ids(), and set_outer_boundary_ids().

◆ _desired_area

Real libMesh::TriangulatorInterface::_desired_area
protected

The desired area for the elements in the resulting mesh.

Definition at line 463 of file triangulator_interface.h.

Referenced by desired_area(), and libMesh::TriangleInterface::triangulate().

◆ _elem_type

ElemType libMesh::TriangulatorInterface::_elem_type
protected

The type of elements to generate.

(Defaults to TRI3).

Definition at line 458 of file triangulator_interface.h.

Referenced by elem_type(), increase_triangle_order(), libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ _fixup_tri7_center_nodes

bool libMesh::TriangulatorInterface::_fixup_tri7_center_nodes
protected

Flag which tells if we want to relocate TRI7 interior nodes to the curved-mapping centroid after snapping boundary midpoints.

Definition at line 513 of file triangulator_interface.h.

Referenced by get_fixup_tri7_center_nodes(), and set_fixup_tri7_center_nodes().

◆ _holes

const std::vector<Hole*>* libMesh::TriangulatorInterface::_holes
protected

◆ _insert_extra_points

bool libMesh::TriangulatorInterface::_insert_extra_points
protected

Flag which tells whether or not to insert additional nodes before triangulation.

This can sometimes be used to "de-regularize" the resulting triangulation.

This flag is supported for backwards compatibility; setting _interpolate_boundary_points = 1 is equivalent.

Definition at line 485 of file triangulator_interface.h.

Referenced by get_interpolate_boundary_points(), insert_extra_points(), and set_interpolate_boundary_points().

◆ _interpolate_boundary_points

int libMesh::TriangulatorInterface::_interpolate_boundary_points
protected

Flag which tells how many additional nodes should be inserted between each pair of original mesh points.

Definition at line 491 of file triangulator_interface.h.

Referenced by get_interpolate_boundary_points(), and set_interpolate_boundary_points().

◆ _markers

const std::vector<int>* libMesh::TriangulatorInterface::_markers
protected

◆ _mesh

UnstructuredMesh& libMesh::TriangulatorInterface::_mesh
protected

◆ _minimum_angle

Real libMesh::TriangulatorInterface::_minimum_angle
protected

Minimum angle in triangles.

Definition at line 468 of file triangulator_interface.h.

Referenced by minimum_angle(), and libMesh::TriangleInterface::triangulate().

◆ _quiet

bool libMesh::TriangulatorInterface::_quiet
protected

Flag which tells if we want to suppress stdout outputs.

Definition at line 502 of file triangulator_interface.h.

Referenced by quiet(), and libMesh::TriangleInterface::triangulate().

◆ _regions

const std::vector<Region*>* libMesh::TriangulatorInterface::_regions
protected

A pointer to a vector of Regions*s.

If this is nullptr, there are no regions!

Definition at line 447 of file triangulator_interface.h.

Referenced by attach_region_list(), libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ _smooth_after_generating

bool libMesh::TriangulatorInterface::_smooth_after_generating
protected

Flag which tells whether we should smooth the mesh after it is generated.

True by default.

Definition at line 497 of file triangulator_interface.h.

Referenced by smooth_after_generating(), libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

◆ _triangulation_type

TriangulationType libMesh::TriangulatorInterface::_triangulation_type
protected

The type of triangulation to perform: choices are: convex hull PSLG.

Definition at line 475 of file triangulator_interface.h.

Referenced by insert_any_extra_boundary_points(), nodes_to_segments(), libMesh::TriangleInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate(), and triangulation_type().

◆ _verify_hole_boundaries

bool libMesh::TriangulatorInterface::_verify_hole_boundaries
protected

Flag which tells if we want to check hole geometry.

Definition at line 507 of file triangulator_interface.h.

Referenced by elems_to_segments(), get_verify_hole_boundaries(), nodes_to_segments(), and set_verify_hole_boundaries().

◆ segment_midpoints

std::vector<Point> libMesh::TriangulatorInterface::segment_midpoints

When constructing a second-order triangulation from a second-order boundary, we may do the triangulation using first-order elements, in which case we need to save midpoint location data in order to reconstruct curvature along boundaries.

Definition at line 298 of file triangulator_interface.h.

Referenced by elems_to_segments(), and increase_triangle_order().

◆ segment_midpoints_keys

std::vector<Point> libMesh::TriangulatorInterface::segment_midpoints_keys

When saving the midpoint location data, we need to save the corresponding segment information too.

Here the first point of the segment is saved so that it can be used as a key to find the corresponding segment midpoint.

Definition at line 306 of file triangulator_interface.h.

Referenced by elems_to_segments(), and increase_triangle_order().

◆ segments

std::vector<std::pair<unsigned int, unsigned int> > libMesh::TriangulatorInterface::segments

When constructing a PSLG, if the node numbers do not define the desired boundary segments 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 the above case you could actually use the implicit ordering!)

Definition at line 290 of file triangulator_interface.h.

Referenced by elems_to_segments(), increase_triangle_order(), insert_any_extra_boundary_points(), libMesh::Poly2TriTriangulator::insert_refinement_points(), nodes_to_segments(), MeshTriangulationTest::testTriangulatorSegments(), libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate_current_points().


The documentation for this class was generated from the following files: