8#include "element-families.h"
12#include "precompute.h"
13#include "sobolev-spaces.h"
32template <
typename T, std::
size_t d>
33using mdspan_t = md::mdspan<T, md::dextents<std::size_t, d>>;
34template <
typename T, std::
size_t d>
36 = md::MDSPAN_IMPL_PROPOSED_NAMESPACE::mdarray<T,
37 md::dextents<std::size_t, d>>;
42std::array<std::vector<mdspan_t<const T, 2>>, 4>
43to_mdspan(std::array<std::vector<mdarray_t<T, 2>>, 4>& x)
45 std::array<std::vector<mdspan_t<const T, 2>>, 4> x1;
46 for (std::size_t i = 0; i < x.size(); ++i)
47 for (std::size_t j = 0; j < x[i].size(); ++j)
48 x1[i].emplace_back(x[i][j].data(), x[i][j].extents());
56std::array<std::vector<mdspan_t<const T, 4>>, 4>
57to_mdspan(std::array<std::vector<mdarray_t<T, 4>>, 4>& M)
59 std::array<std::vector<mdspan_t<const T, 4>>, 4> M1;
60 for (std::size_t i = 0; i < M.size(); ++i)
61 for (std::size_t j = 0; j < M[i].size(); ++j)
62 M1[i].emplace_back(M[i][j].data(), M[i][j].extents());
70std::array<std::vector<mdspan_t<const T, 2>>, 4>
71to_mdspan(
const std::array<std::vector<std::vector<T>>, 4>& x,
72 const std::array<std::vector<std::array<std::size_t, 2>>, 4>& shape)
74 std::array<std::vector<mdspan_t<const T, 2>>, 4> x1;
75 for (std::size_t i = 0; i < x.size(); ++i)
76 for (std::size_t j = 0; j < x[i].size(); ++j)
77 x1[i].push_back(mdspan_t<const T, 2>(x[i][j].data(), shape[i][j]));
85std::array<std::vector<mdspan_t<const T, 4>>, 4>
86to_mdspan(
const std::array<std::vector<std::vector<T>>, 4>& M,
87 const std::array<std::vector<std::array<std::size_t, 4>>, 4>& shape)
89 std::array<std::vector<mdspan_t<const T, 4>>, 4> M1;
90 for (std::size_t i = 0; i < M.size(); ++i)
91 for (std::size_t j = 0; j < M[i].size(); ++j)
92 M1[i].push_back(mdspan_t<const T, 4>(M[i][j].data(), shape[i][j]));
102template <
typename T, std::
size_t d>
120template <std::
floating_po
int T>
121std::tuple<std::array<std::vector<std::vector<T>>, 4>,
122 std::array<std::vector<std::array<std::size_t, 2>>, 4>,
123 std::array<std::vector<std::vector<T>>, 4>,
124 std::array<std::vector<std::array<std::size_t, 4>>, 4>>
136template <std::
floating_po
int F>
139 template <
typename T, std::
size_t d>
140 using mdspan_t = md::mdspan<T, md::dextents<std::size_t, d>>;
353 std::size_t
hash()
const;
368 for (std::size_t
i = 1;
i <=
nd; ++
i)
370 for (std::size_t
i = 1;
i <=
nd; ++
i)
372 std::size_t
vs = std::accumulate(_value_shape.begin(), _value_shape.end(),
373 std::size_t{1}, std::multiplies{});
374 std::size_t
ndofs = _coeffs.second[0];
399 std::pair<std::vector<F>, std::array<std::size_t, 4>>
400 tabulate(
int nd, impl::mdspan_t<const F, 2>
x)
const;
425 std::pair<std::vector<F>, std::array<std::size_t, 4>>
427 std::array<std::size_t, 2>
shape)
const;
454 void tabulate(
int nd, impl::mdspan_t<const F, 2>
x,
483 std::span<F>
basis)
const;
513 const std::vector<std::size_t>&
value_shape()
const {
return _value_shape; }
519 int dim()
const {
return _coeffs.second[0]; }
529 return _lagrange_variant;
554 return _dof_transformations_are_permutations;
560 return _dof_transformations_are_identity;
577 std::pair<std::vector<F>, std::array<std::size_t, 3>>
578 push_forward(impl::mdspan_t<const F, 3>
U, impl::mdspan_t<const F, 3>
J,
579 std::span<const F>
detJ, impl::mdspan_t<const F, 3>
K)
const;
592 std::pair<std::vector<F>, std::array<std::size_t, 3>>
593 pull_back(impl::mdspan_t<const F, 3>
u, impl::mdspan_t<const F, 3>
J,
594 std::span<const F>
detJ, impl::mdspan_t<const F, 3>
K)
const;
627 template <
typename O,
typename P,
typename Q,
typename R>
632 case maps::type::identity:
633 return [](
O&
u,
const P&
U,
const Q&,
F,
const R&)
637 for (std::size_t
i = 0;
i <
U.extent(0); ++
i)
638 for (std::size_t
j = 0;
j <
U.extent(1); ++
j)
641 case maps::type::covariantPiola:
642 return [](
O&
u,
const P&
U,
const Q&
J,
F detJ,
const R&
K)
644 case maps::type::contravariantPiola:
645 return [](
O&
u,
const P&
U,
const Q&
J,
F detJ,
const R&
K)
647 case maps::type::doubleCovariantPiola:
648 return [](
O&
u,
const P&
U,
const Q&
J,
F detJ,
const R&
K)
650 case maps::type::doubleContravariantPiola:
651 return [](
O&
u,
const P&
U,
const Q&
J,
F detJ,
const R&
K)
654 throw std::runtime_error(
"Map not implemented");
665 const std::vector<std::vector<std::vector<int>>>&
entity_dofs()
const
681 return _e_closure_dofs;
765 std::pair<std::vector<F>, std::array<std::size_t, 3>>
772 const std::map<cell::type, std::pair<std::vector<F>, std::array<std::size_t, 3>>>&
775 return _entity_transformations;
802 if (!_dof_transformations_are_permutations)
804 throw std::runtime_error(
805 "The DOF transformations for this element are not permutations");
808 if (_dof_transformations_are_identity)
833 if (!_dof_transformations_are_permutations)
835 throw std::runtime_error(
836 "The DOF transformations for this element are not permutations");
839 if (_dof_transformations_are_identity)
866 int face_start = _cell_tdim == 3 ? 3 * _edofs[2].size() : 0;
880 throw std::runtime_error(
"Unsupported cell dimension");
904 int face_start = _cell_tdim == 3 ? 3 * _edofs[2].size() : 0;
918 throw std::runtime_error(
"Unsupported cell dimension");
942 if (!_dof_transformations_are_permutations)
944 throw std::runtime_error(
945 "The DOF transformations for this element are not permutations");
977 throw std::runtime_error(
978 "Invalid dimension for permute_subentity_closure");
997 if (!_dof_transformations_are_permutations)
999 throw std::runtime_error(
1000 "The DOF transformations for this element are not permutations");
1032 throw std::runtime_error(
1033 "Invalid dimension for permute_subentity_closure");
1067 template <
typename T>
1080 template <
typename T>
1094 template <
typename T>
1107 template <
typename T>
1120 template <
typename T>
1132 template <
typename T>
1145 template <
typename T>
1158 template <
typename T>
1167 const std::pair<std::vector<F>, std::array<std::size_t, 2>>&
points()
const
1223 const std::pair<std::vector<F>, std::array<std::size_t, 2>>&
1234 const std::pair<std::vector<F>, std::array<std::size_t, 2>>&
1237 return _dual_matrix;
1276 const std::pair<std::vector<F>, std::array<std::size_t, 2>>&
wcoeffs()
const
1286 std::vector<std::pair<std::vector<F>, std::array<std::size_t, 2>>>, 4>&
1329 std::vector<std::pair<std::vector<F>, std::array<std::size_t, 4>>>, 4>&
1342 const std::pair<std::vector<F>, std::array<std::size_t, 2>>&
1360 return !_tensor_factors.empty();
1375 std::vector<std::vector<FiniteElement<F>>>
1379 throw std::runtime_error(
"Element has no tensor product representation.");
1380 return _tensor_factors;
1406 template <
typename T,
bool post>
1409 const std::map<
cell::type, std::vector<std::vector<std::size_t>>>&
eperm)
1412 using array2_t = std::pair<std::vector<F>, std::array<std::size_t, 2>>;
1413 using array3_t = std::pair<std::vector<F>, std::array<std::size_t, 3>>;
1415 = std::vector<std::pair<std::vector<std::size_t>, array2_t>>;
1423 template <
typename T,
bool post,
typename OP>
1426 const std::map<cell::type, trans_data_t>&
etrans,
OP op)
const;
1435 std::size_t _cell_tdim;
1438 std::vector<std::vector<cell::type>> _cell_subentity_types;
1453 int _interpolation_nderivs;
1456 int _embedded_superdegree;
1459 int _embedded_subdegree;
1462 std::vector<std::size_t> _value_shape;
1475 std::pair<std::vector<F>, std::array<std::size_t, 2>> _coeffs;
1478 std::vector<std::vector<std::vector<int>>> _edofs;
1481 std::vector<std::vector<std::vector<int>>> _e_closure_dofs;
1484 std::map<cell::type, array3_t> _entity_transformations;
1491 std::pair<std::vector<F>, std::array<std::size_t, 2>> _points;
1495 std::array<std::vector<std::pair<std::vector<F>, std::array<std::size_t, 2>>>,
1500 std::pair<std::vector<F>, std::array<std::size_t, 2>> _matM;
1504 bool _dof_transformations_are_permutations;
1507 bool _dof_transformations_are_identity;
1512 std::map<cell::type, std::vector<std::vector<std::size_t>>> _eperm;
1517 std::map<cell::type, std::vector<std::vector<std::size_t>>> _eperm_inv;
1520 std::map<cell::type, trans_data_t> _etrans;
1523 std::map<cell::type, trans_data_t> _etransT;
1526 std::map<cell::type, trans_data_t> _etrans_inv;
1529 std::map<cell::type, trans_data_t> _etrans_invT;
1533 std::map<cell::type, std::vector<std::vector<std::size_t>>>
1534 _subentity_closure_perm;
1538 std::map<cell::type, std::vector<std::vector<std::size_t>>>
1539 _subentity_closure_perm_inv;
1543 bool _discontinuous;
1546 std::pair<std::vector<F>, std::array<std::size_t, 2>> _dual_matrix;
1554 std::vector<int> _dof_ordering;
1561 std::vector<std::vector<FiniteElement>> _tensor_factors;
1564 bool _interpolation_is_identity;
1568 std::pair<std::vector<F>, std::array<std::size_t, 2>> _wcoeffs;
1572 = std::vector<std::pair<std::vector<F>, std::array<std::size_t, 4>>>;
1573 std::array<array4_t, 4> _M;
1602template <std::
floating_po
int T>
1604 cell::type cell_type,
const std::vector<std::size_t>& value_shape,
1605 impl::mdspan_t<const T, 2> wcoeffs,
1606 const std::array<std::vector<impl::mdspan_t<const T, 2>>, 4>& x,
1607 const std::array<std::vector<impl::mdspan_t<const T, 4>>, 4>& M,
1608 int interpolation_nderivs,
maps::type map_type,
1609 sobolev::space sobolev_space,
bool discontinuous,
int embedded_subdegree,
1623template <std::
floating_po
int T>
1628 std::vector<int> dof_ordering = {});
1642std::optional<std::vector<int>>
1660 bool discontinuous);
1675template <std::
floating_po
int T>
1676std::optional<std::vector<std::vector<FiniteElement<T>>>>
1679 bool discontinuous,
const std::vector<int>& dof_ordering);
1692template <std::
floating_po
int T>
1703template <std::
floating_po
int F>
1704template <
typename T,
bool post>
1705void FiniteElement<F>::permute_data(
1706 std::span<T> data,
int block_size, std::uint32_t cell_info,
1707 const std::map<
cell::type, std::vector<std::vector<std::size_t>>>& eperm)
1710 if (_cell_tdim >= 2)
1714 int face_start = _cell_tdim == 3 ? 3 * _edofs[2].size() : 0;
1718 auto& trans = eperm.at(cell::type::interval)[0];
1719 for (std::size_t e = 0; e < _edofs[1].size(); ++e)
1722 if (cell_info >> (face_start + e) & 1)
1730 if (_cell_tdim == 3)
1733 for (std::size_t f = 0; f < _edofs[2].size(); ++f)
1735 auto& trans = eperm.at(_cell_subentity_types[2][f]);
1738 if (!post and cell_info >> (3 * f) & 1)
1745 for (std::uint32_t r = 0; r < (cell_info >> (3 * f + 1) & 3); ++r)
1752 if (post and cell_info >> (3 * f) & 1)
1762template <std::
floating_po
int F>
1763template <
typename T,
bool post,
typename OP>
1764void FiniteElement<F>::transform_data(
1765 std::span<T> data,
int block_size, std::uint32_t cell_info,
1766 const std::map<cell::type, trans_data_t>& etrans, OP op)
const
1768 if (_cell_tdim >= 2)
1772 int face_start = _cell_tdim == 3 ? 3 * _edofs[2].size() : 0;
1774 for (
auto& edofs0 : _edofs[0])
1775 dofstart += edofs0.size();
1779 auto& [v_size_t, matrix] = etrans.at(cell::type::interval)[0];
1780 for (std::size_t e = 0; e < _edofs[1].size(); ++e)
1783 if (cell_info >> (face_start + e) & 1)
1785 op(std::span(v_size_t),
1786 mdspan_t<const F, 2>(matrix.first.data(), matrix.second), data,
1787 dofstart, block_size);
1789 dofstart += _edofs[1][e].size();
1793 if (_cell_tdim == 3)
1796 for (std::size_t f = 0; f < _edofs[2].size(); ++f)
1798 auto& trans = etrans.at(_cell_subentity_types[2][f]);
1801 if (!post and cell_info >> (3 * f) & 1)
1803 const auto& m = trans[1];
1804 const auto& v_size_t = std::get<0>(m);
1805 const auto& matrix = std::get<1>(m);
1806 op(std::span(v_size_t),
1807 mdspan_t<const F, 2>(matrix.first.data(), matrix.second), data,
1808 dofstart, block_size);
1812 for (std::uint32_t r = 0; r < (cell_info >> (3 * f + 1) & 3); ++r)
1814 const auto& m = trans[0];
1815 const auto& v_size_t = std::get<0>(m);
1816 const auto& matrix = std::get<1>(m);
1817 op(std::span(v_size_t),
1818 mdspan_t<const F, 2>(matrix.first.data(), matrix.second), data,
1819 dofstart, block_size);
1823 if (post and cell_info >> (3 * f) & 1)
1825 const auto& m = trans[1];
1826 const auto& v_size_t = std::get<0>(m);
1827 const auto& matrix = std::get<1>(m);
1828 op(std::span(v_size_t),
1829 mdspan_t<const F, 2>(matrix.first.data(), matrix.second), data,
1830 dofstart, block_size);
1833 dofstart += _edofs[2][f].size();
1839template <std::
floating_po
int F>
1840template <
typename T>
1844 if (_dof_transformations_are_identity)
1847 if (_dof_transformations_are_permutations)
1852 precompute::apply_matrix<F, T>);
1856template <std::
floating_po
int F>
1857template <
typename T>
1861 if (_dof_transformations_are_identity)
1863 else if (_dof_transformations_are_permutations)
1868 precompute::apply_matrix<F, T>);
1872template <std::
floating_po
int F>
1873template <
typename T>
1877 if (_dof_transformations_are_identity)
1879 else if (_dof_transformations_are_permutations)
1884 precompute::apply_matrix<F, T>);
1888template <std::
floating_po
int F>
1889template <
typename T>
1893 if (_dof_transformations_are_identity)
1895 else if (_dof_transformations_are_permutations)
1900 precompute::apply_matrix<F, T>);
1904template <std::
floating_po
int F>
1905template <
typename T>
1909 if (_dof_transformations_are_identity)
1911 else if (_dof_transformations_are_permutations)
1914 const int step =
u.size() /
n;
1915 for (
int i = 0;
i <
n; ++
i)
1924 precompute::apply_tranpose_matrix_right<F, T>);
1928template <std::
floating_po
int F>
1929template <
typename T>
1933 if (_dof_transformations_are_identity)
1935 else if (_dof_transformations_are_permutations)
1938 const int step =
u.size() /
n;
1939 for (
int i = 0;
i <
n; ++
i)
1948 precompute::apply_tranpose_matrix_right<F, T>);
1952template <std::
floating_po
int F>
1953template <
typename T>
1957 if (_dof_transformations_are_identity)
1959 else if (_dof_transformations_are_permutations)
1962 const int step =
u.size() /
n;
1963 for (
int i = 0;
i <
n; ++
i)
1972 precompute::apply_tranpose_matrix_right<F, T>);
1976template <std::
floating_po
int F>
1977template <
typename T>
1981 if (_dof_transformations_are_identity)
1983 else if (_dof_transformations_are_permutations)
1986 const int step =
u.size() /
n;
1987 for (
int i = 0;
i <
n; ++
i)
1996 precompute::apply_tranpose_matrix_right<F, T>);
A finite element.
Definition finite-element.h:138
FiniteElement(element::family family, cell::type cell_type, polyset::type poly_type, int degree, const std::vector< std::size_t > &value_shape, mdspan_t< const F, 2 > wcoeffs, const std::array< std::vector< mdspan_t< const F, 2 > >, 4 > &x, const std::array< std::vector< mdspan_t< const F, 4 > >, 4 > &M, int interpolation_nderivs, maps::type map_type, sobolev::space sobolev_space, bool discontinuous, int embedded_subdegree, int embedded_superdegree, element::lagrange_variant lvariant, element::dpc_variant dvariant, std::vector< int > dof_ordering={})
Construct a finite element.
const std::array< std::vector< std::pair< std::vector< F >, std::array< std::size_t, 4 > > >, 4 > & M() const
Get the interpolation matrices for each subentity.
Definition finite-element.h:1330
void Tinv_apply_right(std::span< T > u, int n, std::uint32_t cell_info) const
Right(post)-apply the inverse of the operator applied by T_apply().
Definition finite-element.h:1930
std::pair< std::vector< F >, std::array< std::size_t, 3 > > base_transformations() const
Get the base transformations.
Definition finite-element.cpp:1904
void T_apply(std::span< T > u, int n, std::uint32_t cell_info) const
Transform basis functions from the reference element ordering and orientation to the globally consist...
Definition finite-element.h:1841
void Tt_apply(std::span< T > u, int n, std::uint32_t cell_info) const
Apply the transpose of the operator applied by T_apply().
Definition finite-element.h:1858
void permute_subentity_closure_inv(std::span< std::int32_t > d, std::uint32_t cell_info, cell::type entity_type, int entity_index) const
Perform the inverse of the operation applied by permute_subentity_closure().
Definition finite-element.h:897
bool dof_transformations_are_identity() const
Indicates is the dof transformations are all the identity.
Definition finite-element.h:558
bool operator==(const FiniteElement &e) const
Check if two elements are the same.
Definition finite-element.cpp:1728
const std::vector< int > & dof_ordering() const
Get the mapping from the reference-element DOF ordering to the custom DOF ordering supplied at constr...
Definition finite-element.h:1397
void permute_subentity_closure_inv(std::span< std::int32_t > d, std::uint32_t entity_info, cell::type entity_type) const
Perform the inverse of the operation applied by permute_subentity_closure().
Definition finite-element.h:993
int embedded_subdegree() const
Highest degree n such that a Lagrange (or vector Lagrange) element of degree n is a subspace of this ...
Definition finite-element.h:506
const std::vector< std::vector< std::vector< int > > > & entity_dofs() const
Get the dofs on each topological entity: (vertices, edges, faces, cell) in that order.
Definition finite-element.h:665
void T_apply_right(std::span< T > u, int n, std::uint32_t cell_info) const
Right(post)-apply the operator applied by T_apply().
Definition finite-element.h:1954
FiniteElement(FiniteElement &&element)=default
Move constructor.
bool has_tensor_product_factorisation() const
Indicates whether or not this element can be represented as a product of elements defined on lower-di...
Definition finite-element.h:1358
int interpolation_nderivs() const
The number of derivatives needed when interpolating.
Definition finite-element.h:1390
std::pair< std::vector< F >, std::array< std::size_t, 4 > > tabulate(int nd, impl::mdspan_t< const F, 2 > x) const
Compute basis values and derivatives at set of points.
Definition finite-element.cpp:1814
int embedded_superdegree() const
Lowest degree n such that this element's polynomial set is a subspace of a Lagrange (or vector Lagran...
Definition finite-element.h:501
int dim() const
Dimension of the finite element space.
Definition finite-element.h:519
void permute(std::span< std::int32_t > d, std::uint32_t cell_info) const
Permute indices associated with degree-of-freedoms on the reference element ordering to the globally ...
Definition finite-element.h:800
std::size_t hash() const
Get a unique hash of this element.
Definition finite-element.cpp:1767
void permute_inv(std::span< std::int32_t > d, std::uint32_t cell_info) const
Perform the inverse of the operation applied by permute().
Definition finite-element.h:831
void Tt_apply_right(std::span< T > u, int n, std::uint32_t cell_info) const
Right(post)-apply the transpose of the operator applied by T_apply().
Definition finite-element.h:1906
const std::vector< std::size_t > & value_shape() const
Element value tensor shape.
Definition finite-element.h:513
void Tt_inv_apply(std::span< T > u, int n, std::uint32_t cell_info) const
Apply the inverse transpose of the operator applied by T_apply().
Definition finite-element.h:1874
void permute_subentity_closure(std::span< std::int32_t > d, std::uint32_t cell_info, cell::type entity_type, int entity_index) const
Permute indices associated with degree-of-freedoms on the closure of a sub-entity of the reference el...
Definition finite-element.h:860
element::lagrange_variant lagrange_variant() const
Lagrange variant of the element.
Definition finite-element.h:527
void Tt_inv_apply_right(std::span< T > u, int n, std::uint32_t cell_info) const
Right(post)-apply the transpose inverse of the operator applied by T_apply().
Definition finite-element.h:1978
const std::array< std::vector< std::pair< std::vector< F >, std::array< std::size_t, 2 > > >, 4 > & x() const
Get the interpolation points for each subentity.
Definition finite-element.h:1287
int degree() const
Get the element polynomial degree.
Definition finite-element.h:495
void permute_subentity_closure(std::span< std::int32_t > d, std::uint32_t entity_info, cell::type entity_type) const
Permute indices associated with degree-of-freedoms on the closure of a sub-entity of the reference el...
Definition finite-element.h:938
void Tinv_apply(std::span< T > u, int n, std::uint32_t cell_info) const
Apply the inverse of the operator applied by T_apply().
Definition finite-element.h:1890
const std::pair< std::vector< F >, std::array< std::size_t, 2 > > & points() const
Return the interpolation points.
Definition finite-element.h:1167
sobolev::space sobolev_space() const
Underlying Sobolev space for this element.
Definition finite-element.h:542
const std::vector< std::vector< std::vector< int > > > & entity_closure_dofs() const
Get the dofs on the closure of each topological entity: (vertices, edges, faces, cell) in that order.
Definition finite-element.h:679
FiniteElement(const FiniteElement &element)=default
Copy constructor.
std::array< std::size_t, 4 > tabulate_shape(std::size_t nd, std::size_t num_points) const
Array shape for tabulate basis values and derivatives at set of points.
Definition finite-element.h:364
FiniteElement & operator=(FiniteElement &&element)=default
Move assignment operator.
const std::map< cell::type, std::pair< std::vector< F >, std::array< std::size_t, 3 > > > & entity_transformations() const
Return the entity dof transformation matrices.
Definition finite-element.h:773
const std::pair< std::vector< F >, std::array< std::size_t, 2 > > & interpolation_matrix() const
Return a matrix of weights interpolation.
Definition finite-element.h:1224
polyset::type polyset_type() const
Get the element polyset type.
Definition finite-element.h:491
const std::pair< std::vector< F >, std::array< std::size_t, 2 > > & wcoeffs() const
Get the coefficients that define the polynomial set in terms of the orthonormal polynomials.
Definition finite-element.h:1276
std::pair< std::vector< F >, std::array< std::size_t, 3 > > pull_back(impl::mdspan_t< const F, 3 > u, impl::mdspan_t< const F, 3 > J, std::span< const F > detJ, impl::mdspan_t< const F, 3 > K) const
Map function values from a physical cell to the reference.
Definition finite-element.cpp:2009
bool dof_transformations_are_permutations() const
Indicates if the degree-of-freedom transformations are all permutations.
Definition finite-element.h:552
std::pair< std::vector< F >, std::array< std::size_t, 3 > > push_forward(impl::mdspan_t< const F, 3 > U, impl::mdspan_t< const F, 3 > J, std::span< const F > detJ, impl::mdspan_t< const F, 3 > K) const
Map function values from the reference to a physical cell.
Definition finite-element.cpp:1973
cell::type cell_type() const
Get the element cell type.
Definition finite-element.h:487
bool interpolation_is_identity() const
Indicates whether or not the interpolation matrix for this element is an identity matrix.
Definition finite-element.h:1387
bool discontinuous() const
Indicates whether this element is the discontinuous variant.
Definition finite-element.h:548
std::vector< std::vector< FiniteElement< F > > > get_tensor_product_representation() const
Get the tensor product representation of this element.
Definition finite-element.h:1376
maps::type map_type() const
Map type for the element.
Definition finite-element.h:538
const std::pair< std::vector< F >, std::array< std::size_t, 2 > > & dual_matrix() const
Get the dual matrix.
Definition finite-element.h:1235
element::dpc_variant dpc_variant() const
DPC variant of the element.
Definition finite-element.h:534
const std::pair< std::vector< F >, std::array< std::size_t, 2 > > & coefficient_matrix() const
Get the matrix of coefficients.
Definition finite-element.h:1343
FiniteElement & operator=(const FiniteElement &element)=default
Assignment operator.
element::family family() const
The finite element family.
Definition finite-element.h:523
~FiniteElement()=default
Destructor.
std::function< void(O &, const P &, const Q &, F, const R &)> map_fn() const
Return a function that performs the appropriate push-forward/pull-back for the element type.
Definition finite-element.h:628
type
Cell type.
Definition cell.h:21
int topological_dimension(cell::type celltype)
Definition cell.cpp:294
std::tuple< std::array< std::vector< std::vector< T > >, 4 >, std::array< std::vector< std::array< std::size_t, 2 > >, 4 >, std::array< std::vector< std::vector< T > >, 4 >, std::array< std::vector< std::array< std::size_t, 4 > >, 4 > > make_discontinuous(const std::array< std::vector< mdspan_t< const T, 2 > >, 4 > &x, const std::array< std::vector< mdspan_t< const T, 4 > >, 4 > &M, std::size_t tdim, std::size_t value_size)
Definition finite-element.cpp:816
lagrange_variant
Variants of a Lagrange space that can be created.
Definition element-families.h:12
impl::mdspan_t< T, d > mdspan_t
Typedef for mdspan.
Definition finite-element.h:103
dpc_variant
Definition element-families.h:32
family
Available element families.
Definition element-families.h:45
void covariant_piola(O &&r, const P &U, const Q &, double, const R &K)
Covariant Piola map.
Definition maps.h:74
void contravariant_piola(O &&r, const P &U, const Q &J, double detJ, const R &)
Contravariant Piola map.
Definition maps.h:101
void double_contravariant_piola(O &&r, const P &U, const Q &J, double detJ, const R &)
Double contravariant Piola map.
Definition maps.h:164
void double_covariant_piola(O &&r, const P &U, const Q &, double, const R &K)
Double covariant Piola map.
Definition maps.h:129
type
Map type.
Definition maps.h:40
type
Polyset (polynomial set) type.
Definition polyset.h:137
void apply_permutation(std::span< const std::size_t > perm, std::span< E > data, std::size_t offset=0, std::size_t n=1)
Apply a (precomputed) permutation .
Definition precompute.h:137
void apply_permutation_mapped(std::span< const std::size_t > perm, std::span< E > data, std::span< const int > emap, std::size_t n=1)
Permutation of mapped data.
Definition precompute.h:153
space
Sobolev space type.
Definition sobolev-spaces.h:13
Basix: FEniCS runtime basis evaluation library.
Definition cell.h:17
FiniteElement< T > create_element(element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous, std::vector< int > dof_ordering={})
Definition finite-element.cpp:192
std::optional< std::vector< std::vector< FiniteElement< T > > > > tp_factors(element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous, const std::vector< int > &dof_ordering)
Definition finite-element.cpp:353
std::string version()
Definition finite-element.cpp:2044
std::vector< int > lex_dof_ordering(element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous)
Definition finite-element.cpp:509
std::optional< std::vector< int > > tp_dof_ordering(element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous)
Definition finite-element.cpp:398
FiniteElement< T > create_custom_element(cell::type cell_type, const std::vector< std::size_t > &value_shape, impl::mdspan_t< const T, 2 > wcoeffs, const std::array< std::vector< impl::mdspan_t< const T, 2 > >, 4 > &x, const std::array< std::vector< impl::mdspan_t< const T, 4 > >, 4 > &M, int interpolation_nderivs, maps::type map_type, sobolev::space sobolev_space, bool discontinuous, int embedded_subdegree, int embedded_superdegree, polyset::type poly_type)
Definition finite-element.cpp:901
FiniteElement< T > create_tp_element(element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous)
Definition finite-element.cpp:329