Skip to content

Commit 889a723

Browse files
committed
Add unit test of reading Tetgen mesh with single element
1 parent 7113408 commit 889a723

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/mesh/mesh_input.C

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <libmesh/exodusII_io.h>
1414
#include <libmesh/nemesis_io.h>
1515
#include <libmesh/vtk_io.h>
16+
#include <libmesh/tetgen_io.h>
1617

1718
#include "test_comm.h"
1819
#include "libmesh_cppunit.h"
@@ -101,6 +102,10 @@ public:
101102
#endif // LIBMESH_HAVE_GZSTREAM
102103
#endif // LIBMESH_DIM > 1
103104

105+
#ifdef LIBMESH_HAVE_TETGEN
106+
CPPUNIT_TEST( testTetgenIO );
107+
#endif
108+
104109
CPPUNIT_TEST_SUITE_END();
105110

106111
private:
@@ -823,6 +828,30 @@ public:
823828
helperTestingDynaQuad(mesh);
824829
}
825830

831+
void testTetgenIO ()
832+
{
833+
#ifdef LIBMESH_HAVE_TETGEN
834+
LOG_UNIT_TEST;
835+
836+
Mesh mesh(*TestCommWorld);
837+
838+
TetGenIO tetgen_io(mesh);
839+
840+
if (mesh.processor_id() == 0)
841+
tetgen_io.read("meshes/tetgen_one_tet10.ele");
842+
MeshCommunication().broadcast(mesh);
843+
844+
mesh.prepare_for_use();
845+
846+
// Mesh should contain 1 TET10 finite element
847+
CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(1));
848+
CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), dof_id_type(10));
849+
850+
// Element should have TET10 reference element volume
851+
Real vol = mesh.elem_ptr(0)->volume();
852+
CPPUNIT_ASSERT_DOUBLES_EQUAL(vol, 1./6, TOLERANCE*TOLERANCE);
853+
#endif
854+
}
826855

827856
void testDynaNoSplines ()
828857
{

0 commit comments

Comments
 (0)