Skip to content

Commit cba8d9a

Browse files
committed
Unit test for non-refinement-refinement fix
1 parent ca67cb4 commit cba8d9a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/mesh/mesh_triangulation.C

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public:
4545
CPPUNIT_TEST( testPoly2TriEdgesRefined );
4646
CPPUNIT_TEST( testPoly2TriSegments );
4747
CPPUNIT_TEST( testPoly2TriRefined );
48+
CPPUNIT_TEST( testPoly2TriNonRefined );
4849
CPPUNIT_TEST( testPoly2TriExtraRefined );
4950
CPPUNIT_TEST( testPoly2TriHolesRefined );
5051
CPPUNIT_TEST( testPoly2TriHolesInterpRefined );
@@ -901,7 +902,11 @@ public:
901902

902903
triangulator.triangulate();
903904

904-
CPPUNIT_ASSERT(mesh.n_elem() > n_original_elem);
905+
// If refinement should have increased our element count, check it
906+
if (desired_area || area_func)
907+
CPPUNIT_ASSERT_LESS(mesh.n_elem(), n_original_elem); // n_elem+++
908+
else
909+
CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), n_original_elem);
905910

906911
Real area = 0;
907912
for (const auto & elem : mesh.active_local_element_ptr_range())
@@ -940,6 +945,17 @@ public:
940945
testPoly2TriRefinementBase(mesh, nullptr, 1.5, 15);
941946
}
942947

948+
void testPoly2TriNonRefined()
949+
{
950+
LOG_UNIT_TEST;
951+
952+
Mesh mesh(*TestCommWorld);
953+
testPoly2TriTrapMesh(mesh);
954+
// Make sure we see 0 as "don't refine", not "infinitely refine"
955+
testPoly2TriRefinementBase(mesh, nullptr, 1.5, 2, 0);
956+
}
957+
958+
943959
void testPoly2TriExtraRefined()
944960
{
945961
LOG_UNIT_TEST;

0 commit comments

Comments
 (0)