2 #include "libmesh/elem.h" 3 #include "libmesh/equation_systems.h" 4 #include "libmesh/mesh.h" 5 #include "libmesh/mesh_generation.h" 6 #include "libmesh/numeric_vector.h" 7 #include "libmesh/parsed_fem_function.h" 8 #include "libmesh/system.h" 10 #ifdef LIBMESH_HAVE_FPARSER 27 mesh = std::make_unique<Mesh>(*TestCommWorld);
29 es = std::make_unique<EquationSystems>(*mesh);
30 sys = &(es->add_system<
System> (
"SimpleSystem"));
31 sys->add_variable(
"x2");
32 sys->add_variable(
"x3");
33 sys->add_variable(
"c05");
34 sys->add_variable(
"y4");
35 sys->add_variable(
"xy");
36 sys->add_variable(
"yz");
37 sys->add_variable(
"xyz");
89 c = std::make_unique<FEMContext>(*sys);
90 s = std::make_unique<FEMContext>(*sys);
93 c->get_element_fe(0)->get_phi();
94 c->get_element_fe(0)->get_dphi();
95 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 96 c->get_element_fe(0)->get_d2phi();
98 c->pre_fe_reinit(*sys, elem);
101 s->get_side_fe(0)->get_normals();
102 s->pre_fe_reinit(*sys, elem);
119 CPPUNIT_TEST(testValues);
120 CPPUNIT_TEST(testGradients);
121 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 122 CPPUNIT_TEST(testHessians);
124 CPPUNIT_TEST(testInlineGetter);
125 CPPUNIT_TEST(testInlineSetter);
126 CPPUNIT_TEST(testNormals);
129 CPPUNIT_TEST_SUITE_END();
133 std::unique_ptr<UnstructuredMesh>
mesh;
134 std::unique_ptr<EquationSystems>
es;
136 std::unique_ptr<FEMContext> c,
s;
146 std::vector<ParsedFEMFunction<Number>> pfvec;
155 pfvec.push_back(xy8_stolen);
157 LIBMESH_ASSERT_FP_EQUAL
161 LIBMESH_ASSERT_FP_EQUAL
182 LIBMESH_ASSERT_FP_EQUAL
187 LIBMESH_ASSERT_FP_EQUAL
192 LIBMESH_ASSERT_FP_EQUAL
207 LIBMESH_ASSERT_FP_EQUAL
212 LIBMESH_ASSERT_FP_EQUAL
217 LIBMESH_ASSERT_FP_EQUAL
231 LIBMESH_ASSERT_FP_EQUAL
234 LIBMESH_ASSERT_FP_EQUAL
238 (*sys,
"a := 4 ; b := a/2+1; c:=b-a+3.5; c*x2*y4");
240 LIBMESH_ASSERT_FP_EQUAL
243 LIBMESH_ASSERT_FP_EQUAL
246 LIBMESH_ASSERT_FP_EQUAL
261 LIBMESH_ASSERT_FP_EQUAL
264 LIBMESH_ASSERT_FP_EQUAL
268 (*sys,
"a := 4 ; b := a/2+1; c:=b-a+3.5; c*x2*y4");
272 LIBMESH_ASSERT_FP_EQUAL
275 LIBMESH_ASSERT_FP_EQUAL
278 LIBMESH_ASSERT_FP_EQUAL
297 const std::vector<Point> & xyz = s->get_side_fe(0)->get_xyz();
300 for (std::size_t qp=0; qp != xyz.size(); ++qp)
302 LIBMESH_ASSERT_FP_EQUAL
304 LIBMESH_ASSERT_FP_EQUAL
306 LIBMESH_ASSERT_FP_EQUAL
316 #endif // #ifdef LIBMESH_HAVE_FPARSER
CPPUNIT_TEST_SUITE_REGISTRATION(ParsedFEMFunctionTest)
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
libMesh::Parallel::Communicator * TestCommWorld
static constexpr Real TOLERANCE
This is the base class from which all geometric element types are derived.
processor_id_type rank() const
The libMesh namespace provides an interface to certain functionality in the library.
Output get_inline_value(std::string_view inline_var_name) const
const Node & node_ref(const unsigned int i) const
ParsedFEMFunction provides support for FParser-based parsed functions in FEMSystem.
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::unique_ptr< EquationSystems > es
void set_inline_value(std::string_view inline_var_name, Output newval)
Changes the value of an inline variable.
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
std::unique_ptr< UnstructuredMesh > mesh
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
std::unique_ptr< FEMContext > s
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.