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"
9 #include <libmesh/auto_ptr.h>
11 #ifdef LIBMESH_HAVE_FPARSER
30 es = libmesh_make_unique<EquationSystems>(*
mesh);
31 sys = &(es->add_system<
System> (
"SimpleSystem"));
32 sys->add_variable(
"x2");
33 sys->add_variable(
"x3");
34 sys->add_variable(
"c05");
35 sys->add_variable(
"y4");
36 sys->add_variable(
"xy");
37 sys->add_variable(
"yz");
38 sys->add_variable(
"xyz");
90 c = libmesh_make_unique<FEMContext>(*sys);
91 s = libmesh_make_unique<FEMContext>(*sys);
94 c->pre_fe_reinit(*sys, elem);
96 s->pre_fe_reinit(*sys, elem);
113 CPPUNIT_TEST(testValues);
114 CPPUNIT_TEST(testGradients);
115 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
116 CPPUNIT_TEST(testHessians);
118 CPPUNIT_TEST(testInlineGetter);
119 CPPUNIT_TEST(testInlineSetter);
120 CPPUNIT_TEST(testNormals);
123 CPPUNIT_TEST_SUITE_END();
127 std::unique_ptr<UnstructuredMesh>
mesh;
128 std::unique_ptr<EquationSystems>
es;
130 std::unique_ptr<FEMContext> c,
s;
142 LIBMESH_ASSERT_FP_EQUAL
150 LIBMESH_ASSERT_FP_EQUAL
169 LIBMESH_ASSERT_FP_EQUAL
174 LIBMESH_ASSERT_FP_EQUAL
179 LIBMESH_ASSERT_FP_EQUAL
192 LIBMESH_ASSERT_FP_EQUAL
197 LIBMESH_ASSERT_FP_EQUAL
202 LIBMESH_ASSERT_FP_EQUAL
214 LIBMESH_ASSERT_FP_EQUAL
217 LIBMESH_ASSERT_FP_EQUAL
221 (*sys,
"a := 4 ; b := a/2+1; c:=b-a+3.5; c*x2*y4");
223 LIBMESH_ASSERT_FP_EQUAL
226 LIBMESH_ASSERT_FP_EQUAL
229 LIBMESH_ASSERT_FP_EQUAL
242 LIBMESH_ASSERT_FP_EQUAL
245 LIBMESH_ASSERT_FP_EQUAL
249 (*sys,
"a := 4 ; b := a/2+1; c:=b-a+3.5; c*x2*y4");
253 LIBMESH_ASSERT_FP_EQUAL
256 LIBMESH_ASSERT_FP_EQUAL
259 LIBMESH_ASSERT_FP_EQUAL
276 const std::vector<Point> & xyz = s->get_side_fe(0)->get_xyz();
279 for (std::size_t qp=0; qp != xyz.size(); ++qp)
281 LIBMESH_ASSERT_FP_EQUAL
283 LIBMESH_ASSERT_FP_EQUAL
285 LIBMESH_ASSERT_FP_EQUAL
295 #endif // #ifdef LIBMESH_HAVE_FPARSER