| 10 |
10 |
| 11 #include "dolfinx_access/minmax_p2.h" |
11 #include "dolfinx_access/minmax_p2.h" |
| 12 #include "pointsource_pde/src/dolfinx_access.rs.h" |
12 #include "pointsource_pde/src/dolfinx_access.rs.h" |
| 13 |
13 |
| 14 using namespace dolfinx::fem; |
14 using namespace dolfinx::fem; |
| 15 namespace cell = basix::cell; |
|
| 16 using namespace basix::element; |
15 using namespace basix::element; |
| 17 using namespace dolfinx_access; |
16 using namespace dolfinx_access; |
| 18 |
17 |
| 19 namespace dolfinx_access { |
18 namespace dolfinx_access { |
| 20 |
19 |
| 43 // take the cell quadrature matrix from Fenics, we should restrict el.lagrange_variant() = |
42 // take the cell quadrature matrix from Fenics, we should restrict el.lagrange_variant() = |
| 44 // lagrange_variant::equispaced. |
43 // lagrange_variant::equispaced. |
| 45 auto el = fp->element()->basix_element(); |
44 auto el = fp->element()->basix_element(); |
| 46 // printf("%d %d %d %d\n", el.degree(), el.cell_type(), el.lagrange_variant(), |
45 // printf("%d %d %d %d\n", el.degree(), el.cell_type(), el.lagrange_variant(), |
| 47 // el.family()); |
46 // el.family()); |
| 48 if (el.degree() != 2 || el.cell_type() != cell::type::triangle || |
47 if (el.degree() != 2 || el.cell_type() != basix::cell::type::triangle || |
| 49 /*el.lagrange_variant() != lagrange_variant::equispaced ||*/ el.family() != |
48 /*el.lagrange_variant() != lagrange_variant::equispaced ||*/ el.family() != |
| 50 family::P) { |
49 family::P) { |
| 51 throw "Only equispaced Lagrange second-order polynomial elements are supported"; |
50 throw "Only equispaced Lagrange second-order polynomial elements are supported"; |
| 52 } |
51 } |
| 53 if (cell_num_entities(mesh::CellType::triangle, 0) != 3) { |
52 if (cell_num_entities(dolfinx::mesh::CellType::triangle, 0) != 3) { |
| 54 throw "A triangle should have three vertices"; |
53 throw "A triangle should have three vertices"; |
| 55 } |
54 } |
| 56 |
55 |
| 57 // Check that we are dealing with a scalar function |
56 // Check that we are dealing with a scalar function |
| 58 if (fp->value_shape().size() != 0) { |
57 if (fp->element()->value_shape().size() != 0) { |
| 59 throw "Only scalar functions are supported, obviously."; |
58 throw "Only scalar functions are supported, obviously."; |
| 60 } |
59 } |
| 61 |
60 |
| 62 // Check that we're in two dimensions |
61 // Check that we're in two dimensions |
| 63 if (topo->dim() != 2 || geom.dim() != 2) { |
62 if (topo->dim() != 2 || geom.dim() != 2) { |
| 65 } |
64 } |
| 66 |
65 |
| 67 // Check that there are no other types of eleemnts |
66 // Check that there are no other types of eleemnts |
| 68 auto entity_types = topo->entity_types(2); |
67 auto entity_types = topo->entity_types(2); |
| 69 for (auto& t : entity_types) { |
68 for (auto& t : entity_types) { |
| 70 if (t != mesh::CellType::triangle) { |
69 if (t != dolfinx::mesh::CellType::triangle) { |
| 71 throw "Only triangular meshes are supported"; |
70 throw "Only triangular meshes are supported"; |
| 72 } |
71 } |
| 73 } |
72 } |
| 74 |
73 |
| 75 auto adj = topo->connectivity(2, 0); |
74 auto adj = topo->connectivity(2, 0); |