libMesh
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SimplexRefinementTest Class Reference
Inheritance diagram for SimplexRefinementTest:
[legend]

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (SimplexRefinementTest)
 The goal of this test is to verify proper operation of the interfaces to tetrahedralization libraries.
 
 CPPUNIT_TEST (testTriRefinement)
 
 CPPUNIT_TEST (test3DTriRefinement)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testRefinement (UnstructuredMesh &mesh, Real desired_measure, Real expected_total_measure)
 
void testTriRefinement ()
 
void test3DTriRefinement ()
 

Detailed Description

Definition at line 18 of file simplex_refinement_test.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

SimplexRefinementTest::CPPUNIT_TEST ( test3DTriRefinement  )

◆ CPPUNIT_TEST() [2/2]

SimplexRefinementTest::CPPUNIT_TEST ( testTriRefinement  )

◆ CPPUNIT_TEST_SUITE_END()

SimplexRefinementTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

SimplexRefinementTest::LIBMESH_CPPUNIT_TEST_SUITE ( SimplexRefinementTest  )

The goal of this test is to verify proper operation of the interfaces to tetrahedralization libraries.

◆ setUp()

void SimplexRefinementTest::setUp ( )
inline

Definition at line 33 of file simplex_refinement_test.C.

33{}

◆ tearDown()

void SimplexRefinementTest::tearDown ( )
inline

Definition at line 35 of file simplex_refinement_test.C.

35{}

◆ test3DTriRefinement()

void SimplexRefinementTest::test3DTriRefinement ( )
inline

Definition at line 73 of file simplex_refinement_test.C.

74 {
75 // We may have a bug when trying to edge refine on more processors
76 // than elements? I can't reproduce it and it seems intermittent
77 // in CI.
78 if (TestCommWorld->size() > 8)
79 return;
80
81 LOG_UNIT_TEST;
82
83 Mesh trimesh(*TestCommWorld);
84
86 (trimesh, -1, 1, -1, 1, -1, 1);
87
88 testRefinement(trimesh, 0.05, 4*std::sqrt(Real(3)));
89 }
void testRefinement(UnstructuredMesh &mesh, Real desired_measure, Real expected_total_measure)
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition mesh.h:51
Communicator * TestCommWorld
void surface_octahedron(UnstructuredMesh &mesh, Real xmin, Real xmax, Real ymin, Real ymax, Real zmin, Real zmax, bool flip_tris=false)
Meshes the surface of an octahedron with 8 Tri3 elements, with counter-clockwise (libMesh default) no...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::Real, libMesh::MeshTools::Generation::surface_octahedron(), TestCommWorld, and testRefinement().

◆ testRefinement()

void SimplexRefinementTest::testRefinement ( UnstructuredMesh mesh,
Real  desired_measure,
Real  expected_total_measure 
)
inline

Definition at line 37 of file simplex_refinement_test.C.

40 {
41 SimplexRefiner simplex_refiner(mesh);
42 simplex_refiner.desired_volume() = desired_measure;
43
44 simplex_refiner.refine_elements();
45
46 Real total_measure = 0;
47 for (const Elem * elem : mesh.local_element_ptr_range())
48 {
49 Real measure = elem->volume();
50 CPPUNIT_ASSERT_LESSEQUAL(desired_measure, measure);
51 total_measure += measure;
52 }
53
54 TestCommWorld->sum(total_measure);
55 LIBMESH_ASSERT_FP_EQUAL(total_measure, expected_total_measure,
57 }
This is the base class from which all geometric element types are derived.
Definition elem.h:96
A C++ class to refine a simplicial mesh via splitting edges that exceed a given metric.
MeshBase & mesh
static constexpr Real TOLERANCE

References libMesh::SimplexRefiner::desired_volume(), mesh, libMesh::Real, libMesh::SimplexRefiner::refine_elements(), TestCommWorld, and libMesh::TOLERANCE.

Referenced by test3DTriRefinement(), and testTriRefinement().

◆ testTriRefinement()

void SimplexRefinementTest::testTriRefinement ( )
inline

Definition at line 60 of file simplex_refinement_test.C.

61 {
62 LOG_UNIT_TEST;
63
64 Mesh trimesh(*TestCommWorld);
65
67 0.0, 2.0, 0.0, 2.0, TRI3);
68
69 testRefinement(trimesh, 0.05, 4);
70 }
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.

References libMesh::MeshTools::Generation::build_square(), TestCommWorld, testRefinement(), and libMesh::TRI3.


The documentation for this class was generated from the following file: