1#include <libmesh/boundary_info.h>
2#include <libmesh/elem.h>
3#include <libmesh/mesh.h>
4#include <libmesh/mesh_generation.h>
5#include <libmesh/mesh_modification.h>
6#include <libmesh/mesh_triangle_holes.h>
7#include <libmesh/mesh_triangle_interface.h>
8#include <libmesh/parallel_implementation.h>
9#include <libmesh/parsed_function.h>
10#include <libmesh/point.h>
11#include <libmesh/poly2tri_triangulator.h>
36#ifdef LIBMESH_HAVE_POLY2TRI
47# ifdef LIBMESH_ENABLE_AMR
76#ifdef LIBMESH_HAVE_TRIANGLE
83# ifdef LIBMESH_ENABLE_AMR
116#ifdef LIBMESH_ENABLE_EXCEPTIONS
120 bool threw_desired_exception =
false;
125 std::regex msg_regex(re);
126 CPPUNIT_ASSERT(std::regex_search(e.what(), msg_regex));
127 threw_desired_exception =
true;
129 catch (CppUnit::Exception & e) {
133 CPPUNIT_ASSERT_MESSAGE(
"Unexpected exception type thrown",
false);
135 CPPUNIT_ASSERT(threw_desired_exception);
147 std::vector<TriangulatorInterface::PolygonHole> polyholes;
150 polyholes.emplace_back(center,
radius, 2);
152 polyholes.emplace_back(center,
radius, 3);
154 polyholes.emplace_back(center,
radius, 4);
156 polyholes.emplace_back(center,
radius, 5);
158 polyholes.emplace_back(center,
radius, 6);
160 for (
int i=0; i != 5; ++i)
162 const int n_sides = i+2;
165 const Real computed_area = hole.
area();
166 const Real theta =
pi/n_sides;
167 const Real half_side_length =
radius*std::cos(theta);
169 const Real area = n_sides * apothem * half_side_length;
177#ifdef LIBMESH_HAVE_TRIANGLE
192 std::vector<TriangulatorInterface::PolygonHole> polyholes;
194 auto check_corners = [center,
radius]
198 CPPUNIT_ASSERT_EQUAL(np, hole.n_points());
202 const Real xin = center(0) +
radius * .99 * std::cos(theta);
203 const Real xout = center(0) +
radius * 1.01 * std::cos(theta);
204 const Real yin = center(1) +
radius * .99 * std::sin(theta);
205 const Real yout = center(1) +
radius * 1.01 * std::sin(theta);
207 CPPUNIT_ASSERT(hole.contains(
Point(xin, yin)));
208 CPPUNIT_ASSERT(!hole.contains(
Point(xout, yout)));
213 check_corners(triangle, 3);
215 check_corners(diamond, 4);
217 check_corners(hexagon, 6);
220 {{1,0}, {{0,-1},{2,-1},{2,1},{1.75,-.5},{1.5,1},{1.25,-.5},
221 {1,1},{.75,-.5},{.5,1},{.25,-.5},{0,1}}};
223 CPPUNIT_ASSERT(jaggy.contains({.1,-.3}));
224 CPPUNIT_ASSERT(jaggy.contains({.5,.9}));
225 CPPUNIT_ASSERT(jaggy.contains({.9,-.3}));
226 CPPUNIT_ASSERT(jaggy.contains({1,0}));
227 CPPUNIT_ASSERT(jaggy.contains({1.1,-.4}));
228 CPPUNIT_ASSERT(jaggy.contains({1.5,.9}));
229 CPPUNIT_ASSERT(jaggy.contains({1.9,-.3}));
231 CPPUNIT_ASSERT(jaggy.contains({1.9,-.5}));
232 CPPUNIT_ASSERT(jaggy.contains({1.6,-.5}));
233 CPPUNIT_ASSERT(jaggy.contains({1.1,-.5}));
234 CPPUNIT_ASSERT(jaggy.contains({.5,-.5}));
235 CPPUNIT_ASSERT(jaggy.contains({.2,-.5}));
237 CPPUNIT_ASSERT(!jaggy.contains({.1,.7}));
238 CPPUNIT_ASSERT(!jaggy.contains({.5,1.1}));
239 CPPUNIT_ASSERT(!jaggy.contains({.9,.7}));
240 CPPUNIT_ASSERT(!jaggy.contains({1,-1.1}));
241 CPPUNIT_ASSERT(!jaggy.contains({1.1,.8}));
242 CPPUNIT_ASSERT(!jaggy.contains({1.5,1.1}));
243 CPPUNIT_ASSERT(!jaggy.contains({1.9,.9}));
245 CPPUNIT_ASSERT(!jaggy.contains({1.9,1}));
246 CPPUNIT_ASSERT(!jaggy.contains({1.4,1}));
247 CPPUNIT_ASSERT(!jaggy.contains({.9,1}));
248 CPPUNIT_ASSERT(!jaggy.contains({.4,1}));
249 CPPUNIT_ASSERT(!jaggy.contains({-.2,1}));
250 CPPUNIT_ASSERT(!jaggy.contains({-.2,0}));
251 CPPUNIT_ASSERT(!jaggy.contains({1.2,0}));
254 {{1,0}, {{-.25,-1},{2,-1},{2,1},{1.75,1},{1.75,-.5},{1.5,-.5},
255 {1.5,1},{1.25,1},{1.25,-.5},{1,-.5},{1,1},{.75,1},
256 {.75,-.5},{.5,-.5},{.5,1},{.25,1},{.25,-.5},{0,-.5},
259 CPPUNIT_ASSERT(square_jaggy.contains({-.1,-.3}));
260 CPPUNIT_ASSERT(square_jaggy.contains({.4,.9}));
261 CPPUNIT_ASSERT(square_jaggy.contains({.9,-.3}));
262 CPPUNIT_ASSERT(square_jaggy.contains({.9,0}));
263 CPPUNIT_ASSERT(square_jaggy.contains({1.1,-.6}));
264 CPPUNIT_ASSERT(square_jaggy.contains({1.4,.9}));
265 CPPUNIT_ASSERT(square_jaggy.contains({1.9,-.3}));
267 CPPUNIT_ASSERT(!square_jaggy.contains({.1,-.3}));
268 CPPUNIT_ASSERT(!square_jaggy.contains({.6,.9}));
269 CPPUNIT_ASSERT(!square_jaggy.contains({1.1,-.3}));
270 CPPUNIT_ASSERT(!square_jaggy.contains({1.1,0}));
271 CPPUNIT_ASSERT(!square_jaggy.contains({1.1,-1.6}));
272 CPPUNIT_ASSERT(!square_jaggy.contains({1.6,.9}));
273 CPPUNIT_ASSERT(!square_jaggy.contains({2.1,-.3}));
275 CPPUNIT_ASSERT(square_jaggy.contains({-.1,-.5}));
276 CPPUNIT_ASSERT(square_jaggy.contains({.3,-.5}));
277 CPPUNIT_ASSERT(square_jaggy.contains({.9,-.5}));
278 CPPUNIT_ASSERT(square_jaggy.contains({1.3,-.5}));
279 CPPUNIT_ASSERT(square_jaggy.contains({1.9,-.5}));
281 CPPUNIT_ASSERT(!square_jaggy.contains({-.3,1}));
282 CPPUNIT_ASSERT(!square_jaggy.contains({.2,1}));
283 CPPUNIT_ASSERT(!square_jaggy.contains({.6,1}));
284 CPPUNIT_ASSERT(!square_jaggy.contains({1.1,1}));
285 CPPUNIT_ASSERT(!square_jaggy.contains({1.6,1}));
286 CPPUNIT_ASSERT(!square_jaggy.contains({2.1,1}));
308 perturbed(
Point(0,4.e-16), std::sqrt(2_R)/2, 4);
310 {{0,0}, {{100,0},{100,100},{0,100},{-100,100},
311 {-100,0},{-100,-100},{0,-100},{100,-100}}};
314 CPPUNIT_ASSERT(outer_bdy.contains(perturbed.
point(i)));
326 for (
const auto & elem :
mesh.element_ptr_range())
328 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI3);
332 (elem->point(1) - elem->point(0)).cross
333 (elem->point(2) - elem->point(0));
335 CPPUNIT_ASSERT_GREATER(
Real(0), cross_prod(2));
337 bool found_triangle =
false;
338 for (
const auto & node : elem->node_ref_range())
340 const Point & point = node;
341 if (point ==
Point(0,0))
343 found_triangle =
true;
344 CPPUNIT_ASSERT((elem->point(0) ==
Point(0,0) &&
345 elem->point(1) ==
Point(1,0) &&
346 elem->point(2) ==
Point(0,1)) ||
347 (elem->point(1) ==
Point(0,0) &&
348 elem->point(2) ==
Point(1,0) &&
349 elem->point(0) ==
Point(0,1)) ||
350 (elem->point(2) ==
Point(0,0) &&
351 elem->point(0) ==
Point(1,0) &&
352 elem->point(1) ==
Point(0,1)));
354 if (point ==
Point(1,2))
356 found_triangle =
true;
357 CPPUNIT_ASSERT((elem->point(0) ==
Point(0,1) &&
358 elem->point(1) ==
Point(1,0) &&
359 elem->point(2) ==
Point(1,2)) ||
360 (elem->point(1) ==
Point(0,1) &&
361 elem->point(2) ==
Point(1,0) &&
362 elem->point(0) ==
Point(1,2)) ||
363 (elem->point(2) ==
Point(0,1) &&
364 elem->point(0) ==
Point(1,0) &&
365 elem->point(1) ==
Point(1,2)));
368 CPPUNIT_ASSERT(found_triangle);
379 const Real hsq2 = std::sqrt(2) / 2.0;
383 for (
const auto & elem :
mesh.element_ptr_range())
386 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI6);
388 for (
const auto & i_side :
make_range(elem->n_sides()))
391 if (elem->neighbor_ptr(i_side) ==
nullptr)
393 const Point & side_pt_0 = *(elem->node_ptr(i_side));
394 const Point & side_pt_1 = *(elem->node_ptr((i_side + 1) % 3));
395 const Point & side_pt_2 = *(elem->node_ptr(i_side + 3));
396 const bool x_sign = (side_pt_0(0) == 1 || side_pt_1(0) == 1);
397 const bool y_sign = (side_pt_0(1) == 1 || side_pt_1(1) == 1);
398 const Point ref_side_pt_2 =
Point (x_sign ? hsq2 : -hsq2, y_sign ? hsq2 : -hsq2);
399 CPPUNIT_ASSERT_EQUAL(ref_side_pt_2, side_pt_2);
436 int interpolate_boundary_points,
438 Real expected_total_area = 1.5,
439 Real desired_area = 1000)
455 CPPUNIT_ASSERT_EQUAL(
mesh.
n_elem(), n_expected_elem);
458 for (
const auto & elem :
mesh.active_local_element_ptr_range())
460 CPPUNIT_ASSERT_EQUAL(elem->level(), 0u);
461 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI3);
463 area += elem->volume();
473 const std::vector<Point> & expected_centers)
475 std::vector<bool> found_centers(expected_centers.size(),
false);
477 for (
const auto & elem :
mesh.element_ptr_range())
479 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI3);
483 (elem->point(1) - elem->point(0)).cross
484 (elem->point(2) - elem->point(0));
486 CPPUNIT_ASSERT_GREATER(
Real(0), cross_prod(2));
489 Point center = elem->vertex_average();
491 bool found_mine =
false;
494 Point possible = expected_centers[i];
499 found_centers[i] =
true;
502 CPPUNIT_ASSERT(found_mine);
507 for (
auto found_it : found_centers)
508 CPPUNIT_ASSERT(found_it);
526 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
534 Real r2p2o6 = (std::sqrt(2_R)+2)/6;
535 Real r2p4o6 = (std::sqrt(2_R)+4)/6;
537 std::vector <Point> expected_centers
538 { {r2p2o6,r2p2o6}, {r2p2o6,-r2p2o6},
539 {-r2p2o6,r2p2o6}, {-r2p2o6,-r2p2o6},
540 {0,r2p4o6}, {r2p4o6, 0},
541 {0,-r2p4o6}, {-r2p4o6, 0}
572 diamond(
Point(0,4.e-16),
573 std::sqrt(2_R)/2, 4);
574 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
582 const Real r2p200o6 = (std::sqrt(2_R)+200)/6,
583 r2p400o6 = (std::sqrt(2_R)+400)/6;
585 std::vector <Point> expected_centers
586 { {r2p400o6,100./3}, {-r2p400o6,100./3},
587 {r2p400o6,-100./3}, {-r2p400o6,-100./3},
588 {100./3,r2p400o6}, {-100./3,r2p400o6},
589 {100./3,-r2p400o6}, {-100./3,-r2p400o6},
590 {r2p200o6,r2p200o6}, {-r2p200o6,r2p200o6},
591 {r2p200o6,-r2p200o6}, {-r2p200o6,-r2p200o6},
627 left_diamond(
Point(-100,4.e-16),
628 std::sqrt(2_R)/2, 4),
629 right_diamond(
Point(100,-4.e-16),
630 std::sqrt(2_R)/2, 4);
631 const std::vector<TriangulatorInterface::Hole*> holes
632 { &left_diamond, &right_diamond };
640 const Real r2p200o6 = (std::sqrt(2_R)+200)/6,
641 r2p400o6 = (std::sqrt(2_R)+400)/6;
643 std::vector <Point> expected_centers
645 {100+r2p400o6,100./3}, {100+r2p400o6,-100./3},
646 {100+100./3,r2p400o6}, {100-100./3,r2p400o6},
647 {100+100./3,-r2p400o6}, {100-100./3,-r2p400o6},
648 {100+r2p200o6,r2p200o6}, {100-r2p200o6,r2p200o6},
649 {100+r2p200o6,-r2p200o6}, {100-r2p200o6,-r2p200o6},
651 {-100-r2p400o6,100./3}, {-100-r2p400o6,-100./3},
652 {-100-100./3,r2p400o6}, {-100+100./3,r2p400o6},
653 {-100-100./3,-r2p400o6}, {-100+100./3,-r2p400o6},
654 {-100-r2p200o6,r2p200o6}, {-100+r2p200o6,r2p200o6},
655 {-100-r2p200o6,-r2p200o6}, {-100+r2p200o6,-r2p200o6},
657 {0,100./3}, {0,-100./3}
682 CPPUNIT_ASSERT_EQUAL(centerhole.n_points(), 8u);
683 CPPUNIT_ASSERT_EQUAL(centerhole.area(),
Real(1));
684 Point inside = centerhole.inside();
685 CPPUNIT_ASSERT_EQUAL(inside(0),
Real(20));
686 CPPUNIT_ASSERT_EQUAL(inside(1),
Real(20));
688 const std::vector<TriangulatorInterface::Hole*> holes { ¢erhole };
696 std::vector <Point> expected_centers
697 { {-0.5,
Real(2)/3}, {0,
Real(5)/6},
701 {-0.5, -
Real(2)/3}, {0, -
Real(5)/6},
703 {-
Real(2)/3, -0.5}, {-
Real(5)/6, 0},
707 for (
auto & p : expected_centers)
714#ifdef LIBMESH_ENABLE_AMR
728 const Point center{20,20};
736 CPPUNIT_ASSERT_EQUAL(centerhole.n_points(), 8u);
737 Point inside = centerhole.inside();
738 CPPUNIT_ASSERT_EQUAL(inside(0),
Real(20));
739 CPPUNIT_ASSERT_EQUAL(inside(1),
Real(20));
741 const std::vector<TriangulatorInterface::Hole*> holes { ¢erhole };
753 std::map<std::pair<Real, Real>,
Point> outer_midpoints
754 {{{19, 19}, {20, 19}},
755 {{21, 19}, {21, 20}},
756 {{21, 21}, {20, 21}},
760 for (
const auto & elem :
mesh.active_local_element_ptr_range())
761 for (
const auto n :
make_range(elem->n_sides()))
763 if (elem->neighbor_ptr(n))
767 outer_midpoints.find(std::make_pair(elem->point(n)(0),
769 if (it != outer_midpoints.end())
771 const Point error = it->second - elem->point(n+3);
777 const Point radius1 = elem->point(n) - center;
781 const Point radius2 = elem->point((n+1)%3) - center;
785 const Point radius3 = elem->point(n+3) - center;
804 triangulator.
segments = {{0,2},{2,1},{1,3},{3,0}};
821 edge13->set_node(1, node3);
824 edge02->set_node(1, node2);
827 edge30->set_node(1, node0);
830 edge21->set_node(1, node1);
833 if (elem_type ==
EDGE3)
836 edge13->set_node(2, node4);
838 edge02->set_node(2, node5);
840 edge30->set_node(2, node6);
842 edge21->set_node(2, node7);
852 const Real hsq2 = std::sqrt(2) / 2.0;
864 edge021->set_node(1, node2);
865 edge021->set_node(2, node1);
868 edge243->set_node(1, node4);
869 edge243->set_node(2, node3);
872 edge465->set_node(1, node6);
873 edge465->set_node(2, node5);
876 edge607->set_node(1, node0);
877 edge607->set_node(2, node7);
900 edge45->set_node(1, node5);
901 edge45->subdomain_id() = 1;
904 edge56->set_node(1, node6);
905 edge56->subdomain_id() = 1;
908 edge67->set_node(1, node7);
909 edge67->subdomain_id() = 1;
912 edge78->set_node(1, node8);
913 edge78->subdomain_id() = 1;
916 edge84->set_node(1, node4);
917 edge84->subdomain_id() = 1;
919 if (elem_type ==
EDGE3)
922 edge45->set_node(2, node9);
924 edge56->set_node(2, node10);
926 edge67->set_node(2, node11);
928 edge78->set_node(2, node12);
930 edge84->set_node(2, node13);
937 std::set<std::size_t> bdy_ids {0};
944#ifdef LIBMESH_HAVE_TRIANGLE
1005#ifdef LIBMESH_ENABLE_AMR
1052#ifdef LIBMESH_HAVE_POLY2TRI
1144 const Real scale = 1e5;
1159 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1160 area += elem->volume();
1162 LIBMESH_ASSERT_FP_EQUAL(area, 1.5 * 1.7 * scale * scale,
TOLERANCE * scale * scale);
1214 bool saw_curved_element =
false;
1215 for (
const auto & elem :
mesh.element_ptr_range())
1217 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI7);
1219 const Point & x0 = elem->point(0);
1220 const Point & x1 = elem->point(1);
1221 const Point & x2 = elem->point(2);
1222 const Point & x3 = elem->point(3);
1223 const Point & x4 = elem->point(4);
1224 const Point & x5 = elem->point(5);
1225 const Point & x6 = elem->point(6);
1227 const Point expected =
1228 (
Real(-1)/9) * (x0 + x1 + x2) +
1229 (
Real( 4)/9) * (x3 + x4 + x5);
1230 const Point straight = (x0 + x1 + x2) /
Real(3);
1241 saw_curved_element =
true;
1245 CPPUNIT_ASSERT(saw_curved_element);
1251#ifdef LIBMESH_ENABLE_EXCEPTIONS
1272 edgeAB->set_node(1, vB);
1273 edgeAB->set_node(2, mAB);
1277 edgeBC->set_node(1, vC);
1278 edgeBC->set_node(2, mBC);
1282 edgeCA->set_node(1, vA);
1283 edgeCA->set_node(2, mCA);
1291 bool threw_desired_exception =
false;
1296 const std::regex msg_regex(
"tangled quadratic triangle");
1297 CPPUNIT_ASSERT(std::regex_search(e.what(), msg_regex));
1298 threw_desired_exception =
true;
1300 catch (CppUnit::Exception & e) {
1304 CPPUNIT_ASSERT_MESSAGE(
"Unexpected exception type thrown",
false);
1306 CPPUNIT_ASSERT(threw_desired_exception);
1311#ifdef LIBMESH_ENABLE_AMR
1363 edge13->set_node(1, node3);
1366 edge02->set_node(1, node2);
1369 edge30->set_node(1, node0);
1395 edge01->set_node(1, node1);
1398 edge12->set_node(1, node2);
1401 edge20->set_node(1, node0);
1405 edge34->set_node(1, node4);
1408 edge45->set_node(1, node5);
1411 edge53->set_node(1, node3);
1436 tri012->set_node(1, node1);
1437 tri012->set_node(2, node2);
1440 tri345->set_node(1, node4);
1441 tri345->set_node(2, node5);
1471 const std::vector<TriangulatorInterface::Hole*> * holes,
1472 Real expected_total_area,
1474 Real desired_area = 0.1,
1491 if (desired_area || area_func)
1492 CPPUNIT_ASSERT_GREATER(n_original_elem,
mesh.
n_elem());
1494 CPPUNIT_ASSERT_EQUAL(
mesh.
n_elem(), n_original_elem);
1497 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1499 CPPUNIT_ASSERT_EQUAL(elem->level(), 0u);
1500 CPPUNIT_ASSERT_EQUAL(elem->type(),
TRI3);
1502 const Real my_area = elem->volume();
1505 if (desired_area != 0)
1506 CPPUNIT_ASSERT_LESSEQUAL(desired_area, my_area);
1508 if (area_func !=
nullptr)
1509 for (
auto v :
make_range(elem->n_vertices()))
1511 const Real local_desired_area =
1512 (*area_func)(elem->point(v));
1513 CPPUNIT_ASSERT_LESSEQUAL(local_desired_area, my_area);
1555#ifdef LIBMESH_HAVE_FPARSER
1569 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
1584 Real total_area = 1.5;
1594 std::vector<TriangulatorInterface::AffineHole> hole_data;
1596 hole_data.reserve(M*N);
1597 std::vector<TriangulatorInterface::Hole*> holes;
1602 hole_data.emplace_back(diamond, 0, shift);
1603 holes.push_back(&hole_data.back());
1604 total_area -= hole_data.back().area();
1625 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
1637 int n_outer_sides = std::count_if(side_bcs.begin(), side_bcs.end(),
1638 [](
auto t){return std::get<2>(t) == 0;});
1639 CPPUNIT_ASSERT_GREATER(4, n_outer_sides);
1640 int n_hole_sides = std::count_if(side_bcs.begin(), side_bcs.end(),
1641 [](
auto t){return std::get<2>(t) == 1;});
1642 CPPUNIT_ASSERT_EQUAL(n_hole_sides, 4);
1665 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
1674#ifdef LIBMESH_HAVE_FPARSER
1677 const std::vector<TriangulatorInterface::Hole*> holes { &diamond };
void testPoly2TriRefined()
CPPUNIT_TEST(testPoly2TriNonUniformRefined)
LIBMESH_CPPUNIT_TEST_SUITE(MeshTriangulationTest)
The goal of this test is to verify proper operation of the interfaces to triangulation libraries.
void testPoly2TriInterp2()
void testPoly2TriLargeCocircular()
void testPoly2TriHolesRefined()
CPPUNIT_TEST(testTriangleHalfDomain)
void testTriangleEdge3ToTri6()
CPPUNIT_TEST(testPoly2TriEdge3s)
void testPoly2TriMeshedHoles()
void testEdge3Mesh(MeshBase &mesh)
void testPoly2TriHolesNonUniformRefined()
void testTriangulatorInterp(UnstructuredMesh &mesh, TriangulatorInterface &triangulator, int interpolate_boundary_points, dof_id_type n_expected_elem, Real expected_total_area=1.5, Real desired_area=1000)
CPPUNIT_TEST(testTriangleEdges)
CPPUNIT_TEST(testPoly2TriHolePerturbed)
void testEdge3ToTri6Base(MeshBase &mesh, TriangulatorInterface &triangulator)
void testTriangleHoleArea()
void testTriangleInterp2()
CPPUNIT_TEST(testPoly2TriEdge3ToTri6)
void testPoly2TriRoundHole()
void testPoly2TriHalfDomainEdge3()
void testTriangleInterp()
void testPoly2TriBad2DMultiBoundary()
CPPUNIT_TEST(testPoly2TriInterp)
CPPUNIT_TEST(testPoly2TriLargeCocircular)
CPPUNIT_TEST(testPoly2TriHolesInteriorRefined)
void testPoly2TriHolesExtraRefined()
void testTriangleMeshedHoles()
void testPoly2TriEdge3s()
CPPUNIT_TEST(testPoly2TriNonRefined)
void testTriangleHoleContains()
void testPoly2TriSegments()
CPPUNIT_TEST(testTriangleInterp)
void testEdgesMesh(MeshBase &mesh, ElemType elem_type)
void testPoly2TriHalfDomain()
CPPUNIT_TEST(testPoly2TriEdge3ToTri6FlipThrows)
void testTriangleRoundHole()
CPPUNIT_TEST(testPoly2TriHolesInteriorExtraRefined)
CPPUNIT_TEST(testPoly2TriBadEdges)
CPPUNIT_TEST(testPoly2TriBad1DMultiBoundary)
void testTriangulatorHoles(MeshBase &mesh, TriangulatorInterface &triangulator)
void testTriangulatorBase(MeshBase &mesh, TriangulatorInterface &triangulator)
void testPoly2TriEdge3ToTri6FlipThrows()
void testFoundCenters(const MeshBase &mesh, const std::vector< Point > &expected_centers)
CPPUNIT_TEST(testPoly2TriBad2DMultiBoundary)
void testTriangulatorSegments(MeshBase &mesh, TriangulatorInterface &triangulator)
CPPUNIT_TEST(testTriangleRoundHole)
void testPoly2TriExtraRefined()
void testTriangulatorRoundHole(MeshBase &mesh, TriangulatorInterface &triangulator)
void testPoly2TriEdgesRefined()
CPPUNIT_TEST(testPoly2TriHoles)
void testExceptionBase(MeshBase &mesh, TriangulatorInterface &triangulator, const char *re)
void testPoly2TriNonRefined()
CPPUNIT_TEST(testTriangleSegments)
CPPUNIT_TEST(testPoly2TriHolesInterpRefined)
void testPoly2TriBadEdges()
CPPUNIT_TEST(testTriangleEdge3ToTri6)
void testPoly2TriRefinementBase(UnstructuredMesh &mesh, const std::vector< TriangulatorInterface::Hole * > *holes, Real expected_total_area, dof_id_type n_original_elem, Real desired_area=0.1, FunctionBase< Real > *area_func=nullptr)
CPPUNIT_TEST(testTriangleMeshedHoles)
CPPUNIT_TEST(testPoly2TriHolesExtraRefined)
void testPoly2TriHolePerturbed()
void testHalfDomain(MeshBase &mesh, TriangulatorInterface &triangulator, ElemType elem_type)
void testPoly2TriInterp()
void testPoly2TriHolesInteriorExtraRefined()
void testTriangulator(MeshBase &mesh, TriangulatorInterface &triangulator)
void testTriangleHalfDomain()
CPPUNIT_TEST(testTriangleInterp2)
void testPoly2TriEdge3ToTri7CenterFixup()
void testPoly2TriHolesInterpRefined()
CPPUNIT_TEST(testPoly2TriRefined)
void testTriangulatorTrapMesh(UnstructuredMesh &mesh)
void testHoleContainsRayDegeneracies()
void testPoly2TriNonUniformRefined()
void testPoly2TriHolesInteriorRefined()
void testTriangulatorHolePerturbed(MeshBase &mesh, TriangulatorInterface &triangulator)
void testPoly2TriHoleTangentPerturbed()
void testPoly2TriHolesInteriorRefinedBase(dof_id_type n_original_elem, Real desired_area)
void testPoly2TriEdge3ToTri6()
CPPUNIT_TEST(testPoly2TriSegments)
CPPUNIT_TEST(testPoly2Tri)
void testTriangulatorHoleTangentPerturbed(MeshBase &mesh, TriangulatorInterface &triangulator)
CPPUNIT_TEST(testTriangleHoleContains)
CPPUNIT_TEST(testTriangle)
void commonSettings(TriangulatorInterface &triangulator)
CPPUNIT_TEST(testPoly2TriHolesRefined)
CPPUNIT_TEST(testPoly2TriEdgesRefined)
CPPUNIT_TEST(testTriangleHoleArea)
CPPUNIT_TEST(testPoly2TriMeshedHoles)
CPPUNIT_TEST(testHoleContainsRayDegeneracies)
CPPUNIT_TEST(testPoly2TriHolesNonUniformRefined)
CPPUNIT_TEST(testPoly2TriHoleTangentPerturbed)
CPPUNIT_TEST(testPoly2TriEdge3ToTri7CenterFixup)
CPPUNIT_TEST(testTriangleHoles)
CPPUNIT_TEST(testPoly2TriEdges)
CPPUNIT_TEST(testPoly2TriExtraRefined)
CPPUNIT_TEST(testPoly2TriHalfDomainEdge3)
CPPUNIT_TEST(testPoly2TriRoundHole)
void testPoly2TriBad1DMultiBoundary()
CPPUNIT_TEST(testPoly2TriInterp2)
void testTriangulatorMeshedHoles(MeshBase &mesh, TriangulatorInterface &triangulator)
CPPUNIT_TEST(testPoly2TriHalfDomain)
void testTriangleSegments()
void max(const T &r, T &o, Request &req) const
std::vector< BCTuple > build_side_list(BCTupleSortBy sort_by=BCTupleSortBy::ELEM_ID) const
virtual Node *& set_node(const unsigned int i)
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Base class for functors that can be evaluated at a point and (optionally) time.
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
This is the MeshBase class.
virtual const Node & node_ref(const dof_id_type i) const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual dof_id_type n_elem() 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 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 Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
const Parallel::Communicator & comm() const
A Function generated (via FParser) by parsing a mathematical expression.
A Point defines a location in LIBMESH_DIM dimensional Real space.
A C++ interface between LibMesh and the poly2tri library, with custom code for Steiner point insertio...
virtual void set_refine_boundary_allowed(bool refine_bdy_allowed) override
Set whether or not the triangulation is allowed to refine the mesh boundary when refining the interio...
virtual void set_desired_area_function(FunctionBase< Real > *desired) override
Set a function giving desired triangle area as a function of position.
virtual void triangulate() override
Internally, this calls the poly2tri triangulation code in a loop, inserting our owner Steiner points ...
A C++ interface between LibMesh and the Triangle library written by J.R.
Another concrete instantiation of the hole, this one should be sufficiently general for most non-poly...
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...
Real area() const
Return the area of the hole.
virtual void set_refine_boundary_allowed(bool refine_bdy_allowed)
Set whether or not a triangulator is allowed to refine the hole boundary when refining the mesh inter...
Another concrete instantiation of the hole, as general as ArbitraryHole, but based on an existing 1D ...
A concrete instantiation of the Hole class that describes polygonal (triangular, square,...
virtual Point point(const unsigned int n) const override
Return the nth point defining the hole.
virtual unsigned int n_points() const override
The number of geometric points which define the hole.
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 s...
Real & minimum_angle()
Sets and/or gets the minimum desired angle.
TriangulationType & triangulation_type()
Sets and/or gets the desired triangulation type.
virtual void triangulate()=0
This is the main public interface for this function.
@ PSLG
Triangulate the interior of a Planar Straight Line Graph, which is defined implicitly by the order of...
bool & smooth_after_generating()
Sets/gets flag which tells whether to do two steps of Laplace mesh smoothing after generating the gri...
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_bdy...
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 attach_hole_list(const std::vector< Hole * > *holes)
Attaches a vector of Hole* pointers which will be meshed around.
Real & desired_area()
Sets and/or gets the desired triangle area.
ElemType & elem_type()
Sets and/or gets the desired element type.
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_t...
void set_interpolate_boundary_points(int n_points)
Complicated setter, for compatibility with insert_extra_points()
bool absolute_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
bool relative_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
The UnstructuredMesh class is derived from the MeshBase class.
Communicator * TestCommWorld
CPPUNIT_TEST_SUITE_REGISTRATION(MeshTriangulationTest)
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
ElemType
Defines an enum for geometric element types.
static constexpr Real TOLERANCE
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...