Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
fe_expr_op.hpp
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2//
3// Copyright (C) 2024 - 2026 by the Vulpes authors.
4// This file is part of Vulpes.
5//
6// Vulpes is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// Vulpes is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Vulpes. If not, see <http://www.gnu.org/licenses/>.
18//
19// ----------------------------------------------------------------------
20
21// Author: Matteo Caldana <matteo.caldana@polimi.it>
22// Author: Pedro Peixoto <ppeixoto@usp.br>
23
24#ifndef VULPES_FE_FE_EXPRESSIONS_FE_EXPR_OP_HPP_
25#define VULPES_FE_FE_EXPRESSIONS_FE_EXPR_OP_HPP_
26
27#include <algorithm>
28#include <stdexcept>
29#include <tuple>
30#include <type_traits>
31#include <utility>
32
35
36namespace vulpes {
37namespace fe {
38
39namespace internal {
40// Helper struct for when FeSpaceType is not void
41template <typename T, typename = void>
43 using type = std::decay_t<decltype(T{0}.getBasis()[0])>;
44};
45
46// Specialization for when FeSpaceType is void
47template <typename T>
48struct PolynomialTypeHelper<T, std::enable_if_t<std::is_same_v<T, void>>> {
49 using type = void;
50};
51} // namespace internal
52
53// While I would like to avoid macros as much as possible this is a lot of
54// boilerplate to copy and paste on each binary expression.
55// Inheritance is out of the possibilities because it is needed to inherit
56// directly from the base class to solve at compile time the `decltype(auto)`
57// with the CRTP
58#define FE_EXPRESSION_BINARY_IMPL(Dim, E1, E2) \
59 public: \
60 static constexpr bool is_leaf = false; \
61 static constexpr uint8_t is_bilinear = E1::is_bilinear | E2::is_bilinear; \
62 static_assert( \
63 std::is_same_v<typename E1::FeSpaceType, void> || \
64 std::is_same_v<typename E2::FeSpaceType, void> || \
65 std::is_same_v<typename E1::FeSpaceType, typename E2::FeSpaceType>); \
66 using FeSpaceType = std::conditional_t< \
67 std::is_same_v<typename E1::FeSpaceType, void>, \
68 typename E2::FeSpaceType, typename E1::FeSpaceType>; \
69 constexpr const auto& feSpace() const { \
70 if constexpr (std::is_same_v<FeSpaceType, void>) { \
71 /* this is always false, see static assert */ \
72 return nullptr; \
73 } else if constexpr (std::is_same_v<typename E1::FeSpaceType, void>) { \
74 return m_v.feSpace(); \
75 } else { \
76 return m_u.feSpace(); \
77 } \
78 } \
79 using PolynomialType = internal::PolynomialTypeHelper<FeSpaceType>::type; \
80 static constexpr std::size_t k_index_begin = \
81 std::min(E1::k_index_begin, E2::k_index_begin); \
82 static constexpr std::size_t k_index_end = \
83 std::max(E1::k_index_end, E2::k_index_end); \
84 constexpr UpdateFlagsType computeUpdateFlags() const { \
85 return m_u.computeUpdateFlags() | m_v.computeUpdateFlags(); \
86 } \
87 constexpr bool precompute( \
88 const FeValues<Dim>& fe_values, const CellsType<Dim>& cells) const { \
89 return m_u.precompute(fe_values, cells) && \
90 m_v.precompute(fe_values, cells); \
91 } \
92 \
93 protected: \
94 typename std::conditional_t<E1::is_leaf, const E1&, const E1> m_u; \
95 typename std::conditional_t<E2::is_leaf, const E2&, const E2> m_v;
96
98
99template <std::size_t Dim, typename E1, typename E2>
101 : public FeExpressionBase<Dim, FeExpressionInner<Dim, E1, E2>> {
103 public:
104 FeExpressionInner(E1 const& u, E2 const& v) : m_u(u), m_v(v) {}
105
106 template <std::size_t J = 0, std::size_t I = 0>
107 decltype(auto) evaluate(
108 const FeValues<Dim>& fe_values,
109 std::size_t j,
110 std::size_t i,
111 std::size_t q) const {
112 using TypeEvalU = decltype(m_u.template evaluate<J, I>(fe_values, j, i, q));
113 using TypeEvalV = decltype(m_v.template evaluate<J, I>(fe_values, j, i, q));
114 if constexpr (
115 std::is_same_v<TypeEvalU, void> || std::is_same_v<TypeEvalV, void>) {
116 return void();
117 } else if constexpr (
118 std::is_arithmetic_v<std::decay_t<TypeEvalU>> &&
119 std::is_arithmetic_v<std::decay_t<TypeEvalV>>) {
120 return m_u.template evaluate<J, I>(fe_values, j, i, q) *
121 m_v.template evaluate<J, I>(fe_values, j, i, q);
122 } else {
123 return m_u.template evaluate<J, I>(fe_values, j, i, q)
124 .cwiseProduct(m_v.template evaluate<J, I>(fe_values, j, i, q))
125 .sum();
126 }
127 }
128
129 constexpr std::size_t computeOrder() const {
130 return m_u.computeOrder() + m_v.computeOrder();
131 }
132
133 decltype(auto) evaluatePoly(
134 const FeValues<Dim>& fe_values,
135 std::size_t j,
136 std::size_t i,
137 std::size_t bi,
138 std::size_t bj) const {
139 // TODO: implement general case with different number of cols
140 using TypeU =
141 std::decay_t<decltype(m_u.evaluatePoly(fe_values, j, i, bi, bj))>;
142 using TypeV =
143 std::decay_t<decltype(m_v.evaluatePoly(fe_values, j, i, bi, bj))>;
144 if constexpr (std::is_same_v<void, TypeU> && std::is_same_v<void, TypeV>) {
145 // both operands are pure coefficient expressions (e.g. inner(nrm,
146 // const_vec)): the inner product is itself a scalar coefficient; value in
147 // evaluatePolyCoef
148 return void();
149 } else if constexpr (std::is_same_v<void, TypeU>) {
150 const auto pv = m_v.evaluatePoly(fe_values, j, i, bi, bj);
151 if constexpr (std::decay_t<decltype(pv)>::ColsAtCompileTime == 1) {
152 return pv.transpose().eval();
153 } else {
154 return Eigen::Matrix<typename decltype(pv)::Scalar, 1, -1>{
155 pv.reshaped(1, pv.size())};
156 }
157 } else if constexpr (std::is_same_v<void, TypeV>) {
158 const auto pu = m_u.evaluatePoly(fe_values, j, i, bi, bj);
159 if constexpr (std::decay_t<decltype(pu)>::ColsAtCompileTime == 1) {
160 return pu.transpose().eval();
161 } else {
162 return Eigen::Matrix<typename decltype(pu)::Scalar, 1, -1>{
163 pu.reshaped(1, pu.size())};
164 }
165 } else {
166 const auto [pu, pv] = internal::lift_to_same_space(
167 m_u.evaluatePoly(fe_values, j, i, bi, bj),
168 m_v.evaluatePoly(fe_values, j, i, bi, bj));
169 using PolyLiftedType = decltype(pu)::Scalar;
170 // on different rows we have different spatial components
171 // on different cols we have different sum components of the final result
172 // e.g. if we have u * v + inner(grad(u), grad(v))
173 // the u * v and inner(grad(u), grad(v)) have different transformation
174 // when mapping the integral from the reference element to the physical
175 // space, thus, we keep each different addend of the sum on different cols
176 assert(pu.rows() == pv.rows());
177 if ((pu.cols() == pv.cols()) && (pu.cols() == 1)) {
178 return Eigen::Matrix<PolyLiftedType, 1, -1>{
179 pu.cwiseProduct(pv).reshaped()};
180 } else {
181 // for ex. this is the case of inner(sigma * grad(u), grad(v))
182 // where sigma is a dim x dim tensor
183 return Eigen::Matrix<PolyLiftedType, 1, -1>{
184 internal::cartesian_hcat(pu, pv).reshaped()};
185 }
186 }
187 }
188
189 decltype(auto) evaluatePolyCoef(
190 const auto& mapping,
191 const auto& fe_values,
192 std::size_t bi,
193 std::size_t bj) const {
194 // determine whether each operand has a polynomial component
195 using TypeU = std::decay_t<decltype(m_u.evaluatePoly(
196 std::declval<const FeValues<Dim>&>(), std::declval<std::size_t>(),
197 std::declval<std::size_t>(), std::declval<std::size_t>(),
198 std::declval<std::size_t>()))>;
199 using TypeV = std::decay_t<decltype(m_v.evaluatePoly(
200 std::declval<const FeValues<Dim>&>(), std::declval<std::size_t>(),
201 std::declval<std::size_t>(), std::declval<std::size_t>(),
202 std::declval<std::size_t>()))>;
203 const auto cu = m_u.evaluatePolyCoef(mapping, fe_values, bi, bj);
204 const auto cv = m_v.evaluatePolyCoef(mapping, fe_values, bi, bj);
205 if constexpr (std::is_same_v<void, TypeU> && std::is_same_v<void, TypeV>) {
206 // both operands are pure coefficients: compute the actual inner product
207 // as a scalar, e.g. inner([nx, ny], [1, 0]) = nx*1 + ny*0 = nx
208 Eigen::Matrix<double, 1, 1> res;
209 res(0, 0) = (cu.array() * cv.array()).sum();
210 return res;
211 } else {
212 assert(cu.rows() == cv.rows());
213 if ((cu.cols() == cv.cols()) && (cu.cols() == 1)) {
214 return Eigen::Matrix<double, 1, -1>{(cu.cwiseProduct(cv)).transpose()};
215 } else {
216 return Eigen::Matrix<double, 1, -1>{
217 internal::cartesian_hcat(cu, cv).reshaped()};
218 }
219 }
220 }
221};
222
223template <std::size_t Dim, typename FeExpressionU, typename FeExpressionV>
228 *static_cast<const FeExpressionU*>(&u),
229 *static_cast<const FeExpressionV*>(&v));
230}
231
233
234template <std::size_t Dim, typename E1, typename E2>
236 : public FeExpressionBase<Dim, FeExpressionOuter<Dim, E1, E2>> {
238 public:
239 FeExpressionOuter(E1 const& u, E2 const& v) : m_u(u), m_v(v) {}
240
241 template <std::size_t J = 0, std::size_t I = 0>
242 decltype(auto) evaluate(
243 const FeValues<Dim>& fe_values,
244 std::size_t j,
245 std::size_t i,
246 std::size_t q) const {
247 using TypeEvalU = decltype(m_u.template evaluate<J, I>(fe_values, j, i, q));
248 using TypeEvalV = decltype(m_v.template evaluate<J, I>(fe_values, j, i, q));
249 if constexpr (
250 std::is_same_v<TypeEvalU, void> || std::is_same_v<TypeEvalV, void>) {
251 return void();
252 } else {
253 return m_u.template evaluate<J, I>(fe_values, j, i, q) *
254 m_v.template evaluate<J, I>(fe_values, j, i, q).transpose();
255 }
256 }
257
258 constexpr std::size_t computeOrder() const {
259 return m_u.computeOrder() + m_v.computeOrder();
260 }
261
262 decltype(auto) evaluatePoly(
263 const FeValues<Dim>& fe_values,
264 std::size_t j,
265 std::size_t i,
266 std::size_t bi,
267 std::size_t bj) const {
268 using TypeU =
269 std::decay_t<decltype(m_u.evaluatePoly(fe_values, j, i, bi, bj))>;
270 using TypeV =
271 std::decay_t<decltype(m_v.evaluatePoly(fe_values, j, i, bi, bj))>;
272 if constexpr (std::is_same_v<void, TypeU>) {
273 const auto pv = m_v.evaluatePoly(fe_values, j, i, bi, bj);
274 const Eigen::Index nrows = pv.rows();
275 using PolyType = typename TypeV::Scalar;
276 Eigen::Matrix<PolyType, -1, -1> result(nrows * nrows, pv.cols());
277 for (Eigen::Index k = 0; k < pv.cols(); ++k) {
278 result.col(k) = pv.col(k).transpose().replicate(nrows, 1).reshaped();
279 }
280 return result;
281 } else if constexpr (std::is_same_v<void, TypeV>) {
282 const auto pu = m_u.evaluatePoly(fe_values, j, i, bi, bj);
283 const Eigen::Index nrows = pu.rows();
284 using PolyType = typename TypeU::Scalar;
285 Eigen::Matrix<PolyType, -1, -1> result(nrows * nrows, pu.cols());
286 for (Eigen::Index k = 0; k < pu.cols(); ++k) {
287 result.col(k) = pu.col(k).replicate(1, nrows).reshaped();
288 }
289 return result;
290 } else {
291 const auto [pu, pv] = internal::lift_to_same_space(
292 m_u.evaluatePoly(fe_values, j, i, bi, bj),
293 m_v.evaluatePoly(fe_values, j, i, bi, bj));
294 assert(pu.rows() == pv.rows());
295 const Eigen::Index nrows = pu.rows();
296 using PolyLiftType = decltype(pu)::Scalar;
297 Eigen::Matrix<PolyLiftType, -1, -1> result(
298 nrows * nrows, pu.cols() * pv.cols());
299 Eigen::Index idx = 0;
300 for (Eigen::Index ki = 0; ki < pu.cols(); ++ki) {
301 for (Eigen::Index kj = 0; kj < pv.cols(); ++kj) {
302 result.col(idx++) = (pu.col(ki) * pv.col(kj).transpose()).reshaped();
303 }
304 }
305 return result;
306 }
307 }
308
309 decltype(auto) evaluatePolyCoef(
310 const auto& mapping,
311 const auto& fe_values,
312 std::size_t bi,
313 std::size_t bj) const {
314 const auto cu = m_u.evaluatePolyCoef(mapping, fe_values, bi, bj);
315 const auto cv = m_v.evaluatePolyCoef(mapping, fe_values, bi, bj);
316 assert(cu.rows() == cv.rows());
317 const Eigen::Index nrows = cu.rows();
318 Eigen::Matrix<double, -1, -1> result(nrows * nrows, cu.cols() * cv.cols());
319 Eigen::Index idx = 0;
320 for (Eigen::Index i = 0; i < cu.cols(); ++i) {
321 for (Eigen::Index j = 0; j < cv.cols(); ++j) {
322 result.col(idx++) = (cu.col(i) * cv.col(j).transpose()).reshaped();
323 }
324 }
325 return result;
326 }
327};
328
329template <std::size_t Dim, typename FeExpressionU, typename FeExpressionV>
334 *static_cast<const FeExpressionU*>(&u),
335 *static_cast<const FeExpressionV*>(&v));
336}
337
339
340template <std::size_t Dim, typename E1, typename E2>
342 : public FeExpressionBase<Dim, FeExpressionProduct<Dim, E1, E2>> {
344 public:
345 FeExpressionProduct(E1 const& u, E2 const& v) : m_u(u), m_v(v) {}
346
347 template <std::size_t J = 0, std::size_t I = 0>
348 decltype(auto) evaluate(
349 const FeValues<Dim>& fe_values,
350 std::size_t j,
351 std::size_t i,
352 std::size_t q) const {
353 using TypeEvalU = decltype(m_u.template evaluate<J, I>(fe_values, j, i, q));
354 using TypeEvalV = decltype(m_v.template evaluate<J, I>(fe_values, j, i, q));
355 if constexpr (
356 std::is_same_v<TypeEvalU, void> || std::is_same_v<TypeEvalV, void>) {
357 return void();
358 } else {
359 return m_u.template evaluate<J, I>(fe_values, j, i, q) *
360 m_v.template evaluate<J, I>(fe_values, j, i, q);
361 }
362 }
363
364 constexpr std::size_t computeOrder() const {
365 return m_u.computeOrder() + m_v.computeOrder();
366 }
367
368 decltype(auto) evaluatePoly(
369 const FeValues<Dim>& fe_values,
370 std::size_t j,
371 std::size_t i,
372 std::size_t bi,
373 std::size_t bj) const {
374 using TypeU =
375 std::decay_t<decltype(m_u.evaluatePoly(fe_values, j, i, bi, bj))>;
376 using TypeV =
377 std::decay_t<decltype(m_v.evaluatePoly(fe_values, j, i, bi, bj))>;
378 if constexpr (std::is_same_v<void, TypeU>) {
379 // constant * v
380 return m_v.evaluatePoly(fe_values, j, i, bi, bj);
381 } else if constexpr (std::is_same_v<void, TypeV>) {
382 // u * constant
383 return m_u.evaluatePoly(fe_values, j, i, bi, bj);
384 } else {
385 auto [pu, pv] = internal::lift_to_same_space(
386 m_u.evaluatePoly(fe_values, j, i, bi, bj),
387 m_v.evaluatePoly(fe_values, j, i, bi, bj));
388 using LiftedPolyType = decltype(pu)::Scalar;
389 using ResultType = Eigen::Matrix<LiftedPolyType, -1, -1>;
390 if ((pu.rows() == pv.rows()) && (pu.rows() == 1)) {
391 // product between scalars
392 return ResultType{internal::cartesian_hcat(pu, pv)};
393 } else if ((pu.rows() == pv.rows() * pv.rows()) && (pv.rows() > 1)) {
394 // matvec product
395 const Eigen::Index nrows = pv.rows();
396 Eigen::Map<ResultType> rpu(pu.data(), nrows, nrows * pu.cols());
397 assert(rpu.size() == pu.size());
398 // transpose nrows x nrows blocks to simulate mat vec product
399 // indeed the cartesian hcat is a col-by-col prod
400 // while the mat vec is row-by-col prod
401 for (Eigen::Index k = 0; k < pu.cols(); ++k) {
402 rpu.block(0, k * nrows, nrows, nrows).transposeInPlace();
403 }
404 auto tmp = internal::cartesian_hcat(rpu, pv);
405 // transpose nrows x nrows blocks to simulate mat vec product
406 for (Eigen::Index k = 0; k < pu.cols(); ++k) {
407 tmp.block(0, k * nrows, nrows, nrows).transposeInPlace();
408 }
409 return ResultType{tmp};
410 } else {
411 // TODO: implement
412 // - mat mat product
413 // - vec (row) mat product
414 throw std::logic_error(
415 "QFree: matrix-matrix and row vector-matrix products are not "
416 "supported, use the Simplexify integrator");
417 }
418 }
419 }
420
421 decltype(auto) evaluatePolyCoef(
422 const auto& mapping,
423 const auto& fe_values,
424 std::size_t bi,
425 std::size_t bj) const {
426 auto cu = m_u.evaluatePolyCoef(mapping, fe_values, bi, bj);
427 auto cv = m_v.evaluatePolyCoef(mapping, fe_values, bi, bj);
428 if ((cu.rows() == cv.rows()) && (cu.rows() == 1)) {
429 // product between scalars
430 return Eigen::MatrixXd{internal::cartesian_hcat(cu, cv)};
431 } else if ((cu.rows() == cv.rows() * cv.rows()) && (cv.rows() > 1)) {
432 // matvec product
433 const Eigen::Index nrows = cv.rows();
434 using ReshapedTypeU = Eigen::Matrix<double, -1, -1>;
435 Eigen::Map<ReshapedTypeU> rcu(cu.data(), nrows, nrows * cu.cols());
436 assert(rcu.size() == cu.size());
437 // transpose nrows x nrows blocks to simulate mat vec product
438 // indeed the cartesian hcat is a col-by-col prod
439 // while the mat vec is row-by-col prod
440 for (Eigen::Index k = 0; k < cu.cols(); ++k) {
441 rcu.block(0, k * nrows, nrows, nrows).transposeInPlace();
442 }
443 auto tmp = internal::cartesian_hcat(rcu, cv);
444 // transpose nrows x nrows blocks to simulate mat vec product
445 for (Eigen::Index k = 0; k < cu.cols(); ++k) {
446 tmp.block(0, k * nrows, nrows, nrows).transposeInPlace();
447 }
448 return Eigen::MatrixXd{tmp};
449 } else {
450 // TODO: implement
451 // - mat mat product
452 // - vec (row) mat product
453 throw std::logic_error(
454 "QFree: matrix-matrix and row vector-matrix products are not "
455 "supported, use the Simplexify integrator");
456 }
457 }
458};
459
460template <std::size_t Dim, typename FeExpressionU, typename FeExpressionV>
465 *static_cast<const FeExpressionU*>(&u),
466 *static_cast<const FeExpressionV*>(&v));
467}
468
470
471template <std::size_t Dim, typename E1, typename E2>
473 : public FeExpressionBase<Dim, FeExpressionSum<Dim, E1, E2>> {
475 public:
476 FeExpressionSum(E1 const& u, E2 const& v) : m_u(u), m_v(v) {}
477
478 template <std::size_t J = 0, std::size_t I = 0>
479 decltype(auto) evaluate(
480 const FeValues<Dim>& fe_values,
481 std::size_t j,
482 std::size_t i,
483 std::size_t q) const {
484 using TypeEvalU = decltype(m_u.template evaluate<J, I>(fe_values, j, i, q));
485 using TypeEvalV = decltype(m_v.template evaluate<J, I>(fe_values, j, i, q));
486 if constexpr (
487 std::is_same_v<TypeEvalU, void> && std::is_same_v<TypeEvalV, void>) {
488 return void();
489 } else if constexpr (std::is_same_v<TypeEvalU, void>) {
490 return m_v.template evaluate<J, I>(fe_values, j, i, q);
491 } else if constexpr (std::is_same_v<TypeEvalV, void>) {
492 return m_u.template evaluate<J, I>(fe_values, j, i, q);
493 } else {
494 return m_u.template evaluate<J, I>(fe_values, j, i, q) +
495 m_v.template evaluate<J, I>(fe_values, j, i, q);
496 }
497 }
498
499 constexpr std::size_t computeOrder() const {
500 return std::max(m_u.computeOrder(), m_v.computeOrder());
501 }
502
503 decltype(auto) evaluatePoly(
504 const FeValues<Dim>& fe_values,
505 std::size_t j,
506 std::size_t i,
507 std::size_t bi,
508 std::size_t bj) const {
509 return internal::hcat(
510 m_u.evaluatePoly(fe_values, j, i, bi, bj),
511 m_v.evaluatePoly(fe_values, j, i, bi, bj));
512 }
513
514 decltype(auto) evaluatePolyCoef(
515 const auto& mapping,
516 const auto& fe_values,
517 std::size_t bi,
518 std::size_t bj) const {
519 return internal::hcat(
520 m_u.evaluatePolyCoef(mapping, fe_values, bi, bj),
521 m_v.evaluatePolyCoef(mapping, fe_values, bi, bj));
522 }
523};
524
525template <std::size_t Dim, typename FeExpressionU, typename FeExpressionV>
530 *static_cast<const FeExpressionU*>(&u),
531 *static_cast<const FeExpressionV*>(&v));
532}
533
535
536template <std::size_t Dim, typename E1, typename E2>
538 : public FeExpressionBase<Dim, FeExpressionDifference<Dim, E1, E2>> {
540 public:
541 FeExpressionDifference(E1 const& u, E2 const& v) : m_u(u), m_v(v) {}
542
543 template <std::size_t J = 0, std::size_t I = 0>
544 decltype(auto) evaluate(
545 const FeValues<Dim>& fe_values,
546 std::size_t j,
547 std::size_t i,
548 std::size_t q) const {
549 using TypeEvalU = decltype(m_u.template evaluate<J, I>(fe_values, j, i, q));
550 using TypeEvalV = decltype(m_v.template evaluate<J, I>(fe_values, j, i, q));
551 if constexpr (
552 std::is_same_v<TypeEvalU, void> && std::is_same_v<TypeEvalV, void>) {
553 return void();
554 } else if constexpr (std::is_same_v<TypeEvalU, void>) {
555 return -m_v.template evaluate<J, I>(fe_values, j, i, q);
556 } else if constexpr (std::is_same_v<TypeEvalV, void>) {
557 return m_u.template evaluate<J, I>(fe_values, j, i, q);
558 } else {
559 return m_u.template evaluate<J, I>(fe_values, j, i, q) -
560 m_v.template evaluate<J, I>(fe_values, j, i, q);
561 }
562 }
563
564 constexpr std::size_t computeOrder() const {
565 return std::max(m_u.computeOrder(), m_v.computeOrder());
566 }
567
568 decltype(auto) evaluatePoly(
569 const FeValues<Dim>& fe_values,
570 std::size_t j,
571 std::size_t i,
572 std::size_t bi,
573 std::size_t bj) const {
574 // polynomial structure is unchanged by subtraction; negation goes into
575 // evaluatePolyCoef so that SparsePolynomial need not support unary minus
576 return internal::hcat(
577 m_u.evaluatePoly(fe_values, j, i, bi, bj),
578 m_v.evaluatePoly(fe_values, j, i, bi, bj));
579 }
580
581 decltype(auto) evaluatePolyCoef(
582 const auto& mapping,
583 const auto& fe_values,
584 std::size_t bi,
585 std::size_t bj) const {
586 using VCoefType = std::decay_t<decltype(m_v.evaluatePolyCoef(
587 mapping, fe_values, bi, bj))>;
588 return internal::hcat(
589 m_u.evaluatePolyCoef(mapping, fe_values, bi, bj),
590 VCoefType{-m_v.evaluatePolyCoef(mapping, fe_values, bi, bj)});
591 }
592};
593
594template <std::size_t Dim, typename FeExpressionU, typename FeExpressionV>
599 *static_cast<const FeExpressionU*>(&u),
600 *static_cast<const FeExpressionV*>(&v));
601}
602
604
605// make_vec(e_0, ..., e_{N-1}): assemble N scalar expressions into an
606// N-dimensional Eigen vector at each quadrature point. The number of arguments
607// fixes the output dimension (2 args -> 2D vector, 3 args -> 3D vector). This
608// is used to build vector coefficient expressions from scalar components. It is
609// a pure coefficient expression (FeSpaceType = void inherited from the base):
610// when combined with a test/trial function via inner(...), the surrounding
611// binary expression supplies the FE space and k-index range.
612template <std::size_t Dim, typename... ScalarExprs>
614 : public FeExpressionBase<Dim, FeExpressionMakeVec<Dim, ScalarExprs...>> {
615 public:
616 static constexpr std::size_t N = sizeof...(ScalarExprs);
617 static_assert(N >= 1, "make_vec requires at least one component");
618
619 static constexpr bool is_leaf = false;
620 static constexpr uint8_t is_bilinear = (ScalarExprs::is_bilinear | ...);
621
622 using OutputType = Eigen::Vector<double, static_cast<int>(N)>;
623
624 explicit FeExpressionMakeVec(const ScalarExprs&... exprs)
625 : m_exprs(exprs...) {}
626
627 template <std::size_t J = 0, std::size_t I = 0>
629 const FeValues<Dim>& fe_values,
630 std::size_t j,
631 std::size_t i,
632 std::size_t q) const {
633 OutputType result;
634 evalAssign<J, I>(fe_values, j, i, q, std::make_index_sequence<N>{}, result);
635 return result;
636 }
637
638 constexpr std::size_t computeOrder() const {
639 return computeOrderImpl(std::make_index_sequence<N>{});
640 }
641
643 return computeUpdateFlagsImpl(std::make_index_sequence<N>{});
644 }
645
646 constexpr bool precompute(
647 const FeValues<Dim>& fe_values, const CellsType<Dim>& cells) const {
648 return precomputeImpl(fe_values, cells, std::make_index_sequence<N>{});
649 }
650
651 // evaluatePoly: stack each scalar component's 1-row polynomial matrix into an
652 // N-row result. Returns void() if any component is not qfree-admissible. When
653 // component column counts differ the shorter rows are zero-padded (Eigen
654 // default-constructs SparsePolynomial elements as the zero polynomial).
655 decltype(auto) evaluatePoly(
656 const FeValues<Dim>& fe_values,
657 std::size_t j,
658 std::size_t i,
659 std::size_t bi,
660 std::size_t bj) const {
661 return evaluatePolyImpl(
662 fe_values, j, i, bi, bj, std::make_index_sequence<N>{});
663 }
664
665 decltype(auto) evaluatePolyCoef(
666 const auto& mapping,
667 const auto& fe_values,
668 std::size_t bi,
669 std::size_t bj) const {
671 mapping, fe_values, bi, bj, std::make_index_sequence<N>{});
672 }
673
674 protected:
675 std::tuple<typename std::conditional_t<
676 ScalarExprs::is_leaf,
677 const ScalarExprs&,
678 const ScalarExprs>...>
680
681 private:
682 template <std::size_t J, std::size_t I, std::size_t... Ks>
684 const FeValues<Dim>& fe_values,
685 std::size_t j,
686 std::size_t i,
687 std::size_t q,
688 std::index_sequence<Ks...>,
689 OutputType& result) const {
690 ((result[static_cast<Eigen::Index>(Ks)] =
691 std::get<Ks>(m_exprs).template evaluate<J, I>(fe_values, j, i, q)),
692 ...);
693 }
694
695 template <std::size_t... Ks>
696 constexpr std::size_t computeOrderImpl(std::index_sequence<Ks...>) const {
697 return std::max({std::get<Ks>(m_exprs).computeOrder()...});
698 }
699
700 template <std::size_t... Ks>
702 std::index_sequence<Ks...>) const {
703 return (std::get<Ks>(m_exprs).computeUpdateFlags() | ...);
704 }
705
706 template <std::size_t... Ks>
707 constexpr bool precomputeImpl(
708 const FeValues<Dim>& fe_values,
709 const CellsType<Dim>& cells,
710 std::index_sequence<Ks...>) const {
711 return (std::get<Ks>(m_exprs).precompute(fe_values, cells) && ...);
712 }
713
714 template <std::size_t... Ks>
715 decltype(auto) evaluatePolyImpl(
716 const FeValues<Dim>& fe_values,
717 std::size_t j,
718 std::size_t i,
719 std::size_t bi,
720 std::size_t bj,
721 std::index_sequence<Ks...>) const {
722 using RowTypes =
723 std::tuple<std::decay_t<decltype(std::get<Ks>(m_exprs).evaluatePoly(
724 fe_values, j, i, bi, bj))>...>;
725 if constexpr ((std::is_same_v<void, std::tuple_element_t<Ks, RowTypes>> ||
726 ...)) {
727 return void();
728 } else {
729 auto row_polys = std::make_tuple(
730 std::get<Ks>(m_exprs).evaluatePoly(fe_values, j, i, bi, bj)...);
731 using PolyType = typename std::tuple_element_t<0, RowTypes>::Scalar;
732 const Eigen::Index max_cols =
733 std::max({std::get<Ks>(row_polys).cols()...});
734 Eigen::Matrix<PolyType, static_cast<int>(N), -1> result(
735 static_cast<Eigen::Index>(N), max_cols);
736 ((result.row(static_cast<Eigen::Index>(Ks))
737 .head(std::get<Ks>(row_polys).cols()) = std::get<Ks>(row_polys)),
738 ...);
739 return result;
740 }
741 }
742
743 template <std::size_t... Ks>
744 Eigen::Matrix<double, static_cast<int>(N), -1> evaluatePolyCoefImpl(
745 const auto& mapping,
746 const auto& fe_values,
747 std::size_t bi,
748 std::size_t bj,
749 std::index_sequence<Ks...>) const {
750 auto row_coefs = std::make_tuple(
751 std::get<Ks>(m_exprs).evaluatePolyCoef(mapping, fe_values, bi, bj)...);
752 const Eigen::Index max_cols = std::max({std::get<Ks>(row_coefs).cols()...});
753 Eigen::Matrix<double, static_cast<int>(N), -1> result(
754 static_cast<Eigen::Index>(N), max_cols);
755 result.setZero();
756 ((result.row(static_cast<Eigen::Index>(Ks))
757 .head(std::get<Ks>(row_coefs).cols()) = std::get<Ks>(row_coefs)),
758 ...);
759 return result;
760 }
761};
762
763template <std::size_t Dim, typename... ScalarExprs>
764FeExpressionMakeVec<Dim, ScalarExprs...> make_vec(
765 const FeExpressionBase<Dim, ScalarExprs>&... exprs) {
766 return FeExpressionMakeVec<Dim, ScalarExprs...>(
767 *static_cast<const ScalarExprs*>(&exprs)...);
768}
769
771
796template <std::size_t Dim, typename E>
798 : public FeExpressionBase<Dim, FeExpressionScale<Dim, E>> {
799 public:
800 using OutputType = typename E::OutputType;
801 static constexpr bool is_leaf = false;
802 static constexpr uint8_t is_bilinear = E::is_bilinear;
803
810 FeExpressionScale(double c, const E& expr) : m_c(c), m_expr(expr) {}
811
818 template <std::size_t J = 0, std::size_t I = 0>
819 decltype(auto) evaluate(
820 const FeValues<Dim>& fe_values,
821 std::size_t j,
822 std::size_t i,
823 std::size_t q) const {
824 using EvalType =
825 decltype(m_expr.template evaluate<J, I>(fe_values, j, i, q));
826 if constexpr (std::is_same_v<EvalType, void>) {
827 return void();
828 } else {
829 return std::decay_t<EvalType>(
830 m_c * m_expr.template evaluate<J, I>(fe_values, j, i, q));
831 }
832 }
833
834 constexpr std::size_t computeOrder() const { return m_expr.computeOrder(); }
835
837 return m_expr.computeUpdateFlags();
838 }
839
840 constexpr bool precompute(
841 const FeValues<Dim>& fe_values, const CellsType<Dim>& cells) const {
842 return m_expr.precompute(fe_values, cells);
843 }
844
845 protected:
846 double m_c;
847 std::conditional_t<E::is_leaf, const E&, const E> m_expr;
848};
849
859template <std::size_t Dim, typename E>
861 double c, const FeExpressionBase<Dim, E>& e) {
862 return FeExpressionScale<Dim, E>(c, *static_cast<const E*>(&e));
863}
864
874template <std::size_t Dim, typename E>
876 const FeExpressionBase<Dim, E>& e, double c) {
877 return FeExpressionScale<Dim, E>(c, *static_cast<const E*>(&e));
878}
879
881
908template <std::size_t Dim, typename E>
910 : public FeExpressionBase<Dim, FeExpressionShift<Dim, E>> {
911 public:
912 using OutputType = typename E::OutputType;
913 static constexpr bool is_leaf = false;
914 static constexpr uint8_t is_bilinear = E::is_bilinear;
915
923 FeExpressionShift(const OutputType& c, const E& expr)
924 : m_c(c), m_expr(expr) {}
925
932 template <std::size_t J = 0, std::size_t I = 0>
933 decltype(auto) evaluate(
934 const FeValues<Dim>& fe_values,
935 std::size_t j,
936 std::size_t i,
937 std::size_t q) const {
938 using EvalType =
939 decltype(m_expr.template evaluate<J, I>(fe_values, j, i, q));
940 if constexpr (std::is_same_v<EvalType, void>) {
941 return void();
942 } else {
943 return std::decay_t<EvalType>(
944 m_c + m_expr.template evaluate<J, I>(fe_values, j, i, q));
945 }
946 }
947
948 constexpr std::size_t computeOrder() const { return m_expr.computeOrder(); }
949
951 return m_expr.computeUpdateFlags();
952 }
953
954 constexpr bool precompute(
955 const FeValues<Dim>& fe_values, const CellsType<Dim>& cells) const {
956 return m_expr.precompute(fe_values, cells);
957 }
958
959 protected:
961 std::conditional_t<E::is_leaf, const E&, const E> m_expr;
962};
963
976template <
977 std::size_t Dim,
978 typename E,
979 std::enable_if_t<std::is_same_v<typename E::OutputType, double>, int> = 0>
981 double c, const FeExpressionBase<Dim, E>& e) {
982 return FeExpressionShift<Dim, E>(c, *static_cast<const E*>(&e));
983}
984
994template <
995 std::size_t Dim,
996 typename E,
997 std::enable_if_t<std::is_same_v<typename E::OutputType, double>, int> = 0>
999 const FeExpressionBase<Dim, E>& e, double c) {
1000 return FeExpressionShift<Dim, E>(c, *static_cast<const E*>(&e));
1001}
1002
1012template <
1013 std::size_t Dim,
1014 typename E,
1015 std::enable_if_t<std::is_same_v<typename E::OutputType, double>, int> = 0>
1017 const FeExpressionBase<Dim, E>& e, double c) {
1018 return FeExpressionShift<Dim, E>(-c, *static_cast<const E*>(&e));
1019}
1020
1036template <std::size_t Dim, typename E>
1038 const typename E::OutputType& c, const FeExpressionBase<Dim, E>& e) {
1039 return FeExpressionShift<Dim, E>(c, *static_cast<const E*>(&e));
1040}
1041
1051template <std::size_t Dim, typename E>
1053 const FeExpressionBase<Dim, E>& e, const typename E::OutputType& c) {
1054 return FeExpressionShift<Dim, E>(c, *static_cast<const E*>(&e));
1055}
1056
1058
1080template <typename E>
1082 const auto& expr = *static_cast<const E*>(&e);
1084}
1085
1086} // namespace fe
1087} // namespace vulpes
1088
1089#endif // VULPES_FE_FE_EXPRESSIONS_FE_EXPR_OP_HPP_
Base class for Finite Element Expressions.
Definition fe_expr_base.hpp:210
Definition fe_expr_op.hpp:538
FeExpressionDifference(E1 const &u, E2 const &v)
Definition fe_expr_op.hpp:541
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:568
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:544
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:581
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:564
std::conditional_t< E2::is_leaf, const E2 &, const E2 > m_v
Definition fe_expr_op.hpp:539
std::conditional_t< E1::is_leaf, const E1 &, const E1 > m_u
Definition fe_expr_op.hpp:539
Definition fe_expr_op.hpp:101
FeExpressionInner(E1 const &u, E2 const &v)
Definition fe_expr_op.hpp:104
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:189
std::conditional_t< E2::is_leaf, const E2 &, const E2 > m_v
Definition fe_expr_op.hpp:102
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:107
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:133
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:129
std::conditional_t< E1::is_leaf, const E1 &, const E1 > m_u
Definition fe_expr_op.hpp:102
Definition fe_expr_op.hpp:614
static constexpr std::size_t N
Definition fe_expr_op.hpp:616
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:655
void evalAssign(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q, std::index_sequence< Ks... >, OutputType &result) const
Definition fe_expr_op.hpp:683
Eigen::Vector< double, static_cast< int >(N)> OutputType
Definition fe_expr_op.hpp:622
FeExpressionMakeVec(const ScalarExprs &... exprs)
Definition fe_expr_op.hpp:624
constexpr UpdateFlagsType computeUpdateFlags() const
Definition fe_expr_op.hpp:642
Eigen::Matrix< double, static_cast< int >(N), -1 > evaluatePolyCoefImpl(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj, std::index_sequence< Ks... >) const
Definition fe_expr_op.hpp:744
static constexpr uint8_t is_bilinear
Definition fe_expr_op.hpp:620
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:665
static constexpr bool is_leaf
Definition fe_expr_op.hpp:619
constexpr std::size_t computeOrderImpl(std::index_sequence< Ks... >) const
Definition fe_expr_op.hpp:696
constexpr UpdateFlagsType computeUpdateFlagsImpl(std::index_sequence< Ks... >) const
Definition fe_expr_op.hpp:701
decltype(auto) evaluatePolyImpl(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj, std::index_sequence< Ks... >) const
Definition fe_expr_op.hpp:715
constexpr bool precomputeImpl(const FeValues< Dim > &fe_values, const CellsType< Dim > &cells, std::index_sequence< Ks... >) const
Definition fe_expr_op.hpp:707
OutputType evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:628
std::tuple< typename std::conditional_t< ScalarExprs::is_leaf, const ScalarExprs &, const ScalarExprs >... > m_exprs
Definition fe_expr_op.hpp:679
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:638
constexpr bool precompute(const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
Definition fe_expr_op.hpp:646
Definition fe_expr_op.hpp:236
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:258
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:262
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:242
std::conditional_t< E1::is_leaf, const E1 &, const E1 > m_u
Definition fe_expr_op.hpp:237
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:309
std::conditional_t< E2::is_leaf, const E2 &, const E2 > m_v
Definition fe_expr_op.hpp:237
FeExpressionOuter(E1 const &u, E2 const &v)
Definition fe_expr_op.hpp:239
Definition fe_expr_op.hpp:342
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:348
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:364
FeExpressionProduct(E1 const &u, E2 const &v)
Definition fe_expr_op.hpp:345
std::conditional_t< E1::is_leaf, const E1 &, const E1 > m_u
Definition fe_expr_op.hpp:343
std::conditional_t< E2::is_leaf, const E2 &, const E2 > m_v
Definition fe_expr_op.hpp:343
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:368
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:421
Multiply an FE expression by a scalar constant at every quadrature point.
Definition fe_expr_op.hpp:798
FeExpressionScale(double c, const E &expr)
Construct with a scalar factor and the expression to scale.
Definition fe_expr_op.hpp:810
static constexpr bool is_leaf
Definition fe_expr_op.hpp:801
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Evaluate c * expr at quadrature point q.
Definition fe_expr_op.hpp:819
std::conditional_t< E::is_leaf, const E &, const E > m_expr
Definition fe_expr_op.hpp:847
double m_c
Definition fe_expr_op.hpp:846
constexpr UpdateFlagsType computeUpdateFlags() const
Definition fe_expr_op.hpp:836
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:834
typename E::OutputType OutputType
Definition fe_expr_op.hpp:800
static constexpr uint8_t is_bilinear
Definition fe_expr_op.hpp:802
constexpr bool precompute(const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
Definition fe_expr_op.hpp:840
Add a constant offset to an FE expression at every quadrature point.
Definition fe_expr_op.hpp:910
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Evaluate m_c + expr at quadrature point q.
Definition fe_expr_op.hpp:933
std::conditional_t< E::is_leaf, const E &, const E > m_expr
Definition fe_expr_op.hpp:961
static constexpr bool is_leaf
Definition fe_expr_op.hpp:913
OutputType m_c
Definition fe_expr_op.hpp:960
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:948
typename E::OutputType OutputType
Definition fe_expr_op.hpp:912
constexpr UpdateFlagsType computeUpdateFlags() const
Definition fe_expr_op.hpp:950
FeExpressionShift(const OutputType &c, const E &expr)
Construct with a constant offset and the expression to shift.
Definition fe_expr_op.hpp:923
static constexpr uint8_t is_bilinear
Definition fe_expr_op.hpp:914
constexpr bool precompute(const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
Definition fe_expr_op.hpp:954
Definition fe_expr_op.hpp:473
FeExpressionSum(E1 const &u, E2 const &v)
Definition fe_expr_op.hpp:476
decltype(auto) evaluate(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
Definition fe_expr_op.hpp:479
std::conditional_t< E2::is_leaf, const E2 &, const E2 > m_v
Definition fe_expr_op.hpp:474
decltype(auto) evaluatePolyCoef(const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:514
decltype(auto) evaluatePoly(const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
Definition fe_expr_op.hpp:503
constexpr std::size_t computeOrder() const
Definition fe_expr_op.hpp:499
std::conditional_t< E1::is_leaf, const E1 &, const E1 > m_u
Definition fe_expr_op.hpp:474
This class works as a cache table for computing efficiently the value of the basis function and its d...
Definition fe_values.hpp:94
#define FE_EXPRESSION_BINARY_IMPL(Dim, E1, E2)
Definition fe_expr_op.hpp:58
Definition fe_expr_base.hpp:58
static VULPES_ALWAYS_INLINE auto cartesian_hcat(const auto &u, const auto &v)
Horizontal concatenation of the cartesian product of the columns of two matrices.
Definition fe_expr_base.hpp:180
static VULPES_ALWAYS_INLINE auto lift_to_same_space(const auto &u, const auto &v)
Given two matrices of polynomials u and v, lift the one with lower dimension to the higher dimension,...
Definition fe_expr_base.hpp:141
static VULPES_ALWAYS_INLINE auto hcat(const auto &u, const auto &v)
Horizontally concatenate two matrices that have the same number of rows.
Definition fe_expr_base.hpp:68
Definition dof_policy.hpp:45
FeExpressionSum< Dim, FeExpressionU, FeExpressionV > operator+(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:526
FeExpressionShift< Dim, E > shift(const typename E::OutputType &c, const FeExpressionBase< Dim, E > &e)
General shift factory: c + expr, works for any OutputType.
Definition fe_expr_op.hpp:1037
std::underlying_type_t< UpdateFlags > UpdateFlagsType
Definition fe_values.hpp:65
auto perp(const FeExpressionBase< 2, E > &e)
2D perpendicular rotation of a 2-vector coefficient expression.
Definition fe_expr_op.hpp:1081
std::vector< std::unique_ptr< CellType< Dim > > > CellsType
Definition fe_expr_base.hpp:44
FeExpressionSpatialComponent< K, Dim, E > spatial_component(const FeExpressionBase< Dim, E > &e)
Extract the K-th scalar spatial component of a vector-output FE expression at every quadrature point.
Definition fe_expr_unary.hpp:313
FeExpressionMakeVec< Dim, ScalarExprs... > make_vec(const FeExpressionBase< Dim, ScalarExprs > &... exprs)
Definition fe_expr_op.hpp:764
FeExpressionProduct< Dim, FeExpressionU, FeExpressionV > operator*(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:461
FeExpressionOuter< Dim, FeExpressionU, FeExpressionV > outer(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:330
FeExpressionDifference< Dim, FeExpressionU, FeExpressionV > operator-(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:595
FeExpressionInner< Dim, FeExpressionU, FeExpressionV > inner(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:224
Definition cell_manager.hpp:38
Definition fe_expr_op.hpp:42
std::decay_t< decltype(T{0}.getBasis()[0])> type
Definition fe_expr_op.hpp:43