Skip to content

Commit 55a5fef

Browse files
committed
Unit test coverage of badly oriented tet boundary
1 parent 3607fca commit 55a5fef

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

tests/mesh/mesh_tet_test.C

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public:
5050
CPPUNIT_TEST( testNetGenError );
5151
CPPUNIT_TEST( testNetGenTets );
5252
CPPUNIT_TEST( testNetGenFlippedTris );
53+
CPPUNIT_TEST( testNetGenNonOriented );
5354
CPPUNIT_TEST( testNetGenHole );
5455

5556
#ifdef LIBMESH_ENABLE_AMR
@@ -232,13 +233,30 @@ public:
232233

233234
void testTrisToTets(UnstructuredMesh & mesh,
234235
MeshTetInterface & triangulator,
235-
bool flip_tris = false)
236+
bool flip_tris = false,
237+
bool flip_some_tris = false)
236238
{
237239
// An asymmetric octahedron, so we hopefully have an unambiguous
238240
// choice of shortest diagonal for a Delaunay algorithm to pick.
239241
const Real expected_volume =
240242
build_octahedron(mesh, flip_tris, -1, 1, -1, 1, -0.1, 0.1);
241243

244+
// Flip a couple tri, breaking the mesh in a way we can fix
245+
if (flip_some_tris)
246+
for (auto elem : mesh.element_ptr_range())
247+
{
248+
Point center = elem->vertex_average();
249+
if ((center(0) > 0 &&
250+
center(1) > 0 &&
251+
center(2) > 0) ||
252+
(center(0) < 0 &&
253+
center(1) < 0 &&
254+
center(2) < 0))
255+
elem->flip(&mesh.get_boundary_info());
256+
257+
mesh.unset_is_prepared();
258+
}
259+
242260
this->testTetInterfaceBase(mesh, triangulator, /* n_elem = */ 4,
243261
/* n_nodes = */ 6, expected_volume);
244262
}
@@ -394,6 +412,17 @@ public:
394412
}
395413

396414

415+
void testNetGenNonOriented()
416+
{
417+
LOG_UNIT_TEST;
418+
419+
Mesh mesh(*TestCommWorld);
420+
NetGenMeshInterface net_tet(mesh);
421+
testTrisToTets(mesh, net_tet, true, true);
422+
testBcids(mesh);
423+
}
424+
425+
397426
void testNetGenHole()
398427
{
399428
LOG_UNIT_TEST;

0 commit comments

Comments
 (0)