19#include "libmesh/libmesh_config.h"
21#ifdef LIBMESH_HAVE_POLY2TRI
25#include "libmesh/enforce_ieee754.h"
28#include "libmesh/poly2tri_triangulator.h"
30#include "libmesh/boundary_info.h"
31#include "libmesh/elem.h"
32#include "libmesh/enum_elem_type.h"
33#include "libmesh/function_base.h"
34#include "libmesh/hashing.h"
35#include "libmesh/libmesh_logging.h"
36#include "libmesh/mesh_serializer.h"
37#include "libmesh/mesh_smoother_laplace.h"
38#include "libmesh/mesh_triangle_holes.h"
39#include "libmesh/unstructured_mesh.h"
40#include "libmesh/utility.h"
43#include "libmesh/ignore_warnings.h"
44#include "poly2tri/poly2tri.h"
45#include "libmesh/restore_warnings.h"
54 bool operator()(
const p2t::Point & a,
const p2t::Point &
b)
const
56 return a.x <
b.x || (a.x ==
b.x && a.y <
b.y);
65 "Poly2TriTriangulator only supports point sets in the XY plane");
68 return {double(p(0)), double(p(1))};
76bool in_circumcircle(
const Elem & elem,
102std::pair<bool, unsigned short>
103can_delaunay_swap(
const Elem & elem,
111 unsigned short nn = 0;
117 if (neigh_node == elem.
node_ptr(0) ||
124 if (in_circumcircle(elem, *neigh_node, tol))
131 const unsigned short n = (side+2)%3;
142 if (mid*right < left*right ||
143 left*mid < left*right)
150[[maybe_unused]]
void libmesh_assert_locally_delaunay(
const Elem & elem)
162template <
typename Container>
164void libmesh_assert_delaunay(
MeshBase & libmesh_dbg_var(
mesh),
165 Container & new_elems)
169 LOG_SCOPE(
"libmesh_assert_delaunay()",
"Poly2TriTriangulator");
171 for (
auto & elem :
mesh.element_ptr_range())
172 libmesh_assert_locally_delaunay(*elem);
174 for (
auto & [raw_elem, unique_elem] : new_elems)
177 libmesh_assert_locally_delaunay(*raw_elem);
186template <
typename Container>
188void restore_delaunay(Container & check_delaunay_on,
191 LOG_SCOPE(
"restore_delaunay()",
"Poly2TriTriangulator");
193 while (!check_delaunay_on.empty())
195 Elem & elem = **check_delaunay_on.begin();
196 check_delaunay_on.erase(&elem);
202 auto [can_swap, nn] =
210 const unsigned short n = (s+2)%3;
212 const std::array<Node *,4> nodes {elem.
node_ptr(n),
232 std::vector<boundary_id_type> bcids;
237 boundary_info.
add_side(neigh, (nn+1)%3, bcids);
244 boundary_info.
add_side(&elem, (n+1)%3, bcids);
248 neigh->
set_node((nn+2)%3, nodes[0]);
276 "Poly2TriTriangulator would swap the diagonal shared by two "
277 "triangles back and forth forever");
287unsigned int segment_intersection(
const Elem & elem,
289 const Point & target,
290 unsigned int source_side)
292 libmesh_assert_equal_to(elem.
dim(), 2);
294 const auto ns = elem.
n_sides();
299 if (s == source_side)
307 const Real raydx = target(0)-source(0),
308 raydy = target(1)-source(1),
309 edgedx = v1(0)-v0(0),
310 edgedy = v1(1)-v0(1);
311 const Real denom = edgedx * raydy - edgedy * raydx;
317 const Real one_over_denom = 1 / denom;
319 const Real targetsdx = v1(0)-target(0),
320 targetsdy = v1(1)-target(1);
322 const Real t_num = targetsdx * raydy -
324 const Real t = t_num * one_over_denom;
329 const Real u_num = targetsdx * edgedy - targetsdy * edgedx;
330 const Real u = u_num * one_over_denom;
343 const Real ray_fraction = (1-u);
345 source(0) += raydx * ray_fraction;
346 source(1) += raydy * ray_fraction;
365 _n_boundary_nodes(n_boundary_nodes),
366 _refine_bdy_allowed(true)
377 LOG_SCOPE(
"triangulate()",
"Poly2TriTriangulator");
391 libmesh_not_implemented();
395 libmesh_not_implemented();
402 libmesh_not_implemented();
433 libmesh_not_implemented();
478 std::vector<boundary_id_type> bcids;
482 libmesh_assert_equal_to(bcids.size(), 1);
492 libmesh_assert_less(hole_num, this->
_holes->size());
493 const Hole * hole = (*this->
_holes)[hole_num];
500 LOG_SCOPE(
"triangulate_current_points()",
"Poly2TriTriangulator");
503 const std::size_t n_holes =
_holes !=
nullptr ?
_holes->size() : 0;
507 std::map<const p2t::Point, Node *, P2TPointCompare> point_node_map;
513 std::vector<p2t::Point> outer_boundary_points;
514 std::vector<std::vector<p2t::Point>> inner_hole_points(n_holes);
518 (!nn,
"Poly2TriTriangulator cannot triangulate an empty mesh!");
525 "Poly2TriTriangulator needs contiguous node ids or explicit segments!");
531 std::set<p2t::Point, P2TPointCompare> steiner_points;
539 std::distance(
_mesh.nodes_begin(),
554 for (
auto & node :
_mesh.node_ptr_range())
556 const p2t::Point pt = to_p2t(*node);
561 outer_boundary_points.push_back(pt);
563 steiner_points.insert(pt);
566 if (point_node_map.count(pt))
567 libmesh_not_implemented();
569 point_node_map.emplace(pt, node);
580 for (
auto [segment_start, segment_end] : this->
segments)
583 libmesh_error_msg_if(segment_start != last_id,
584 "Disconnected triangulator segments");
585 last_id = segment_end;
589 libmesh_error_msg_if(!node,
590 "Triangulator segments reference nonexistent node id " <<
593 outer_boundary_points.emplace_back(
double((*node)(0)),
double((*node)(1)));
594 p2t::Point * pt = &outer_boundary_points.back();
597 if (point_node_map.count(*pt))
598 libmesh_not_implemented_msg
599 (
"Triangulating overlapping boundary nodes is unsupported");
601 point_node_map.emplace(*pt, node);
604 libmesh_error_msg_if(last_id != this->
segments[0].first,
605 "Non-closed-loop triangulator segments");
609 for (
auto & node :
_mesh.node_ptr_range())
611 const p2t::Point pt = to_p2t(*node);
612 if (
const auto it = point_node_map.find(pt);
613 it == point_node_map.end())
615 steiner_points.insert(pt);
616 point_node_map.emplace(pt, node);
619 libmesh_assert_equal_to(it->second, node);
633 std::unordered_map<std::pair<dof_id_type,dof_id_type>,
637 const std::size_t n_outer = outer_boundary_points.size();
642 libmesh_map_find(point_node_map, outer_boundary_points[i]),
644 libmesh_map_find(point_node_map, outer_boundary_points[(i+1)%n_outer]);
646 side_boundary_id.emplace(std::make_pair(node1->
id(),
652 std::vector<p2t::Point *> outer_boundary_pointers(n_outer);
653 std::transform(outer_boundary_points.begin(),
654 outer_boundary_points.end(),
655 outer_boundary_pointers.begin(),
656 [](p2t::Point & p) { return &p; });
663 std::vector<std::vector<p2t::Point *>> inner_hole_pointers(n_holes);
665 p2t::CDT cdt{outer_boundary_pointers};
670 const Hole * initial_hole = (*_holes)[h];
672 const Hole & our_hole =
674 *initial_hole : *it->second;
675 auto & poly2tri_hole = inner_hole_points[h];
680 poly2tri_hole.emplace_back(to_p2t(p));
682 const auto & pt = poly2tri_hole.back();
685 steiner_points.erase(pt);
691 if (point_node_map.count(pt))
693 libmesh_assert_equal_to
700 point_node_map[pt] = node;
705 const std::size_t n_inner = poly2tri_hole.size();
710 libmesh_map_find(point_node_map, poly2tri_hole[i]),
712 libmesh_map_find(point_node_map, poly2tri_hole[(i+1)%n_inner]);
714 side_boundary_id.emplace(std::make_pair(node1->
id(),
719 auto & poly2tri_ptrs = inner_hole_pointers[h];
720 poly2tri_ptrs.resize(n_inner);
722 std::transform(poly2tri_hole.begin(),
724 poly2tri_ptrs.begin(),
725 [](p2t::Point & p) { return &p; });
727 cdt.AddHole(poly2tri_ptrs);
735 std::vector<p2t::Point> steiner_vector(steiner_points.begin(), steiner_points.end());
736 steiner_points.clear();
737 for (
auto & p : steiner_vector)
744 std::vector<p2t::Triangle *> triangles = cdt.GetTriangles();
750 boundary_info.
clear();
753 for (
auto ptri_ptr : triangles)
755 p2t::Triangle & ptri = *ptri_ptr;
762 const p2t::Point & vertex = *ptri.GetPoint(v);
764 Node * node = libmesh_map_find(point_node_map, vertex);
777 & node2 = added_elem->
node_ref((v+1)%3);
779 auto it = side_boundary_id.find(std::make_pair(node1.
id(), node2.id()));
780 if (it == side_boundary_id.end())
781 it = side_boundary_id.find(std::make_pair(node2.id(), node1.
id()));
782 if (it != side_boundary_id.end())
783 boundary_info.
add_side(added_elem, v, it->second);
792 LOG_SCOPE(
"insert_refinement_points()",
"Poly2TriTriangulator");
795 libmesh_not_implemented();
821 bool operator()(
Elem * a,
Elem *
b)
const {
823 return (a->
id() <
b->id());
827 std::map<Elem *, std::unique_ptr<Elem>,
decltype(comp)> new_elems(comp);
839 std::set<
Elem *,
decltype(comp)> all_elems
840 {
mesh.elements_begin(),
mesh.elements_end(), comp };
842 restore_delaunay(all_elems, boundary_info);
844 libmesh_assert_delaunay(
mesh, new_elems);
857 std::unordered_map<Point, Node *> next_boundary_node;
867 std::unordered_set<Point> mesh_points;
868 for (
const Node * node :
mesh.node_ptr_range())
871 mesh_points.insert(*node);
875 auto add_point = [&
mesh,
879 &nn](
const Point & p)
883 mesh_points.insert(p);
888 for (
auto & elem :
mesh.element_ptr_range())
895 libmesh_assert_equal_to(elem->
level(), 0u);
896 libmesh_assert_equal_to(elem->
type(),
TRI3);
907 Node * new_node =
nullptr;
912 Elem * cavity_elem = elem;
915 auto boundary_refine = [
this, &next_boundary_node,
916 &cavity_elem, &new_node]
924 * old_segment_end = cavity_elem->
node_ptr((side+1)%3);
930 if (
auto it = next_boundary_node.find(*old_segment_start);
931 it != next_boundary_node.end())
934 it->second = new_node;
942 (old_segment_end->id() ==
943 old_segment_start->
id() + 1));
944 next_boundary_node[*old_segment_start] = new_node;
947 next_boundary_node[*new_node] = old_segment_end;
961 side = segment_intersection(*cavity_elem, ray_start, new_pt, source_side);
975 new_node = add_point(new_pt);
976 boundary_refine(side);
996 new_node = add_point(new_pt);
1007 cavity_elem = neigh;
1024 Real ax = cavity_elem->
point(s)(0) - new_pt(0),
1025 ay = cavity_elem->
point(s)(1) - new_pt(1),
1026 bx = cavity_elem->
point((s+1)%3)(0) - new_pt(0),
1027 by = cavity_elem->
point((s+1)%3)(1) - new_pt(1);
1028 const Real my_cos = (ax*bx+ay*by) /
1029 std::sqrt(ax*ax+ay*ay) /
1030 std::sqrt(bx*bx+by*by);
1032 if (my_cos < worst_cos)
1041 if (worst_cos < -0.6)
1050 new_pt = (cavity_elem->
point(side) +
1051 cavity_elem->
point((side+1)%3)) / 2;
1052 new_node = add_point(new_pt);
1053 boundary_refine(side);
1058 new_node = add_point(new_pt);
1066 new_node = add_point(new_pt);
1072 std::set<
Elem *,
decltype(comp)> cavity(comp);
1074 std::set<
Elem *,
decltype(comp)> unchecked_cavity ({cavity_elem}, comp);
1075 while (!unchecked_cavity.empty())
1077 std::set<
Elem *,
decltype(comp)> checking_cavity(comp);
1078 checking_cavity.swap(unchecked_cavity);
1079 for (
Elem * checking_elem : checking_cavity)
1084 if (!neigh || checking_cavity.count(neigh) || cavity.count(neigh))
1088 unchecked_cavity.insert(neigh);
1100 std::set<
Elem *,
decltype(comp)> check_delaunay_on(comp);
1104 std::unordered_map<Node *, std::pair<Elem *, boundary_id_type>>
1105 neighbors_CCW, neighbors_CW;
1107 for (
Elem * old_elem : cavity)
1112 if (!neigh || !cavity.count(neigh))
1114 Node * node_CW = old_elem->node_ptr(s),
1115 * node_CCW = old_elem->node_ptr((s+1)%3);
1117 auto set_neighbors =
1118 [&neighbors_CW, &neighbors_CCW, &node_CW,
1119 &node_CCW, &boundary_info]
1123 if (
const auto CW_it = neighbors_CW.find(node_CW);
1124 CW_it == neighbors_CW.end())
1127 neighbors_CCW[node_CW] = std::make_pair(new_neigh, bcid);
1131 Elem * neigh_CW = CW_it->second.first;
1137 boundary_info.
add_side(new_neigh, 0, bcid_CW);
1144 boundary_info.
add_side(neigh_CW, 2, bcid);
1146 neighbors_CW.erase(CW_it);
1150 if (
const auto CCW_it = neighbors_CCW.find(node_CCW);
1151 CCW_it == neighbors_CCW.end())
1154 neighbors_CW[node_CCW] = std::make_pair(new_neigh, bcid);
1158 Elem * neigh_CCW = CCW_it->second.first;
1164 boundary_info.
add_side(new_neigh, 2, bcid_CCW);
1170 boundary_info.
add_side(neigh_CCW, 0, bcid);
1172 neighbors_CCW.erase(CCW_it);
1179 if (old_elem == cavity_elem &&
1182 std::vector<boundary_id_type> bcids;
1184 libmesh_assert_equal_to(bcids.size(), 1);
1185 set_neighbors(
nullptr, bcids[0]);
1190 new_elem->set_node(0, new_node);
1191 new_elem->set_node(1, node_CW);
1192 new_elem->set_node(2, node_CCW);
1196 new_elem->set_neighbor(1, neigh);
1199 const unsigned int neigh_s =
1205 std::vector<boundary_id_type> bcids;
1207 boundary_info.
add_side(new_elem.get(), 1, bcids);
1215 Elem * new_elem_ptr = new_elem.get();
1216 new_elems.emplace(new_elem_ptr, std::move(new_elem));
1218 check_delaunay_on.insert(new_elem_ptr);
1222 boundary_info.
remove(old_elem);
1228 for (
Elem * old_elem : cavity)
1230 if (
const auto it = new_elems.find(old_elem);
1231 it == new_elems.end())
1234 new_elems.erase(it);
1245 restore_delaunay(check_delaunay_on, boundary_info);
1249 libmesh_assert_delaunay(
mesh, new_elems);
1256 if (!next_boundary_node.empty())
1258 auto checked_emplace = [
this](
dof_id_type new_first,
1262 for (
auto [first, second] : this->
segments)
1264 libmesh_assert_not_equal_to(first, new_first);
1265 libmesh_assert_not_equal_to(second, new_second);
1268 libmesh_assert_equal_to(this->
segments.back().second, new_first);
1270 libmesh_assert_not_equal_to(new_first, new_second);
1272 this->
segments.emplace_back (new_first, new_second);
1281 for (
auto node_it =
_mesh.nodes_begin(),
1282 node_end =
_mesh.nodes_end();
1283 node_it != node_end;)
1285 Node & node = **node_it;
1297 last_id = this->
segments.back().second;
1301 checked_emplace(last_id, node_id);
1306 Node * this_node = &node;
1307 auto it = next_boundary_node.find(*this_node);
1308 while (it != next_boundary_node.end())
1311 Node * next_node = it->second;
1314 if (node_it != node_end &&
1315 next_node == *node_it)
1318 checked_emplace(this_node->
id(), next_node->
id());
1320 this_node = next_node;
1321 if (this_node->
id() == this->segments.front().first)
1324 it = next_boundary_node.find(*this_node);
1329 if (this->
segments.back().second != this->segments.front().first)
1330 checked_emplace(this->
segments.back().second,
1331 this->segments.front().first);
1335 std::vector<std::pair<unsigned int, unsigned int>> old_segments;
1338 auto old_it = old_segments.begin();
1341 const Node *
const first_node = node;
1346 if (
const auto it = next_boundary_node.find(*node);
1347 it == next_boundary_node.end())
1349 while (node_id != old_it->first)
1361 checked_emplace(node_id, node->
id());
1363 while (node != first_node);
1375 bool hole_point_insertion =
false;
1377 if (next_boundary_node.count(hole->point(p)))
1379 hole_point_insertion =
true;
1382 if (hole_point_insertion)
1384 (hole, std::make_unique<ArbitraryHole>(*hole));
1399 bool point_inserted =
false;
1401 if (next_boundary_node.count(point))
1403 point_inserted =
true;
1407 if (!point_inserted)
1411 std::vector<Point> new_points;
1427 auto push_back_new_point = [&new_points](
const Point & p) {
1430 new_points.back() != p);
1433 for (
auto old_p : new_points)
1434 libmesh_assert_not_equal_to(old_p, p);
1436 new_points.push_back(p);
1439 for (
auto point_it = arb.
get_points().rbegin(),
1441 point_it != point_end;)
1443 Point point = *point_it;
1446 if (new_points.empty() ||
1447 (point != new_points.back() &&
1448 point != new_points.front()))
1449 push_back_new_point(point);
1451 auto it = next_boundary_node.find(point);
1452 while (it != next_boundary_node.end())
1454 point = *it->second;
1455 if (point == new_points.front())
1457 if (point_it != point_end &&
1460 push_back_new_point(point);
1461 it = next_boundary_node.find(point);
1465 std::reverse(new_points.begin(), new_points.end());
1473 for (
auto & [raw_elem, unique_elem] : new_elems)
1475 libmesh_assert_equal_to(raw_elem, unique_elem.get());
1482 return !new_elems.empty();
1493 area_func !=
nullptr ||
1501 return (area > min_area_target);
1503 libmesh_warning(
"WARNING: both desired are function and automatic area function are set. Using automatic area function.");
1512 const Real local_area_target = (*area_func)(elem.
point(v));
1513 libmesh_error_msg_if
1514 (local_area_target <= 0,
1515 "Non-positive desired element areas are unachievable");
1516 if (area > local_area_target)
1522 if (!min_area_target)
1525 libmesh_not_implemented_msg
1526 (
"Combining a minimum desired_area with an area function isn't yet supported.");
1535#include "libmesh/restore_ieee754.h"
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
std::size_t n_boundary_ids() const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
void clear()
Clears the underlying data structures and restores the object to a pristine state with no data stored...
static const boundary_id_type invalid_id
Number used for internal use.
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure.
void remove_side(const Elem *elem, const unsigned short int side)
Removes all boundary conditions associated with side side of element elem, if any exist.
void remove(const Node *node)
Removes the boundary conditions associated with node node, if any exist.
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
This is the base class from which all geometric element types are derived.
virtual Node *& set_node(const unsigned int i)
virtual Point quasicircumcenter() const
virtual unsigned int n_vertices() const =0
const Point & point(const unsigned int i) const
const Node & node_ref(const unsigned int i) const
static std::unique_ptr< Elem > build_with_id(const ElemType type, dof_id_type id)
Calls the build() method above with a nullptr parent, and additionally sets the newly-created Elem's ...
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
unsigned int which_neighbor_am_i(const Elem *e) const
This function tells you which neighbor e is.
virtual bool is_flipped() const =0
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
virtual unsigned short dim() const =0
unsigned int level() const
const Node * node_ptr(const unsigned int i) const
virtual Real volume() const
virtual ElemType type() const =0
virtual unsigned int n_sides() const =0
const Elem * neighbor_ptr(unsigned int i) const
Point vertex_average() const
Base class for functors that can be evaluated at a point and (optionally) time.
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
This class defines the data structures necessary for Laplace smoothing.
virtual void smooth() override
Redefinition of the smooth function from the base class.
This is the MeshBase class.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual const Node * node_ptr(const dof_id_type i) const =0
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly created (or read) mesh for use.
virtual dof_id_type n_nodes() const =0
virtual void delete_elem(Elem *e)=0
Removes element e from the mesh.
virtual dof_id_type max_node_id() const =0
virtual const Node * query_node_ptr(const dof_id_type i) const =0
void set_mesh_dimension(unsigned char d)
Resets the logical dimension of the mesh.
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.
virtual dof_id_type max_elem_id() const =0
virtual void clear_elems()=0
Deletes all the element data that is currently stored.
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
Temporarily serialize a DistributedMesh for non-distributed-mesh capable code paths.
A Node is like a Point, but with more information.
const Parallel::Communicator & comm() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
virtual FunctionBase< Real > * get_desired_area_function() override
Get the function giving desired triangle area as a function of position, or nullptr if no such functi...
virtual void set_desired_area_function(FunctionBase< Real > *desired) override
Set a function giving desired triangle area as a function of position.
bool is_refine_boundary_allowed(const BoundaryInfo &boundary_info, const Elem &elem, unsigned int side)
Is refining this element's boundary side allowed?
std::map< const Hole *, std::unique_ptr< ArbitraryHole > > replaced_holes
We might have to replace the user-provided holes with refined versions.
std::unique_ptr< FunctionBase< Real > > _desired_area_func
Location-dependent area requirements.
virtual void triangulate() override
Internally, this calls the poly2tri triangulation code in a loop, inserting our owner Steiner points ...
virtual ~Poly2TriTriangulator()
Empty destructor.
Poly2TriTriangulator(UnstructuredMesh &mesh, dof_id_type n_boundary_nodes=DofObject::invalid_id)
The constructor.
bool should_refine_elem(Elem &elem)
Returns true if the given element ought to be refined according to current criteria.
virtual bool refine_boundary_allowed() const override
Get whether or not the triangulation is allowed to refine the mesh boundary when refining the interio...
bool insert_refinement_points()
Add Steiner points as new mesh nodes, as necessary to refine an existing trangulation.
void triangulate_current_points()
Triangulate the current mesh and hole points.
dof_id_type _n_boundary_nodes
Keep track of how many mesh nodes are boundary nodes.
Another concrete instantiation of the hole, this one should be sufficiently general for most non-poly...
const std::vector< Point > & get_points() const
void set_points(std::vector< Point > points)
An abstract class for defining a 2-dimensional hole.
virtual bool refine_boundary_allowed() const
Get whether or not the triangulation is allowed to refine the mesh boundary when refining the interio...
virtual Point point(const unsigned int n) const =0
Return the nth point defining the hole.
virtual unsigned int n_points() const =0
The number of geometric points which define the hole.
void increase_triangle_order()
Helper function to upconvert Tri3 to any higher order triangle type if requested via _elem_type.
ElemType _elem_type
The type of elements to generate.
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,...
void elems_to_segments()
Helper function to create PSLG segments from our other boundary-defining options (1D mesh edges,...
Real & minimum_angle()
Sets and/or gets the minimum desired angle.
bool _smooth_after_generating
Flag which tells whether we should smooth the mesh after it is generated.
void insert_any_extra_boundary_points()
Helper function to add extra points (midpoints of initial segments) to a PSLG triangulation.
@ PSLG
Triangulate the interior of a Planar Straight Line Graph, which is defined implicitly by the order of...
const std::vector< Hole * > * _holes
A pointer to a vector of Hole*s.
const std::vector< int > * _markers
Boundary markers.
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 ...
bool has_auto_area_function()
Whether or not an auto area function has been set.
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.
Real & desired_area()
Sets and/or gets the desired triangle area.
TriangulationType _triangulation_type
The type of triangulation to perform: choices are: convex hull PSLG.
FunctionBase< Real > * get_auto_area_function()
Get the auto area function.
The UnstructuredMesh class is derived from the MeshBase class.
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true, const bool check_non_remote=true) override
Other functions from MeshBase requiring re-definition.
The libMesh namespace provides an interface to certain functionality in the library.
void libmesh_ignore(const Args &...)
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
void libmesh_merge_move(T &target, T &source)
static constexpr Real TOLERANCE
TypeVector< T > circumcenter(const TypeVector< T > &p0, const TypeVector< T > &p1, const TypeVector< T > &p2)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...