19template <
typename T,
typename =
void>
20struct scalar_value_type
27struct scalar_value_type<T, std::void_t<typename T::value_type>>
29 typedef typename T::value_type value_type;
33using scalar_value_type_t =
typename scalar_value_type<T>::value_type;
42 contravariantPiola = 3,
43 doubleCovariantPiola = 4,
44 doubleContravariantPiola = 5,
48template <
typename O,
typename P,
typename Q,
typename R>
49void l2_piola(O&& r,
const P& U,
const Q& ,
double detJ,
const R& )
51 assert(U.extent(0) == r.extent(0));
52 assert(U.extent(1) == r.extent(1));
53 for (std::size_t i = 0; i < U.extent(0); ++i)
54 for (std::size_t j = 0; j < U.extent(1); ++j)
55 r(i, j) = U(i, j) / detJ;
59template <
typename O,
typename P,
typename Q,
typename R>
63 using T =
typename std::decay_t<O>::value_type;
64 using Z =
typename impl::scalar_value_type_t<T>;
65 for (std::size_t p = 0; p < U.extent(0); ++p)
68 for (std::size_t i = 0; i < r.extent(1); ++i)
71 for (std::size_t k = 0; k < K.extent(0); ++k)
72 acc +=
static_cast<Z
>(K(k, i)) * U(p, k);
79template <
typename O,
typename P,
typename Q,
typename R>
83 using T =
typename std::decay_t<O>::value_type;
84 using Z =
typename impl::scalar_value_type_t<T>;
85 for (std::size_t p = 0; p < U.extent(0); ++p)
87 for (std::size_t i = 0; i < r.extent(1); ++i)
90 for (std::size_t k = 0; k < J.extent(1); ++k)
91 acc +=
static_cast<Z
>(J(i, k)) * U(p, k);
96 std::transform(r.data_handle(), r.data_handle() + r.size(), r.data_handle(),
97 [detJ](
auto ri) { return ri / static_cast<Z>(detJ); });
101template <
typename O,
typename P,
typename Q,
typename R>
106 = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE;
107 using T =
typename std::decay_t<O>::value_type;
108 using Z =
typename impl::scalar_value_type_t<T>;
109 for (std::size_t p = 0; p < U.extent(0); ++p)
111 MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<
112 const T, MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<std::size_t, 2>>
113 _U(U.data_handle() + p * U.extent(1), J.extent(1), J.extent(1));
114 MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<
115 T, MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<std::size_t, 2>>
116 _r(r.data_handle() + p * r.extent(1), K.extent(1), K.extent(1));
118 for (std::size_t i = 0; i < _r.extent(0); ++i)
120 for (std::size_t j = 0; j < _r.extent(1); ++j)
123 for (std::size_t k = 0; k < K.extent(0); ++k)
124 for (std::size_t l = 0; l < _U.extent(1); ++l)
125 acc +=
static_cast<Z
>(K(k, i)) * _U(k, l) *
static_cast<Z
>(K(l, j));
133template <
typename O,
typename P,
typename Q,
typename R>
138 = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE;
139 using T =
typename std::decay_t<O>::value_type;
140 using Z =
typename impl::scalar_value_type_t<T>;
141 for (std::size_t p = 0; p < U.extent(0); ++p)
143 MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<
144 const T, MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<std::size_t, 2>>
145 _U(U.data_handle() + p * U.extent(1), J.extent(1), J.extent(1));
146 MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<
147 T, MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<std::size_t, 2>>
148 _r(r.data_handle() + p * r.extent(1), J.extent(0), J.extent(0));
151 for (std::size_t i = 0; i < _r.extent(0); ++i)
153 for (std::size_t j = 0; j < _r.extent(1); ++j)
156 for (std::size_t k = 0; k < J.extent(1); ++k)
157 for (std::size_t l = 0; l < _U.extent(1); ++l)
158 acc +=
static_cast<Z
>(J(i, k)) * _U(k, l) *
static_cast<Z
>(J(j, l));
164 std::transform(r.data_handle(), r.data_handle() + r.size(), r.data_handle(),
165 [detJ](
auto ri) { return ri / static_cast<Z>(detJ * detJ); });
Information about finite element maps.
Definition: maps.h:13
void l2_piola(O &&r, const P &U, const Q &, double detJ, const R &)
L2 Piola map.
Definition: maps.h:49
void covariant_piola(O &&r, const P &U, const Q &, double, const R &K)
Covariant Piola map.
Definition: maps.h:60
void contravariant_piola(O &&r, const P &U, const Q &J, double detJ, const R &)
Contravariant Piola map.
Definition: maps.h:80
void double_contravariant_piola(O &&r, const P &U, const Q &J, double detJ, const R &)
Double contravariant Piola map.
Definition: maps.h:134
void double_covariant_piola(O &&r, const P &U, const Q &J, double, const R &K)
Double covariant Piola map.
Definition: maps.h:102
type
Map type.
Definition: maps.h:38