libMesh
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. More...
 
 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 ( testTriRefinement  )

◆ CPPUNIT_TEST() [2/2]

SimplexRefinementTest::CPPUNIT_TEST ( test3DTriRefinement  )

◆ 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.

References libMesh::Real, TIMPI::Communicator::size(), libMesh::MeshTools::Generation::surface_octahedron(), and TestCommWorld.

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  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
processor_id_type size() const
void testRefinement(UnstructuredMesh &mesh, Real desired_measure, Real expected_total_measure)
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
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50

◆ testRefinement()

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

Definition at line 37 of file simplex_refinement_test.C.

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

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  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
void sum(T &r) const
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
MeshBase & mesh
A C++ class to refine a simplicial mesh via splitting edges that exceed a given metric.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ testTriRefinement()

void SimplexRefinementTest::testTriRefinement ( )
inline

Definition at line 60 of file simplex_refinement_test.C.

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

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  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
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.
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:50

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