MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / test_expression_cmap_compat

Function test_expression_cmap_compat

cpp/test/fem/form.cpp:28–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void test_expression_cmap_compat(const auto& V)
29{
30 auto u = std::make_shared<fem::Function<double>>(V);
31 auto mesh = u->function_space()->mesh();
32
33 std::vector<std::int32_t> cells(1);
34
35 // Create Expression that expects P1 geometry
36 dolfinx::fem::Expression<double> expr1
37 = dolfinx::fem::create_expression<double>(*expression_expr_Q6_P1,
38 {{"u1", u}}, {}, {});
39 auto [Xc, Xshape] = expr1.X();
40 std::vector<double> grad_e(3 * Xshape[0] * cells.size());
41 fem::tabulate_expression(std::span(grad_e), expr1, *mesh,
42 md::mdspan(cells.data(), cells.size()));
43
44 // Create Expression that expects P2 geometry. Should throw because
45 // mesh is P1.
46 dolfinx::fem::Expression<double> expr2
47 = dolfinx::fem::create_expression<double>(*expression_expr_Q6_P2,
48 {{"u2", u}}, {}, {});
49 CHECK_THROWS(fem::tabulate_expression(
50 std::span(grad_e), expr2, *mesh, md::mdspan(cells.data(), cells.size())));
51}
52} // namespace
53
54TEST_CASE("Create Expression/Form (mismatch of mesh geometry)",

Callers 1

form.cppFile · 0.85

Calls 6

dataMethod · 0.80
tabulate_expressionFunction · 0.50
meshMethod · 0.45
function_spaceMethod · 0.45
XMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected