Skip to content

Commit

Permalink
Add iso element on hexahedron (#684)
Browse files Browse the repository at this point in the history
* Added iso element on hexahedron

* update README

* avoid segfaults

* fixes
  • Loading branch information
mscroggs authored Aug 15, 2023
1 parent f3fed3d commit 482741c
Show file tree
Hide file tree
Showing 6 changed files with 405 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ The following elements are supported on a hexahedron:
- [Bubble](https://defelement.com/elements/bubble.html)
- [DPC](https://defelement.com/elements/dpc.html)
- [Serendipity](https://defelement.com/elements/serendipity.html)
- [iso](https://defelement.com/elements/p1-iso-p2.html)


### Prism
Expand Down
9 changes: 5 additions & 4 deletions cpp/basix/e-lagrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ create_d_iso(cell::type celltype, int degree, element::lagrange_variant variant,
_M(i, 0, i, 0) = 1.0;

return FiniteElement(
element::family::P, celltype, polyset::type::macroedge, degree, {},
element::family::iso, celltype, polyset::type::macroedge, degree, {},
impl::mdspan_t<const T, 2>(math::eye<T>(ndofs).data(), ndofs, ndofs),
impl::to_mdspan(x), impl::to_mdspan(M), 0, maps::type::identity,
sobolev::space::L2, true, degree, degree, variant,
Expand Down Expand Up @@ -1434,10 +1434,11 @@ FiniteElement<T> basix::element::create_iso(cell::type celltype, int degree,
lagrange_variant variant,
bool discontinuous)
{
if (celltype != cell::type::interval && celltype != cell::type::quadrilateral)
if (celltype != cell::type::interval && celltype != cell::type::quadrilateral
&& celltype != cell::type::hexahedron)
{
throw std::runtime_error("Can currently only create iso elements on "
"intervals and quadrilaterals");
"intervals, quadrilaterals, and hexahedra");
}

if (variant == lagrange_variant::unset)
Expand Down Expand Up @@ -1575,7 +1576,7 @@ FiniteElement<T> basix::element::create_iso(cell::type celltype, int degree,
auto tensor_factors
= create_tensor_product_factors<T>(celltype, degree, variant);
return FiniteElement<T>(
family::P, celltype, polyset::type::macroedge, degree, {},
family::iso, celltype, polyset::type::macroedge, degree, {},
impl::mdspan_t<T, 2>(math::eye<T>(ndofs).data(), ndofs, ndofs), xview,
Mview, 0, maps::type::identity, space, discontinuous, degree, degree,
variant, dpc_variant::unset, tensor_factors);
Expand Down
Loading

0 comments on commit 482741c

Please sign in to comment.