Dune-Fufem 2.12-git
Loading...
Searching...
No Matches
userfunctions.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE-FUFEM Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUFEM_FORMS_USERFUNCTIONS_HH
8#define DUNE_FUFEM_FORMS_USERFUNCTIONS_HH
9
10#include <cstddef>
11#include <type_traits>
12#include <utility>
13
18
20
30
31
32
33
34namespace Dune::Fufem::Forms::Impl {
35
36
37
38 // ************************************************************
39 // Implementation of compose(outerOp, innerOp)
40 // ************************************************************
41
42 template<class OuterTransform, class InnerTransform, class InnerOp>
43 requires isOperator_v<InnerOp>
44 auto composeImpl(const OuterTransform& outerTransform, const TransformedOperator<InnerTransform, InnerOp>& op)
45 {
46 return TransformedOperator(LocalOperators::localCompose(outerTransform, op.transformation()), op.baseOperator());
47 }
48
49 template<class OuterOp, class InnerOp>
50 requires isOperator_v<InnerOp>
51 auto composeImpl(const OuterOp& outerOp, const InnerOp& op)
52 {
53 return TransformedOperator(outerOp, op);
54 }
55
56 template<class OuterOp, class... InnerOps>
57 auto composeImpl(const OuterOp& outerOp, const Dune::Fufem::Forms::SumOperator<InnerOps...>& innerOps)
58 {
59 if constexpr(SumOperator<InnerOps...>::arity==0)
60 return TransformedOperator(outerOp, innerOps);
61 else
62 return std::apply([&](const auto&...op_i) {
63 return Dune::Fufem::Forms::SumOperator(composeImpl(outerOp, op_i) ...);
64 }, innerOps.operators());
65 }
66
67
68
69 // ************************************************************
70 // Implementation of sum(l,r).
71 // ************************************************************
72
73 // This has four special cases to collapse nested sums
74 // and two for the case that one argument is a constant.
75
76 template<class L, class R>
77 requires (isOperator_v<L> and isOperator_v<R>)
78 auto sum(const L& l, const R& r)
79 {
80 return SumOperator<L, R>(l, r);
81 }
82
83 template<class L, class... Ri>
84 requires isOperator_v<L>
85 auto sum(const L& l, const SumOperator<Ri...>& r)
86 {
87 return std::apply([&](const auto&... ri) {
88 return SumOperator<L, Ri...>(l, ri...);
89 }, r.operators());
90 }
91
92 template<class... Li, class R>
93 requires isOperator_v<R>
94 auto sum(const SumOperator<Li...>& l, const R& r)
95 {
96 return std::apply([&](const auto&... li) {
97 return SumOperator<Li..., R>(li..., r);
98 }, l.operators());
99 }
100
101 template<class... Li, class... Rj>
102 auto sum(const SumOperator<Li...>& l, const SumOperator<Rj...>& r)
103 {
104 return std::apply([&](const auto&...li) {
105 return std::apply([&](const auto&...rj) {
106 return SumOperator<Li..., Rj...>(li..., rj...);
107 }, r.operators());
108 }, l.operators());
109 }
110
111 // Overload for for the case that R is a constant
112 template<class L, class R>
113 requires (isOperatorOrSumOperator_v<L> and not isOperatorOrSumOperator_v<R>)
114 auto sum(const L& l, const R& r)
115 {
116 return Impl::composeImpl([r](auto&& l_value) {
118 }, l);
119 }
120
121 // Overload for for the case that L is a constant
122 template<class L, class R>
123 requires (not isOperatorOrSumOperator_v<L> and isOperatorOrSumOperator_v<R>)
124 auto sum(const L& l, const R& r)
125 {
126 return Impl::composeImpl([l](auto&& r_value) {
128 }, r);
129 }
130
131
132
133 // ************************************************************
134 // Implementation of product(p, left, right)
135 // ************************************************************
136
137 // The following are the generic functions for producing
138 // product operators from a binary operator and two other
139 // terms. At least one of those terms should be a operator.
140
141 // Overload for two plain operators
142 template<class Op, class L, class R>
143 requires (isOperator_v<L> and isOperator_v<R>
144 and Dune::IsCallable<Op(const typename L::Range, const typename R::Range)>::value)
145 auto productImpl(const Op& op, const L& l, const R& r)
146 {
147 static_assert(L::arity+R::arity<=2, "Trying to construct multi-linear operator with arity>2");
148
149 if constexpr((L::arity==1) and (R::arity==1))
150 {
151 if constexpr(L::argIndex==1)
152 return ProductOperator(LocalOperators::TransposedBinaryOp(op), r, l);
153 else
154 return ProductOperator(op, l, r);
155 }
156 else
157 return ProductOperator(op, l, r);
158 }
159
160 // Overload for one raw value and one operator
161 // This will wrap the raw value into a operator.
162 template<class Op, class L, class R>
163 requires (not isOperatorOrSumOperator_v<L> and isOperator_v<R>
164 and Dune::IsCallable<Op(const L, const typename R::Range)>::value)
165 auto productImpl(const Op& op, const L& l, const R& r)
166 {
167 using namespace std::placeholders;
168 return composeImpl(std::bind(op, l, _1), r);
169 }
170
171 // Overload for one operator and one raw value
172 // This will wrap the raw value into a operator.
173 template<class Op, class L, class R>
174 requires (isOperator_v<L> and not isOperatorOrSumOperator_v<R>
175 and Dune::IsCallable<Op(const typename L::Range, const R)>::value)
176 auto productImpl(const Op& op, const L& l, const R& r)
177 {
178 using namespace std::placeholders;
179 return composeImpl(std::bind(op, _1, r), l);
180 }
181
182 // Overload for one sum-operator and one plain term
183 // This will multiply out the product for the sum-operator.
184 template<class Op, class... Li, class R>
185 requires requires (const Op op, const Li... li, const R r) { (productImpl(op, li, r),...); }
186 auto productImpl(const Op& op, const SumOperator<Li...>& l, const R& r)
187 {
188 return std::apply([&](const auto&... li) {
189 return (productImpl(op, li, r) + ...);
190 }, l.operators());
191 }
192
193 // Overload for one plain term and one sum-operator
194 // This will multiply out the product for the sum-operator.
195 template<class Op, class L, class... Ri>
196 requires requires (const Op op, const L l, const Ri... ri) { (productImpl(op, l, ri),...); }
197 auto productImpl(const Op& op, const L& l, const SumOperator<Ri...>& r)
198 {
199 return std::apply([&](const auto&...ri) {
200 return (productImpl(op, l, ri) + ...);
201 }, r.operators());
202 }
203
204 // Overload for two sum-operators
205 // This will multiply out the product for both sum-operators.
206 template<class Op, class... Li, class... Rj>
207 requires requires (const Op op, const Li... li, const SumOperator<Rj...> r) { (productImpl(op, li, r),...); }
208 auto productImpl(const Op& op, const SumOperator<Li...>& l, const SumOperator<Rj...>& r)
209 {
210 return std::apply([&](const auto&...li) {
211 return (productImpl(op, li, r) + ...);
212 }, l.operators());
213 }
214
215
216
217 // ************************************************************
218 // Implementation of dot(l, r).
219 // ************************************************************
220
221 // These specializations only exist for optimization of special cases.
222
223 // This is the default implementation.
224 template<class L, class R>
225 requires ((isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
226 and requires (LocalOperators::DotOp dot, const L l, const R r) { productImpl(dot, l, r); })
227 auto dotImpl(const L& l, const R& r)
228 {
229 return productImpl(Dune::Fufem::Forms::LocalOperators::DotOp(), l, r);
230 }
231
232 template<class B, class TP, std::size_t argIndex_L, std::size_t argIndex_R>
233 auto dotImpl(const FEFunctionOperator<B,TP,argIndex_L>& l, const FEFunctionOperator<B,TP,argIndex_R>& r);
234
235 template<class B, class TP, std::size_t argIndex_L, std::size_t argIndex_R>
236 auto dotImpl(const FEFunctionJacobianOperator<B,TP,argIndex_L>& l, const FEFunctionJacobianOperator<B,TP,argIndex_R>& r);
237
238 template<class InnerOp>
239 using TransposedOperator = TransformedOperator<Dune::Fufem::Forms::LocalOperators::TransposeOp, InnerOp>;
240
241 template<class L, class R>
242 auto dotImpl(const Impl::TransposedOperator<L>& l, const Impl::TransposedOperator<R>& r)
243 {
244 using namespace Dune::Indices;
245 return Dune::Fufem::Forms::Impl::dotImpl(l.baseOperator(), r.baseOperator());
246 }
247
248 template<class B, class TP, std::size_t argIndex_L, std::size_t argIndex_R>
249 auto dotImpl(const FEFunctionOperator<B,TP,argIndex_L>& l, const FEFunctionOperator<B,TP,argIndex_R>& r)
250 {
253 {
255 [&](auto... i) {
256 return (Dune::Fufem::Forms::Impl::dotImpl(l.childOperator(i), r.childOperator(i)) + ...);
257 },
258 std::make_index_sequence<Node::degree()>{});
259 }
260 else
261 return productImpl(Dune::Fufem::Forms::LocalOperators::DotOp(), l, r);
262 }
263
264 template<class B, class TP, std::size_t argIndex_L, std::size_t argIndex_R>
265 auto dotImpl(const FEFunctionJacobianOperator<B,TP,argIndex_L>& l, const FEFunctionJacobianOperator<B,TP,argIndex_R>& r)
266 {
269 {
271 [&](auto... i) {
272 return (Dune::Fufem::Forms::Impl::dotImpl(l.childOperator(i), r.childOperator(i)) + ...);
273 },
274 std::make_index_sequence<Node::degree()>{});
275 }
276 else
277 return productImpl(Dune::Fufem::Forms::LocalOperators::DotOp(), l, r);
278 }
279
280
281
282} // namespace Dune::Fufem::Forms::Impl
283
284
285
286namespace Dune::Fufem::Forms {
287
288
289
290 // ************************************************************
291 // Linear combination of operators of the same arity
292 // ************************************************************
293
309#ifdef DOXYGEN
310 template<class L, class R>
311 auto operator+ (const L& l, const R& r);
312#else
313 // Overload for two operators of the same arity
314 template<class L, class R>
315 requires (isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
316 auto operator+ (const L& l, const R& r)
317 {
318 if constexpr (isOperatorOrSumOperator_v<L> and isOperatorOrSumOperator_v<R>)
319 static_assert(L::arity==R::arity, "The operators passed to operator+ do not have the same arity");
320 else if constexpr (isOperatorOrSumOperator_v<R>)
321 static_assert(R::arity==0, "Plain values can only be added to 0-linear operators");
322 else if constexpr (isOperatorOrSumOperator_v<L>)
323 static_assert(L::arity==0, "Plain values can only be added to 0-linear operators");
324 return Impl::sum(l, r);
325 }
326#endif
327
337 template<class Op>
338 requires isOperatorOrSumOperator_v<Op>
339 auto operator- (const Op& op)
340 {
341 if constexpr (requires(typename Op::Range x) { -x; })
342 return Impl::composeImpl(std::negate(), op);
343 else if constexpr (requires(typename Op::Range x) { -1*x; })
344 return Impl::composeImpl([](auto&& x) { return -1*x;}, op);
345 }
346
360#ifdef DOXYGEN
361 template<class L, class R>
362 auto operator- (const L& l, const R& r);
363#else
364 template<class L, class R>
365 requires (isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
366 auto operator- (const L& l, const R& r)
367 {
368 if constexpr (isOperatorOrSumOperator_v<L> and isOperatorOrSumOperator_v<R>)
369 static_assert(L::arity==R::arity, "The operators passed to operator- do not have the same arity");
370 else if constexpr (isOperatorOrSumOperator_v<R>)
371 static_assert(R::arity==0, "Differences with plain values can only be used with 0-linear operators");
372 else if constexpr (isOperatorOrSumOperator_v<L>)
373 static_assert(L::arity==0, "Differences with plain values can only be used with 0-linear operators");
374 return Impl::sum(l, -r);
375 }
376#endif
377
378
379
380 // ************************************************************
381 // Bilinear combination of operators
382 // ************************************************************
383
400 template<class Op, class L, class R>
401 auto product(const Op& op, const L& l, const R& r)
402 requires ((isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
403 and requires (const Op op, const L l, const R r) { Impl::productImpl(op, l, r); })
404 {
405 return Impl::productImpl(op, l, r);
406 }
407
423 template<class L, class R, class Dummy=void>
424 requires ((isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
425 and requires (LocalOperators::MultOp mult, const L l, const R r) { Impl::productImpl(mult, l, r); })
426 auto operator* (const L& l, const R& r)
427 {
428 // This overload is recursively constrained to cases where `operator*` makes sense.
429 // Otherwise Dune::dot(a,b) may be activated for operators because it relies on availability
430 // of a*b. This is a problem, because it leads to ambiguity with Forms::dot(a,b).
431 return Impl::productImpl(LocalOperators::MultOp{}, l, r);
432 }
433
449 template<class L, class R>
450 requires ((isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
451 and requires (const L l, const R r) { Impl::dotImpl(l, r); })
452 auto dot(const L& l, const R& r)
453 {
454 return Impl::dotImpl(l, r);
455 }
456
457
458
459 // ************************************************************
460 // Utilities for range transformations
461 // ************************************************************
462
478 template<class OuterOp, class InnerOp>
479 requires (isOperatorOrSumOperator_v<InnerOp>
480 and requires (const OuterOp outerOp, typename InnerOp::Range inner_range) { outerOp(inner_range); })
481 auto compose(const OuterOp& outerOp, const InnerOp& innerOp)
482 {
483 return Impl::composeImpl(outerOp, innerOp);
484 }
485
486
487
511 template<class OuterOp>
513 {
514 public:
515 RangeOperator(const OuterOp& outerOp) : outerOp_(outerOp) {}
516
517 template<class Op, class... Args>
518 requires isOperatorOrSumOperator_v<Op>
519 auto operator()(Op&& baseOperator, Args... args) const
520 {
521 using namespace std::placeholders;
522 return compose(std::bind(outerOp_, _1, args...), std::forward<Op>(baseOperator));
523 }
524
525 template<class Op>
526 requires isOperatorOrSumOperator_v<Op>
527 auto operator()(Op&& baseOperator) const
528 {
529 return compose(outerOp_, std::forward<Op>(baseOperator));
530 }
531
532 template<class Arg0, class... Args>
533 requires (not isOperatorOrSumOperator_v<Arg0>)
534 auto operator()(Arg0&& arg0, Args&&... args) const
535 {
536 return outerOp_(std::forward<Arg0>(arg0), std::forward<Args>(args)...);
537 }
538
539 private:
540 OuterOp outerOp_;
541 };
542
543
544
545 // ************************************************************
546 // Predefined linear range transformations
547 // ************************************************************
548
561 template<class Op>
562 auto transpose(const Op& op)
563 {
565 }
566
579 template<class Op>
580 auto symmetrize(const Op& op)
581 {
583 }
584
597 template<class Op>
598 auto trace(const Op& op)
599 {
601 }
602
603
604
605 // ************************************************************
606 // Predefined non-linear range transformations
607 // ************************************************************
608
627 template<class Op>
628 requires ((isOperatorOrSumOperator_v<Op> and (Op::arity==0) and (Dune::IsCallable<Dune::Fufem::Forms::LocalOperators::InvertOp(typename Op::Range)>::value))
629 or ((not isOperatorOrSumOperator_v<Op>) and Dune::IsCallable<Dune::Fufem::Forms::LocalOperators::InvertOp(Op)>::value))
630 auto inv(const Op& op)
631 {
633 }
634
652 template<class L, class R>
653 requires ((isOperatorOrSumOperator_v<L> or isOperatorOrSumOperator_v<R>)
654 and requires (LocalOperators::MultOp mult, const L l, const R r) { product(mult, l, inv(r)); })
655 auto operator/ (const L& l, const R& r)
656 {
657 // Since inv() does not exist if R is a non-nullary operator,
658 // we don't need to guard this further here.
659 return product(LocalOperators::MultOp{}, l, inv(r));
660 }
661
662
663
664 // ************************************************************
665 // Convenience functions for creating operators
666 // ************************************************************
667
685
700 template<class Basis>
701 auto testFunction(const Basis& basis)
702 {
703 using RootBasis = std::decay_t<decltype(basis.rootBasis())>;
704 return FEFunctionOperator<RootBasis, typename Basis::PrefixPath, 0>(basis.rootBasis(), basis.prefixPath());
705 }
706
723 template<class Basis>
724 auto testFunction(const Basis& basis, NonAffineFamily tag)
725 {
726 using RootBasis = std::decay_t<decltype(basis.rootBasis())>;
727 return FEFunctionOperator<RootBasis, typename Basis::PrefixPath, 0>(basis.rootBasis(), basis.prefixPath(), false);
728 }
729
748 template<class Basis, class... Args>
749 requires (sizeof...(Args)>0)
750 auto testFunction(const Basis& basis, Args&&... args)
751 {
752 using LastArg = typename Dune::Functions::LastType<std::decay_t<Args>...>::type;
754 {
755 return Dune::applyPartial([&](auto&&... treePathArgs){
756 return testFunction(Dune::Functions::subspaceBasis(basis, treePathArgs...), NonAffineFamily{});
757 },
759 std::make_index_sequence<sizeof...(Args)-1>{}
760 );
761 }
762 else
763 return testFunction(Dune::Functions::subspaceBasis(basis, args...));
764 }
765
780 template<class Basis>
781 auto trialFunction(const Basis& basis)
782 {
783 using RootBasis = std::decay_t<decltype(basis.rootBasis())>;
784 return FEFunctionOperator<RootBasis, typename Basis::PrefixPath, 1>(basis.rootBasis(), basis.prefixPath());
785 }
786
803 template<class Basis>
804 auto trialFunction(const Basis& basis, NonAffineFamily tag)
805 {
806 using RootBasis = std::decay_t<decltype(basis.rootBasis())>;
807 return FEFunctionOperator<RootBasis, typename Basis::PrefixPath, 1>(basis.rootBasis(), basis.prefixPath(), false);
808 }
809
828 template<class Basis, class... Args>
829 requires (sizeof...(Args)>0)
830 auto trialFunction(const Basis& basis, Args&&... args)
831 {
832 using LastArg = typename Dune::Functions::LastType<std::decay_t<Args>...>::type;
834 {
835 return Dune::applyPartial([&](auto&&... treePathArgs){
836 return trialFunction(Dune::Functions::subspaceBasis(basis, treePathArgs...), NonAffineFamily{});
837 },
839 std::make_index_sequence<sizeof...(Args)-1>{}
840 );
841 }
842 else
843 return trialFunction(Dune::Functions::subspaceBasis(basis, args...));
844 }
845
869 template<class Op>
870 requires (isOperatorOrSumOperator_v<Op> and (Op::arity<=1))
871 auto outside(const Op& op)
872 {
873 if constexpr (isOperator_v<Op>)
874 return OutsideOperator(op);
875 if constexpr (isSumOperator_v<Op>)
876 return std::apply([&](const auto&...op_i) {
878 }, op.operators());
879 }
880
894 template<class Op>
895 requires (isOperatorOrSumOperator_v<Op> and (Op::arity<=1))
896 auto avg(const Op& op)
897 {
898 return 0.5*(op+outside(op));
899 }
900
917 template<class Op>
918 requires (isOperatorOrSumOperator_v<Op> and (Op::arity<=1))
919 auto jump(const Op& op)
920 {
921 return op-outside(op);
922 }
923
937 template<class GridView>
938 auto meshSize(const GridView& gridView)
939 {
940 return MeshSizeOperator(gridView);
941 }
942
955 template<class GridView>
956 auto meshSize()
957 {
959 }
960
973 template<class GridView>
974 auto faceNormal(const GridView& gridView)
975 {
976 return FaceNormalOperator(gridView);
977 }
978
990 template<class GridView>
992 {
994 }
995
1021 template<class Op, class V>
1022 requires isOperatorOrSumOperator_v<Op>
1023 auto bindToCoefficients(const Op& op, V&& vector)
1024 {
1025 using Basis = std::decay_t<decltype(std::get<0>(op.basis()))>;
1026 // Small helper functions to wrap vectors using istlVectorBackend
1027 // if they do not already satisfy the VectorBackend interface.
1028 auto toConstVectorBackend = [&](auto&& v) -> decltype(auto) {
1029 if constexpr (models<Dune::Functions::Concept::ConstVectorBackend<Basis>, decltype(v)>()) {
1030 return std::forward<decltype(v)>(v);
1031 } else {
1033 }
1034 };
1035 static_assert(models<Dune::Functions::Concept::ConstVectorBackend<Basis>, std::decay_t<V>>() or std::is_lvalue_reference_v<V>,
1036 "When passing a temporary vector to bindToCoefficients() it must implement the ConstVectorBackend concept");
1037 return BoundUnaryOperator(op, toConstVectorBackend(std::forward<V>(vector)));
1038 }
1039
1040
1041
1062 template<class Op, class V>
1063 requires (isOperatorOrSumOperator_v<Op> and not isOperatorOrSumOperator_v<std::decay_t<V>>)
1064 auto operator|(const Op& op, V&& vector)
1065 {
1066 return bindToCoefficients(op, std::forward<V>(vector));
1067 }
1068
1069
1070
1071 // ************************************************************
1072 // Differential operators
1073 // ************************************************************
1074
1075 // Overloads for elementary operators
1076
1084 template<class B, class TP, std::size_t argIndex>
1086 {
1088 }
1089
1097 template<class B, class TP, std::size_t argIndex>
1099 {
1101 }
1102
1112 template<class B, class TP, std::size_t argIndex>
1114 {
1116 static_assert(dim==2 or dim==3);
1118 }
1119
1120 // Overloads for sums of operators
1121
1129 template<class... Ops>
1130 requires requires(const Ops&... ops) { SumOperator(jacobian(ops)...); }
1132 {
1133 return std::apply([&](const auto&...op) {
1134 return SumOperator(jacobian(op) ...);
1135 }, op.operators());
1136 }
1137
1145 template<class... Ops>
1146 requires requires(const Ops&... ops) { SumOperator(divergence(ops)...); }
1148 {
1149 return std::apply([&](const auto&...op) {
1150 return SumOperator(divergence(op) ...);
1151 }, op.operators());
1152 }
1153
1163 template<class... Ops>
1164 requires requires(const Ops&... ops) { SumOperator(curl(ops)...); }
1166 {
1167 return std::apply([&](const auto&...op) {
1168 return SumOperator(curl(op) ...);
1169 }, op.operators());
1170 }
1171
1172 // Other operators that are essetially shot cuts to the others
1173
1187 template<class Op>
1188 auto gradient(const Op& op)
1189 requires requires {Fufem::Forms::transpose(jacobian(op));}
1190 {
1192 }
1193
1207 template<class Op>
1208 auto grad(const Op& op)
1209 requires requires {Fufem::Forms::transpose(jacobian(op));}
1210 {
1212 }
1213
1221 template<class Op>
1222 auto div(const Op& op)
1223 requires requires {divergence(op);}
1224 {
1225 return divergence(op);
1226 }
1227
1237 template<class Op>
1238 auto rot(const Op& op)
1239 requires requires {curl(op);}
1240 {
1241 return curl(op);
1242 }
1243
1255 template<class Op>
1256 auto D(const Op& op, std::size_t k)
1257 requires requires {grad(op);}
1258 {
1259 return compose([k](auto&& g) { return g[k]; }, grad(op));
1260 }
1261
1262
1263
1264} // namespace Dune::Fufem::Forms
1265
1266
1267#endif // DUNE_FUFEM_FORMS_USERFUNCTIONS_HH
decltype(auto) applyPartial(F &&f, ArgTuple &&args, std::integer_sequence< I, i... >)
decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, i... > sequence)
size_type dim() const
T apply(T... args)
T bind(T... args)
Wrapper binding a linear operator to a coefficient vector.
Definition boundunaryoperator.hh:56
Linear map representing the divergenc of the elements of an FE-space.
Definition unaryoperators.hh:472
Linear map representing the jacobians of the elements of an FE-space.
Definition unaryoperators.hh:345
Linear map representing the elements of an FE-space.
Definition unaryoperators.hh:221
auto basis() const
Definition unaryoperators.hh:178
auto treePath() const
Definition unaryoperators.hh:183
bool isAffine() const
Definition unaryoperators.hh:188
Operator representing the normal field on intersection.
Definition geometryoperators.hh:42
Operator representing the mesh size of entities.
Definition geometryoperators.hh:189
Tag type to classify non-affine finite element families.
Definition userfunctions.hh:684
Operator for switching to the outside entity.
Definition outsideoperator.hh:57
Adaptor for making a callback compatible with Dune::Fufem::Forms.
Definition userfunctions.hh:513
auto operator()(Op &&baseOperator, Args... args) const
Definition userfunctions.hh:519
RangeOperator(const OuterOp &outerOp)
Definition userfunctions.hh:515
auto operator()(Op &&baseOperator) const
Definition userfunctions.hh:527
Sum of several multilinear operators.
Definition sumoperator.hh:38
auto & operators()
Definition sumoperator.hh:172
T forward_as_tuple(T... args)
T forward(T... args)
constexpr bool isOperatorOrSumOperator_v
Short cut for IsOperatorOrSumOperator<Op>::value.
Definition baseclass.hh:176
auto operator-(const Op &op)
Negate an operator.
Definition userfunctions.hh:339
auto dot(const L &l, const R &r)
Exterior product of two multilinear operators based on pointwise dot-product.
Definition userfunctions.hh:452
auto product(const Op &op, const L &l, const R &r)
Generic exterior product of two multilinear operators.
Definition userfunctions.hh:401
auto gradient(const Op &op)
Obtain the gradient of an operator.
Definition userfunctions.hh:1188
auto divergence(const FEFunctionOperator< B, TP, argIndex > &op)
Obtain the divergence of an operator.
Definition userfunctions.hh:1098
auto jacobian(const FEFunctionOperator< B, TP, argIndex > &op)
Obtain the jacobian of an operator.
Definition userfunctions.hh:1085
auto div(const Op &op)
Obtain the divergence of an operator.
Definition userfunctions.hh:1222
auto curl(const FEFunctionOperator< B, TP, argIndex > &op)
Obtain the curl of an operator.
Definition userfunctions.hh:1113
auto D(const Op &op, std::size_t k)
Obtain the i-th partial derivative of an operator.
Definition userfunctions.hh:1256
auto grad(const Op &op)
Obtain the gradient of an operator.
Definition userfunctions.hh:1208
auto rot(const Op &op)
Obtain the curl of an operator.
Definition userfunctions.hh:1238
auto testFunction(const Basis &basis)
Create unary identity operator on test function space.
Definition userfunctions.hh:701
auto trialFunction(const Basis &basis)
Create unary identity operator on trial function space.
Definition userfunctions.hh:781
auto meshSize()
Construct mesh size operator.
Definition userfunctions.hh:956
auto bindToCoefficients(const Op &op, V &&vector)
Bind a linear operator to a coefficient vector.
Definition userfunctions.hh:1023
auto faceNormal()
Construct operator representing the face normals.
Definition userfunctions.hh:991
auto avg(const Op &op)
Construct intersection average of a given operator.
Definition userfunctions.hh:896
auto outside(const Op &op)
Construct outside version of a given operator.
Definition userfunctions.hh:871
auto jump(const Op &op)
Construct intersection jump of a given operator.
Definition userfunctions.hh:919
auto trace(const Op &op)
Transform an operator by pointwise computation of the matrix trace.
Definition userfunctions.hh:598
auto compose(const OuterOp &outerOp, const InnerOp &innerOp)
Generic composition of a multilinear operators with a pointwise outer operator.
Definition userfunctions.hh:481
auto transpose(const Op &op)
Transform an operator by pointwise matrix transposition.
Definition userfunctions.hh:562
auto symmetrize(const Op &op)
Transform an operator by pointwise matrix symmetrization.
Definition userfunctions.hh:580
auto inv(const Op &op)
Transform an operator by pointwise computation of the matrix inverse.
Definition userfunctions.hh:630
auto istlVectorBackend(Vector &v)
auto localCompose(const OuterOp &outerOp, const InnerOp &innerOp)
Definition localoperators.hh:635
Definition baseclass.hh:22
auto subspaceBasis(const RootBasis &rootBasis, const TypeTree::TreePath< PrefixTreeIndices... > &prefixPath)
Definition localoperators.hh:282
Definition localoperators.hh:546
Definition localoperators.hh:401
Definition localoperators.hh:66
Definition localoperators.hh:522
Definition localoperators.hh:532
Definition localoperators.hh:495