Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
garth-wells committed Feb 14, 2025
1 parent 3ea6a64 commit 8faaa37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 1 addition & 2 deletions cpp/test/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
u1, u2 = ufl.Coefficient(V1), ufl.Coefficient(V2)
pts, _ = make_quadrature(CellType.hexahedron, quadrature_degree)
Q6_P1, Q6_P2 = ufl.grad(u1), ufl.grad(u2)
# expressions = [(Q6_P1, pts), (Q6_P2, pts)]
expressions = [(Q6_P2, pts)]
expressions = [(Q6_P1, pts), (Q6_P2, pts)]
22 changes: 12 additions & 10 deletions cpp/test/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ TEST_CASE("Create Expression (mismatch of mesh geometry)", "[expression]")
element, std::vector<std::size_t>{3})));
auto u = std::make_shared<fem::Function<double>>(V);

// Create Expression that expects P2 geometry
CHECK_THROWS(dolfinx::fem::create_expression<double>(*expression_expr_Q6_P2,
{{"u2", u}}, {}));
std::vector<std::int32_t> cells(1);

// std::size_t tdim = mesh->topology()->dim();
// std::vector<std::int32_t> cells(
// mesh->topology()->index_map(tdim)->size_local());
// std::iota(cells.begin(), cells.end(), 0);
// Create Expression that expects P1 geometry
dolfinx::fem::Expression<double> expr1
= dolfinx::fem::create_expression<double>(*expression_expr_Q6_P1,
{{"u1", u}}, {});
auto [Xc, Xshape] = expr1.X();
std::vector<double> grad_e(3 * 3 * Xshape[0] * cells.size());
expr1.eval(*mesh, cells, grad_e, {cells.size(), 3 * 3 * Xshape[0]});

// auto [Xc, Xshape] = eps_expr.X();
// std::vector<double> grad_e(3 * 3 * Xshape[0] * cells.size());
// eps_expr.eval(*mesh, cells, grad_e, {cells.size(), 3 * 3 * Xshape[0]});
// Create Expression that expects P2 geometry. Should throw because
// mesh is P1.
CHECK_THROWS(dolfinx::fem::create_expression<double>(*expression_expr_Q6_P2,
{{"u2", u}}, {}));
}

0 comments on commit 8faaa37

Please sign in to comment.