1 #include <libmesh/boundary_info.h> 2 #include <libmesh/elem.h> 3 #include <libmesh/enum_quadrature_type.h> 4 #include <libmesh/fe_map.h> 5 #include <libmesh/mesh.h> 6 #include <libmesh/mesh_generation.h> 7 #include <libmesh/mesh_modification.h> 8 #include <libmesh/mesh_tools.h> 9 #include <libmesh/quadrature.h> 30 CPPUNIT_TEST( testAllRBBNodeElem );
31 CPPUNIT_TEST( testAllRBBEdge );
32 CPPUNIT_TEST( testAllRBBEdge3 );
36 CPPUNIT_TEST( testAllRBBTri );
37 CPPUNIT_TEST( testAllRBBTri6 );
38 CPPUNIT_TEST( testAllRBBQuad );
39 CPPUNIT_TEST( testAllRBBQuad8 );
40 CPPUNIT_TEST( testAllRBBQuad9 );
43 # ifdef LIBMESH_ENABLE_AMR 44 CPPUNIT_TEST( testAllRBBCircle4 );
45 CPPUNIT_TEST( testAllRBBCircle8 );
46 CPPUNIT_TEST( testAllRBBCircle16 );
48 CPPUNIT_TEST( testAllRBBDisk5 );
49 CPPUNIT_TEST( testAllRBBDisk20 );
50 CPPUNIT_TEST( testAllRBBDisk80 );
52 CPPUNIT_TEST( testAllRBBTri6Disk10 );
53 CPPUNIT_TEST( testAllRBBTri6Disk40 );
54 CPPUNIT_TEST( testAllRBBTri6Disk160 );
60 CPPUNIT_TEST( testAllRBBTet );
61 CPPUNIT_TEST( testAllRBBTet10 );
62 CPPUNIT_TEST( testAllRBBHex );
63 CPPUNIT_TEST( testAllRBBHex20 );
64 CPPUNIT_TEST( testAllRBBHex27 );
71 # ifdef LIBMESH_ENABLE_AMR 72 CPPUNIT_TEST( testAllRBBCylinder10 );
73 CPPUNIT_TEST( testAllRBBCylinder80 );
77 CPPUNIT_TEST_SUITE_END();
89 dim > 0 ? 2 : 0,
dim > 1 ? 1 : 0,
dim > 2 ? 1 : 0,
100 std::vector<Real> orig_hmin(n_orig_elem), orig_hmax(n_orig_elem);
104 for (
auto & elem :
mesh.element_ptr_range())
106 orig_hmin[elem->id()] = elem->hmin();
107 orig_hmax[elem->id()] = elem->hmax();
112 CPPUNIT_ASSERT_EQUAL(n_orig_elem,
mesh.
n_elem());
117 for (
auto & elem :
mesh.element_ptr_range())
119 CPPUNIT_ASSERT_EQUAL(elem->mapping_type(),
121 CPPUNIT_ASSERT(elem->has_affine_map());
124 LIBMESH_ASSERT_FP_EQUAL(elem->volume(), orig_volume,
126 LIBMESH_ASSERT_FP_EQUAL(elem->hmax(), orig_hmax[elem->id()],
128 LIBMESH_ASSERT_FP_EQUAL(elem->hmin(), orig_hmin[elem->id()],
132 for (
auto & node :
mesh.node_ptr_range())
134 const Real w = node->get_extra_datum<
Real>(weight_index);
136 CPPUNIT_ASSERT_EQUAL(
Real(1), w);
151 n_refinements,
QUAD9);
154 interior_mesh.get_boundary_info().sync(boundary_mesh);
158 CPPUNIT_ASSERT_EQUAL(boundary_mesh.
n_elem(), n_edges);
159 CPPUNIT_ASSERT_EQUAL(boundary_mesh.
n_elem(), n_edges);
161 for (
auto & node : boundary_mesh.node_ptr_range())
163 const Point p = *node;
164 LIBMESH_ASSERT_FP_EQUAL(p.
norm(),
radius, tol);
170 const Real max_lagrange_error =
171 radius * 5e-2 / (1 << (4*n_refinements));
173 circumference, max_lagrange_error);
177 for (
auto & elem : boundary_mesh.element_ptr_range())
185 constexpr
int n_intervals = 4;
187 for (master_pt(0) = -1; master_pt(0) <= 1 +
TOLERANCE;
188 master_pt(0) +=
Real(2)/n_intervals)
191 LIBMESH_ASSERT_FP_EQUAL(
radius, p.
norm(), tol);
198 const Real max_rbb_error =
199 radius * 1e-3 / (1 << (6*n_refinements));
201 circumference, max_rbb_error);
214 n_refinements, type);
217 (5 << (n_refinements*2)) * (type ==
QUAD9 ? 1 : 2);
224 const Real max_lagrange_error =
225 radius * 5e-2 / (1 << (4*n_refinements));
228 area, max_lagrange_error);
232 for (
const Elem * elem :
mesh.element_ptr_range())
242 if (elem->neighbor_ptr(s))
245 constexpr
int n_intervals = 4;
246 Point master_pt = elem->master_point(s);
248 (elem->master_point((s+1)%elem->n_sides()) - master_pt)
254 LIBMESH_ASSERT_FP_EQUAL(
radius, p.
norm(), tol);
263 const Real max_rbb_error =
264 radius * 2e-3 / (1 << (6*n_refinements));
266 area, max_rbb_error);
274 const Real height = 3;
283 n_refinements, side_type);
286 const unsigned int nz = 2;
291 (5 << (n_refinements*2)) * (side_type ==
QUAD9 ? 1 : 2) * nz;
298 const Real max_lagrange_error =
299 radius * 5e-2 / (1 << (4*n_refinements)) *
303 volume, max_lagrange_error);
307 std::unique_ptr<const Elem> elem_side;
308 constexpr
int n_intervals = 4;
311 for (
const Elem * elem :
mesh.element_ptr_range())
321 if (elem->neighbor_ptr(s))
324 const Point side_normal =
325 elem->side_vertex_average_normal(s);
336 elem->build_side_ptr(elem_side, s);
337 qrule->init(*elem_side);
343 LIBMESH_ASSERT_FP_EQUAL(
radius, p.
norm(), tol);
351 const Real max_rbb_error =
352 radius * 2e-3 / (1 << (6*n_refinements)) *
void test_circle(unsigned int n_refinements)
ElemType
Defines an enum for geometric element types.
void testAllRBBCylinder80()
Order
defines an enum for polynomial orders.
libMesh::Parallel::Communicator * TestCommWorld
static constexpr Real TOLERANCE
void testAllRBBTri6Disk160()
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
This is the base class from which all geometric element types are derived.
The libMesh namespace provides an interface to certain functionality in the library.
void testAllRBBTri6Disk10()
void libmesh_ignore(const Args &...)
unsigned char default_mapping_data() const
Returns any default data value used by the master space to physical space mapping.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
virtual dof_id_type max_elem_id() const =0
void testAllRBBCylinder10()
void testAllRBBCircle16()
void test_box(ElemType elem_type)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static Point map(const unsigned int dim, const Elem *elem, const Point &reference_point)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
static std::unique_ptr< QBase > build(std::string_view name, const unsigned int dim, const Order order=INVALID_ORDER)
Builds a specific quadrature rule based on the name string.
void test_cylinder(unsigned int n_refinements, const ElemType type=HEX27)
virtual dof_id_type n_elem() const override final
void testAllRBBTri6Disk40()
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void test_disk(unsigned int n_refinements, const ElemType type=QUAD9)
A Point defines a location in LIBMESH_DIM dimensional Real space.
void testAllRBBNodeElem()
CPPUNIT_TEST_SUITE_REGISTRATION(AllRBBTest)