3 #include <libmesh/dof_map.h> 4 #include <libmesh/elem.h> 5 #include <libmesh/equation_systems.h> 6 #include <libmesh/fe_base.h> 7 #include <libmesh/fe_interface.h> 8 #include <libmesh/mesh.h> 9 #include <libmesh/mesh_generation.h> 10 #include <libmesh/numeric_vector.h> 11 #include <libmesh/system.h> 21 template <ElemType elem_type>
25 unsigned int _dim, _nx, _ny,
_nz;
29 std::unique_ptr<EquationSystems>
_es;
30 std::unique_ptr<FEBase>
_fe;
38 _mesh = std::make_unique<Mesh>(*TestCommWorld);
39 const std::unique_ptr<Elem> test_elem =
Elem::build(elem_type);
40 _dim = test_elem->dim();
41 const unsigned int ny = _dim > 1;
42 const unsigned int nz = _dim > 2;
45 _mesh->add_node_integer(
"buffer integer1");
46 _mesh->add_node_integer(
"buffer integer2");
50 const Real default_weight = 1.0;
51 unsigned char weight_index = cast_int<unsigned char>
52 (_mesh->add_node_datum<
Real>(
"rational_weight",
true,
55 libmesh_assert_not_equal_to(weight_index, 0);
58 _mesh->set_default_mapping_data(weight_index);
62 0., 1., 0., ny, 0., nz,
65 for (
auto elem : _mesh->element_ptr_range())
68 CPPUNIT_ASSERT_EQUAL(elem->mapping_data(), weight_index);
74 for (
auto node : _mesh->node_ptr_range())
76 Real & x = (*node)(0);
77 Real & y = (*node)(1);
78 node->set_extra_datum<
Real>(weight_index, 1);
88 node->set_extra_datum<
Real>(weight_index, sqrt(
Real(2))/2);
92 _es = std::make_unique<EquationSystems>(*_mesh);
93 System * sys = &(_es->add_system<
System> (
"SimpleSystem"));
109 auto rng = _mesh->active_local_element_ptr_range();
110 _elem = rng.begin() == rng.end() ? nullptr : *(rng.begin());
113 _ny = (_dim > 1) ? _nx : 0;
114 _nz = (_dim > 2) ? _nx : 0;
132 #ifdef LIBMESH_ENABLE_EXCEPTIONS 133 for (
unsigned int j=0; j != _ny+1; ++j)
134 for (
unsigned int k=0; k != _nz+1; ++k)
136 for (
int i=-1; i !=
int(_nx+2); ++i)
139 theta = (
Real(j)/_nx)*
pi/2,
141 Real x = -.5 + r * std::cos(theta),
142 y = r * std::sin(theta);
145 if (i >= 0 && i <=
int(_nx))
157 #define INSTANTIATE_RATIONALMAP_TEST(elemtype) \ 158 class RationalMapTest_##elemtype : public RationalMapTest<elemtype> { \ 160 RationalMapTest_##elemtype() : \ 161 RationalMapTest<elemtype>() { \ 162 if (unitlog->summarized_logs_enabled()) \ 163 this->libmesh_suite_name = "RationalMapTest"; \ 165 this->libmesh_suite_name = "RationalMapTest_" #elemtype; \ 167 CPPUNIT_TEST_SUITE( RationalMapTest_##elemtype ); \ 168 CPPUNIT_TEST( testContainsPoint ); \ 169 CPPUNIT_TEST_SUITE_END(); \ 172 CPPUNIT_TEST_SUITE_REGISTRATION( RationalMapTest_##elemtype );
std::vector< dof_id_type > _dof_indices
This is the base class from which all geometric element types are derived.
INSTANTIATE_RATIONALMAP_TEST(EDGE3)
The libMesh namespace provides an interface to certain functionality in the library.
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
std::unique_ptr< FEBase > _fe
std::unique_ptr< EquationSystems > _es
Manages consistently variables, degrees of freedom, and coefficient vectors.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
std::string libmesh_suite_name
const FEType & variable_type(const unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< Mesh > _mesh
A Point defines a location in LIBMESH_DIM dimensional Real space.
void ErrorVector unsigned int