KASKADE 7 development version
Loading...
Searching...
No Matches
functional_aux.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the library KASKADE 7 */
4/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5/* */
6/* Copyright (C) 2002-2025 Zuse Institute Berlin */
7/* */
8/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9/* see $KASKADE/academic.txt */
10/* */
11/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13#ifndef FUNCTIONAL_AUX_HH
14#define FUNCTIONAL_AUX_HH
15
16#include <type_traits>
17#include <utility>
18#include <dune/common/fvector.hh>
19#include <dune/common/fmatrix.hh>
20#include "fem/functionspace.hh"
26
27namespace Kaskade
28{
61 template <ProblemType Type>
63 {
64 public:
65
66 static constexpr ProblemType type = Type;
67
68
69 // TODO: docme
70 template <class T>
71 bool inDomain(T const&) const
72 {
73 return true;
74 }
75
79 template <int row>
80 struct D1
81 {
85 static constexpr bool present = true;
86
92 static constexpr int derivatives = 1;
93 };
94
102 template <int row, int col>
103 struct D2
104 {
113 static constexpr bool present = type==WeakFormulation || row>=col;
121 static constexpr bool symmetric = type==VariationalFunctional && row==col;
122
131 static constexpr bool makePositive = false;
132
139 static constexpr bool lumped = false;
140
141 static constexpr bool constant = false;
142
148 static constexpr int derivatives = 1;
149 };
150
151 template <int row, int col>
152 struct B2
153 {
154 static bool const present = true;
155 static bool const symmetric = false;
156 static bool const lumped = false;
157 static bool const constant = false;
158 };
159
165 template <class Cell>
166 int integrationOrder(Cell const& /* cell */, int shapeFunctionOrder, bool /* boundary */) const
167 {
168 return 2*shapeFunctionOrder;
169 }
170
181 template <class Face>
182 bool considerFace(Face const& ) const
183 {
184 return true;
185 }
186
196 template <int /*row*/, int /*col*/>
198 {
199 return -10*std::numeric_limits<double>::epsilon();
200 }
201 };
202
203 // ----------------------------------------------------------------------------------------------
204
211 template <class TestVars, int row>
212 using D1Result = Dune::FieldVector<typename TestVars::Scalar,
213 TestVars::template Components<row>::m>;
214
215
230 template <class TestVars, int row, class AnsatzVars, int col>
231 using D2Result = Dune::FieldMatrix<typename TestVars::Scalar,
232 TestVars::template Components<row>::m,
233 AnsatzVars::template Components<col>::m>;
234
235 // ----------------------------------------------------------------------------------------------
236
238 {
239 template <class Functional, int n>
241 {
242 static constexpr bool ok = (!Functional::template D2<n,n>::present)
243 || Functional::template D2<n,n>::symmetric;
244 static constexpr bool pass = Functional::type != VariationalFunctional
245 || (ok && checkSymmetry<Functional,n-1>::pass);
246 };
247
248 template <class Functional>
249 struct checkSymmetry<Functional,-1>
250 {
251 static constexpr bool pass = true;
252 };
253 }
254
255 template <class Functional, int n>
257
258
259 // ----------------------------------------------------------------------------------------------
260
261
263 namespace Functional_Aux_Detail
264 {
265 template <int a, int b>
266 struct LessThan
267 {
268 static constexpr bool value = a<b;
269 };
270
271 template <int a, int b>
272 struct Equals
273 {
274 static constexpr bool value = a==b;
275 };
276 }
278
286 template <class AnsatzVars, class TestVars>
288 {
289 public:
290 using Scalar = typename AnsatzVars::Scalar;
291
292 template <class Entity>
293 void moveTo(Entity const&) {}
294
295 template <class Position, class Evaluators>
296 void evaluateAt(Position const&, Evaluators const&) {}
297
299 {
300 return 0;
301 }
302
303 template <int row, int dim>
308
309 template <int row, int col, int dim>
310 Dune::FieldMatrix <Scalar,TestVars::template components<row>,AnsatzVars::template components<row>>
312 {
313 return 0;
314 }
315
316 };
317
333 template <class Functional, class Cache, class ScalarT = typename Functional::Scalar>
334 class CacheBase: public TrivialCacheBase<typename Functional::AnsatzVars,typename Functional::TestVars>
335 {
336 public:
337 using Scalar = ScalarT;
338 using AnsatzVars = typename Functional::AnsatzVars;
339 using TestVars = typename Functional::TestVars;
340
341 private:
343 template <int row, int col> using Matrix = Dune::FieldMatrix<Scalar, TestVars::template Components<row>::m, AnsatzVars::template Components<col>::m>;
344 template <int row> using TestComponents = std::integral_constant<int,TestVars::template Components<row>::m>;
345 template <int row> using AnsatzComponents = std::integral_constant<int,AnsatzVars::template Components<row>::m>;
346
347 public:
349 template <int row, int dimw>
350 Scalar d1_local(VariationalArg<Scalar,dimw,TestComponents<row>::value> const& arg) const
351 {
352 return static_cast<Cache const*>(this)->template d1_impl<row>(arg);
353 }
354
355 template <int row, int dimw>
356 Dune::FieldVector<Scalar,1> d1(VariationalArg<Scalar,dimw,TestComponents<row>::value> const& arg) const
357 {
359 }
360
362 template <int row, int dimw, class enable = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>>
363 Vector<row> d1(VariationalArg<Scalar,dimw> const& scalarArg) const
364 {
365 Vector<row> result(0);
367
368 for(int i=0; i<TestComponents<row>::value; ++i)
369 {
370 arg.value = 0; arg.value[i] = scalarArg.value[0];
371 arg.derivative = 0; arg.derivative[i] = scalarArg.derivative[0];
372
373 result[i] = d1_local<row>(arg);
374 }
375
376 return result;
377 }
378
380 template <int row, int col, int dim>
381 Scalar d2_local(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
382 {
383 return static_cast<Cache const*>(this)->template d2_impl<row,col>(arg1,arg2);
384 }
385
386 template <int row, int col, int dim,
387 class enable1 = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>,
388 class enable2 = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,AnsatzComponents<row>::value>::value>
389 >
390 Dune::FieldMatrix<Scalar,1,1> d2(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
391 {
392 return d2_local<row,col>(arg1,arg2);
393 }
394
396 template <int row, int col, int dim, int m2,
397 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
398 class enable2 = typename std::enable_if<Functional_Aux_Detail::Equals<m2,AnsatzComponents<col>::value>::value>::type,
399 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
400 >
401 Vector<row> d2(VariationalArg<Scalar,dim> const& scalarArg, VariationalArg<Scalar,dim,m2> const& arg2) const
402 {
403 Vector<row> result(0);
405 for(int i=0; i<AnsatzComponents<row>::value; ++i)
406 {
407 arg1.value = 0; arg1.value[i] = scalarArg.value[0];
408 arg1.derivative = 0; arg1.derivative[i] = scalarArg.derivative[0];
409
410 result[i] = d2_local<row,col>(arg1,arg2);
411 }
412
413 return result;
414 }
415
417 template <int row, int col, int dim, int m1,
418 class enable1 = typename std::enable_if<Functional_Aux_Detail::Equals<m1,TestComponents<row>::value>::value>::type,
419 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
420 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
421 >
422 Vector<row> d2(VariationalArg<Scalar,dim,m1> const& arg1, VariationalArg<Scalar,dim> const& scalarArg) const
423 {
424 Vector<row> result(0);
426 for(int i=0; i<AnsatzComponents<row>::value; ++i)
427 {
428 arg2.value = 0; arg2.value[i] = scalarArg.value[0];
429 arg2.derivative = 0; arg2.derivative[i] = scalarArg.derivative[0];
430
431 result[i] = d2_local<row,col>(arg1,arg2);
432 }
433
434 return result;
435 }
436
438 template <int row, int col, int dim>
439 Matrix<row,col> d2(VariationalArg<Scalar,dim> const& scalarArg1, VariationalArg<Scalar,dim> const& scalarArg2) const
440 {
441 Matrix<row,col> result(0);
444 for(int i=0; i<TestComponents<row>::value; ++i)
445 {
446 arg1.value = 0; arg1.value[i] = scalarArg1.value[0];
447 arg1.derivative = 0; arg1.derivative[i] = scalarArg1.derivative[0];
448 for(int j=0; j<AnsatzComponents<col>::value; ++j)
449 {
450 arg2.value = 0; arg2.value[j] = scalarArg2.value[0];
451 arg2.derivative = 0; arg2.derivative[j] = scalarArg2.derivative[0];
452
453 result[i][j] = d2_local<row,col>(arg1,arg2);
454 }
455 }
456
457 return result;
458 }
459
460
462 template <int row, int col, int dim>
463 Scalar b2_local(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
464 {
465 return static_cast<Cache const*>(this)->template b2_impl<row,col>(arg1,arg2);
466 }
467
468 template <int row, int col, int dim,
469 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
470 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<row>::value>::value>::type
471 >
472 Dune::FieldMatrix<Scalar,1,1> b2(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
473 {
474 return b2_local<row,col>(arg1,arg2);
475 }
476
478 template <int row, int col, int dim, int m2,
479 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
480 class enable2 = typename std::enable_if<Functional_Aux_Detail::Equals<m2,AnsatzComponents<col>::value>::value>::type,
481 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
482 >
483 Vector<row> b2(VariationalArg<Scalar,dim> const& scalarArg, VariationalArg<Scalar,dim,m2> const& arg2) const
484 {
485 Vector<row> result(0);
487 for(int i=0; i<AnsatzComponents<row>::value; ++i)
488 {
489 arg1.value = 0; arg1.value[i] = scalarArg.value[0];
490 arg1.derivative = 0; arg1.derivative[i] = scalarArg.derivative[0];
491
492 result[i] = b2_local<row,col>(arg1,arg2);
493 }
494
495 return result;
496 }
497
499 template <int row, int col, int dim, int m1,
500 class enable1 = typename std::enable_if<Functional_Aux_Detail::Equals<m1,TestComponents<row>::value>::value>::type,
501 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
502 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
503 >
504 Vector<row> b2(VariationalArg<Scalar,dim,m1> const& arg1, VariationalArg<Scalar,dim> const& scalarArg) const
505 {
506 Vector<row> result(0);
508 for(int i=0; i<AnsatzComponents<row>::value; ++i)
509 {
510 arg2.value = 0; arg2.value[i] = scalarArg.value[0];
511 arg2.derivative = 0; arg2.derivative[i] = scalarArg.derivative[0];
512
513 result[i] = b2_local<row,col>(arg1,arg2);
514 }
515
516 return result;
517 }
518
520 template <int row, int col, int dim>
521 Matrix<row,col> b2(VariationalArg<Scalar,dim> const& scalarArg1, VariationalArg<Scalar,dim> const& scalarArg2) const
522 {
523 Matrix<row,col> result(0);
526 for(int i=0; i<TestComponents<row>::value; ++i)
527 {
528 arg1.value = 0; arg1.value[i] = scalarArg1.value[0];
529 arg1.derivative = 0; arg1.derivative[i] = scalarArg1.derivative[0];
530 for(int j=0; j<AnsatzComponents<col>::value; ++j)
531 {
532 arg2.value = 0; arg2.value[j] = scalarArg2.value[0];
533 arg2.derivative = 0; arg2.derivative[j] = scalarArg2.derivative[0];
534
535 result[i][j] = b2_local<row,col>(arg1,arg2);
536 }
537 }
538
539 return result;
540 }
541 };
542
543 // ----------------------------------------------------------------------------
544
546 namespace Functional_Aux_Detail
547 {
548 // helper function that detects if InnerBoundaryCache is declared in Functional
549 // If it exists, calling this with a nullptr argument selects this more specific template,
550 // otherwise the less specific version below.
551 template <class Functional>
552 constexpr std::true_type hasInnerBoundaryCacheImpl(typename Functional::InnerBoundaryCache*);
553
555 template <class Functional>
556 constexpr std::false_type hasInnerBoundaryCacheImpl(...);
557 }
559
564 template <class Functional>
565 constexpr bool hasInnerBoundaryCache =
566 decltype(Functional_Aux_Detail::hasInnerBoundaryCacheImpl<Functional>(nullptr))::value;
567
568
569
570 // ----------------------------------------------------------------------------
571
573 namespace Functional_Aux_Detail
574 {
575 template <class Functional, class Linearization, bool hasInnerBoundaryCache>
576 struct InnerBoundaryPolicyImpl
577 {
578 };
579
580 template <class Functional, class Linearization>
581 struct InnerBoundaryPolicyImpl<Functional,Linearization,true>
582 {
583 using InnerBoundaryCache = typename Functional::InnerBoundaryCache;
584
586 InnerBoundaryCache createInnerBoundaryCache(int flags) const
587 {
588 return InnerBoundaryCache(static_cast<Linearization const*>(this)->getFunctional(),
589 static_cast<Linearization const*>(this)->getOrigin(),flags);
590 }
591
592 template <class Face>
593 bool considerFace(Face const& face) const
594 {
595 return static_cast<Linearization const*>(this)->getFunctional().considerFace(face);
596 }
597 };
598
599 template <class Functional,class Linearization>
600 using InnerBoundaryPolicy = InnerBoundaryPolicyImpl<Functional,Linearization,hasInnerBoundaryCache<Functional>>;
601 }
603
620 template<class Functional_>
621 class LinearizationAt : public Functional_Aux_Detail::InnerBoundaryPolicy<Functional_,LinearizationAt<Functional_>>
622 {
623 public:
624 typedef Functional_ Functional;
625 static ProblemType const type = Functional::type;
626
627 typedef typename Functional::Scalar Scalar;
628
629 typedef typename Functional::AnsatzVars AnsatzVars;
630 typedef typename Functional::TestVars TestVars;
631 typedef typename Functional::OriginVars OriginVars;
632
633 typedef typename Functional::DomainCache DomainCache;
634 typedef typename Functional::BoundaryCache BoundaryCache;
635
648 typedef typename Functional::OriginVars::VariableSet PointOfLinearization;
649
654 : f(f_)
655 , u(u_)
656 { }
657
660 {
661 return DomainCache(f,u,flags);
662 }
663
666 {
667 return BoundaryCache(f,u,flags);
668 }
669
675 template <int row>
676 struct D1: public Functional::template D1<row> {};
677
679 template <int row, int col>
680 struct D2: public Functional::template D2<row,col> {};
681
683 template <class Cell>
684 int integrationOrder(Cell const& cell, int shapeFunctionOrder, bool boundary) const
685 {
686 return f.integrationOrder(cell,shapeFunctionOrder,boundary);
687 }
688
689 template <int row, int col>
691 {
692 return f.template makePositiveThreshold<row,col>();
693 }
694
697 {
698 return u;
699 }
700
702 Functional const& getFunctional() const
703 {
704 return f;
705 }
706
710 int derivatives() const
711 {
712 return f.derivatives();
713 }
714
715 protected:
716 Functional const& f;
718 };
719
720
721
727 template<class Functional>
728 LinearizationAt<Functional> linearization(Functional const& f, typename Functional::OriginVars::VariableSet const & u)
729 {
731 }
732
733 //------------------------------------------------------------------------------------------------
734
756 template<class Functional_>
758 : public Functional_Aux_Detail::InnerBoundaryPolicy<Functional_,
759 LinearizationDifferenceAt<Functional_>>
760 {
761 public:
762 typedef Functional_ Functional;
763 static ProblemType const type = Functional::type;
764
765 typedef typename Functional::Scalar Scalar;
766
767 typedef typename Functional::AnsatzVars AnsatzVars;
768 typedef typename Functional::TestVars TestVars;
769 typedef typename Functional::OriginVars OriginVars;
770
771
781 typedef typename Functional::OriginVars::VariableSet PointOfLinearization;
782
787 : f(f_), u1(u1_), u2(u2_) {};
788
790 {
791 public:
793 : dc1(f,u1,flags), dc2(f,u2,flags) {}
794
795 template <class Cell>
796 void moveTo(Cell const& entity) { dc1.moveTo(entity); dc2.moveTo(entity); }
797
798 template <class Position, class Evaluators>
799 void evaluateAt(Position const& x, Evaluators const& evaluators) { dc1.evaluateAt(x,evaluators); dc2.evaluateAt(x,evaluators); }
800
801 Scalar d0() const { return dc1.d0()-dc2.d0(); }
802
803 template<int row, int dim>
806 {
807 return dc1.template d1<row>(arg)-dc2.template d1<row>(arg);
808 }
809
810 template<int row, int col, int dim>
813 {
814 return dc1.template d2<row,col>(arg1,arg2)-dc2.template d2<row,col>(arg1,arg2);
815 }
816
817
818 private:
819 typename Functional::DomainCache dc1, dc2;
820 };
821
823 {
824 public:
826 : bc1(f,u1,flags), bc2(f,u2,flags) {}
827
828 template <class FaceIterator>
829 void moveTo(FaceIterator const& entity) { bc1.moveTo(entity); bc2.moveTo(entity); }
830
831 template <class Position, class Evaluators>
832 void evaluateAt(Position const& x, Evaluators const& evaluators) { bc1.evaluateAt(x,evaluators); bc2.evaluateAt(x,evaluators); }
833
834 Scalar d0() const { return bc1.d0()-bc2.d0(); }
835
836 template<int row, int dim>
839 {
840 return bc1.template d1<row>(arg)-bc2.template d1<row>(arg);
841 }
842
843 template<int row, int col, int dim>
846 {
847 return bc1.template d2<row,col>(arg1,arg2)-bc2.template d2<row,col>(arg1,arg2);
848 }
849
850 private:
851 typename Functional::BoundaryCache bc1, bc2;
852 };
853
856 {
857 return DomainCache(f,u1,u2,flags);
858 }
859
862 {
863 return BoundaryCache(f,u1,u2,flags);
864 }
865
869 template <int row>
870 struct D1: public Functional::template D1<row> {};
871
873 template <int row, int col>
874 struct D2: public Functional::template D2<row,col> {};
875
877 template <class Cell>
878 int integrationOrder(Cell const& cell, int shapeFunctionOrder, bool boundary) const
879 {
880 return f.template integrationOrder<Cell>(cell, shapeFunctionOrder, boundary);
881 }
882
884 Functional const& getFunctional() const {return f;}
885
886 protected:
887 Functional const& f;
890 };
891
892
893
895 template<class Functional>
897 typename Functional::OriginVars::VariableSet const & u1,
898 typename Functional::OriginVars::VariableSet const & u2)
899 {
901 }
902
903 //------------------------------------------------------------------------------------------------
904
917 template <class Functional>
918 class SemiLinearizationAt: public LinearizationAt<Functional>
919 {
920 public:
929 typename Functional::AnsatzVars::VariableSet const& u_,
930 typename Functional::AnsatzVars::VariableSet const& uJ_,
931 typename Functional::AnsatzVars::VariableSet const& du_):
932 LinearizationAt<Functional>(f_,u_), uJ(uJ_), du(du_) {}
933
934 typename Functional::DomainCache createDomainCache(int flags) const
935 {
936 return typename Functional::DomainCache(this->f,this->u,uJ,du,flags);
937 }
938
939 typename Functional::BoundaryCache createBoundaryCache(int flags) const
940 {
941 return typename Functional::BoundaryCache(this->f,this->u,uJ,du,flags);
942 }
943
944 private:
945 typename Functional::AnsatzVars::VariableSet const& uJ;
946 typename Functional::AnsatzVars::VariableSet const& du;
947 };
948
949 template <class Functional>
951 {
952 public:
961 typename Functional::AnsatzVars::VariableSet const& u_,
962 typename Functional::AnsatzVars::VariableSet const& uJ_,
963 typename Functional::AnsatzVars::VariableSet const& du_):
964 LinearizationAt<Functional>(f_,u_), uJ(uJ_), du(du_) {}
965
966 typename Functional::DomainCache createDomainCache(int flags) const
967 {
968 return typename Functional::DomainCache(this->f,this->u,uJ,du,flags);
969 }
970
971 typename Functional::BoundaryCache createBoundaryCache(int flags) const
972 {
973 return typename Functional::BoundaryCache(this->f,this->u,uJ,du,flags);
974 }
975
976 typename Functional::InnerBoundaryCache createInnerBoundaryCache(int flags) const
977 {
978 return typename Functional::InnerBoundaryCache(this->f,this->u,uJ,du,flags);
979 }
980
981 private:
982 typename Functional::AnsatzVars::VariableSet const& uJ;
983 typename Functional::AnsatzVars::VariableSet const& du;
984 };
985
990 template<class Functional>
992 typename Functional::AnsatzVars::VariableSet const& u,
993 typename Functional::AnsatzVars::VariableSet const& uJ,
994 typename Functional::AnsatzVars::VariableSet const& du)
995 {
996 return SemiLinearizationAt<Functional>(f,u,uJ,du);
997 }
998
999 //------------------------------------------------------------------------------------------------
1000 //------------------------------------------------------------------------------------------------
1001
1002
1003} /* end of namespace Kaskade */
1004
1005#endif
Provides implementations of d1 and d2 for (possibly mixed) use of scalar and power spaces.
Matrix< row, col > d2(VariationalArg< Scalar, dim > const &scalarArg1, VariationalArg< Scalar, dim > const &scalarArg2) const
scalar argument for multi-component variables
Scalar b2_local(VariationalArg< Scalar, dim, TestComponents< row >::value > const &arg1, VariationalArg< Scalar, dim, AnsatzComponents< col >::value > const &arg2) const
forward to implementation via CRTP
Scalar d2_local(VariationalArg< Scalar, dim, TestComponents< row >::value > const &arg1, VariationalArg< Scalar, dim, AnsatzComponents< col >::value > const &arg2) const
forward to implementation via CRTP
Matrix< row, col > b2(VariationalArg< Scalar, dim > const &scalarArg1, VariationalArg< Scalar, dim > const &scalarArg2) const
scalar argument for multi-component variables
Scalar d1_local(VariationalArg< Scalar, dimw, TestComponents< row >::value > const &arg) const
forward to implementation via CRTP
Vector< row > d1(VariationalArg< Scalar, dimw > const &scalarArg) const
scalar argument for multi-component variables
typename Functional::AnsatzVars AnsatzVars
Vector< row > b2(VariationalArg< Scalar, dim > const &scalarArg, VariationalArg< Scalar, dim, m2 > const &arg2) const
scalar argument for multi-component variables
typename Functional::TestVars TestVars
Dune::FieldVector< Scalar, 1 > d1(VariationalArg< Scalar, dimw, TestComponents< row >::value > const &arg) const
Dune::FieldMatrix< Scalar, 1, 1 > d2(VariationalArg< Scalar, dim, TestComponents< row >::value > const &arg1, VariationalArg< Scalar, dim, AnsatzComponents< col >::value > const &arg2) const
Vector< row > b2(VariationalArg< Scalar, dim, m1 > const &arg1, VariationalArg< Scalar, dim > const &scalarArg) const
scalar argument for multi-component variables
Vector< row > d2(VariationalArg< Scalar, dim, m1 > const &arg1, VariationalArg< Scalar, dim > const &scalarArg) const
scalar argument for multi-component variables
Vector< row > d2(VariationalArg< Scalar, dim > const &scalarArg, VariationalArg< Scalar, dim, m2 > const &arg2) const
scalar argument for multi-component variables
Dune::FieldMatrix< Scalar, 1, 1 > b2(VariationalArg< Scalar, dim, TestComponents< row >::value > const &arg1, VariationalArg< Scalar, dim, AnsatzComponents< col >::value > const &arg2) const
Convenience base class for the easy definition of variational functionals and weak formulations.
bool considerFace(Face const &) const
Default implementation for which faces are to be considered for assembly in case an InnerBoundaryCach...
bool inDomain(T const &) const
int integrationOrder(Cell const &, int shapeFunctionOrder, bool) const
Default implementation specifying the integration order.
static constexpr ProblemType type
double makePositiveThreshold() const
Defines the eigenvalue threshold when enforcing positivity of local stiffness matrices.
Functional::DomainCache DomainCache
DomainCache createDomainCache(int flags) const
create a domain cache
PointOfLinearization const & getOrigin() const
Get point of linearization.
Functional::Scalar Scalar
Functional::OriginVars OriginVars
Functional::AnsatzVars AnsatzVars
int derivatives() const
Gives the highest derivative that arises in the weak formulation.
PointOfLinearization const & u
Functional::BoundaryCache BoundaryCache
LinearizationAt(Functional const &f_, PointOfLinearization const &u_)
Construct a linearization from a given functional.
static ProblemType const type
Functional const & getFunctional() const
Get functional.
Functional::TestVars TestVars
Functional::OriginVars::VariableSet PointOfLinearization
Type of variables around which the functional will be linearized.
int integrationOrder(Cell const &cell, int shapeFunctionOrder, bool boundary) const
integration order
BoundaryCache createBoundaryCache(int flags) const
create a boundary cache
void evaluateAt(Position const &x, Evaluators const &evaluators)
BoundaryCache(Functional const &f, PointOfLinearization const &u1, PointOfLinearization const &u2, int flags)
Dune::FieldVector< Scalar, TestVars::template Components< row >::m > d1(VariationalArg< Scalar, dim > const &arg) const
Dune::FieldMatrix< Scalar, TestVars::template Components< row >::m, AnsatzVars::template Components< col >::m > d2(VariationalArg< Scalar, dim > const &arg1, VariationalArg< Scalar, dim > const &arg2) const
DomainCache(Functional const &f, PointOfLinearization const &u1, PointOfLinearization const &u2, int flags)
Dune::FieldVector< Scalar, TestVars::template Components< row >::m > d1(VariationalArg< Scalar, dim > const &arg) const
void evaluateAt(Position const &x, Evaluators const &evaluators)
Dune::FieldMatrix< Scalar, TestVars::template Components< row >::m, AnsatzVars::template Components< col >::m > d2(VariationalArg< Scalar, dim > const &arg1, VariationalArg< Scalar, dim > const &arg2) const
Proxy class for evaluating differences of linearizations of a nonlinear functional.
PointOfLinearization const & u1
PointOfLinearization const & u2
Functional::OriginVars::VariableSet PointOfLinearization
Type of variables around which the functional will be linearized.
Functional const & getFunctional() const
Get functional.
int integrationOrder(Cell const &cell, int shapeFunctionOrder, bool boundary) const
integration order
LinearizationDifferenceAt(Functional const &f_, PointOfLinearization const &u1_, PointOfLinearization const &u2_)
Construct a difference of linearizations from a given functional.
BoundaryCache createBoundaryCache(int flags) const
create a boundary cache
DomainCache createDomainCache(int flags) const
create a domain cache
SemiLinearizationAt(Functional const &f_, typename Functional::AnsatzVars::VariableSet const &u_, typename Functional::AnsatzVars::VariableSet const &uJ_, typename Functional::AnsatzVars::VariableSet const &du_)
Constructor.
Functional::BoundaryCache createBoundaryCache(int flags) const
Functional::DomainCache createDomainCache(int flags) const
SemiLinearizationAt< Functional > semiLinearization(Functional const &f, typename Functional::AnsatzVars::VariableSet const &u, typename Functional::AnsatzVars::VariableSet const &uJ, typename Functional::AnsatzVars::VariableSet const &du)
Convenience routine for constructing semi-linearizations.
SemiLinearizationAtInner(Functional const &f_, typename Functional::AnsatzVars::VariableSet const &u_, typename Functional::AnsatzVars::VariableSet const &uJ_, typename Functional::AnsatzVars::VariableSet const &du_)
Constructor.
Functional::InnerBoundaryCache createInnerBoundaryCache(int flags) const
Functional::BoundaryCache createBoundaryCache(int flags) const
Functional::DomainCache createDomainCache(int flags) const
Base class simplifying the definition of domain and boundary caches.
Dune::FieldVector< Scalar, TestVars::template components< row > > d1(VariationalArg< Scalar, dim > const &arg) const
void evaluateAt(Position const &, Evaluators const &)
typename AnsatzVars::Scalar Scalar
Dune::FieldMatrix< Scalar, TestVars::template components< row >, AnsatzVars::template components< row > > d2(VariationalArg< Scalar, dim > const &, VariationalArg< Scalar, dim > const &) const
void moveTo(Entity const &)
FEFunctionSpace and FunctionSpaceElement and the like.
typename boost::fusion::result_of::as_vector< typename boost::fusion::result_of::transform< Spaces, GetEvaluatorTypes >::type >::type Evaluators
the heterogeneous sequence type of Evaluators for the given spaces
ProblemType
A type for describing the nature of a PDE problem.
constexpr bool hasInnerBoundaryCache
Checks whether InnerBoundaryCache is declared in Functional.
LinearizationAt< Functional > linearization(Functional const &f, typename Functional::OriginVars::VariableSet const &u)
Convenience routine: construct linearization without having to know the type of the functional.
@ VariationalFunctional
typename GridView::Intersection Face
The type of faces in the grid view.
Definition gridBasics.hh:42
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
Definition gridBasics.hh:35
Dune::FieldMatrix< typename TestVars::Scalar, TestVars::template Components< row >::m, AnsatzVars::template Components< col >::m > D2Result
The return type of the d2() method of DomainCache and BoundaryCache.
Dune::FieldVector< typename TestVars::Scalar, TestVars::template Components< row >::m > D1Result
The return type of the d1() method of DomainCache and BoundaryCache.
LinearizationDifferenceAt< Functional > linearizationDifference(Functional const &f, typename Functional::OriginVars::VariableSet const &u1, typename Functional::OriginVars::VariableSet const &u2)
Convenience routine: construct linearization without having to know the type of the functional.
constexpr bool symmetryCheck
Static a priori default information about the right hand side blocks.
static constexpr bool present
Whether the block is to be assembled at all.
static constexpr int derivatives
The maximum ansatz and test function derivative occuring in this block.
Static a priori default information about the matrix blocks.
static constexpr bool constant
static constexpr bool makePositive
If this flag is true (and symmetric==true), the assembler will enforce positive semidefiniteness of a...
static constexpr int derivatives
The maximum ansatz and test function derivative occuring in this block.
static constexpr bool lumped
If this flag is true, only the diagonal of this block will be assembled and stored....
static constexpr bool symmetric
Whether the block is structurally symmetric (or hermitian). The default is true for diagonal blocks o...
static constexpr bool present
Whether the block is to be assembled and stored or not. The default value is the conservative one (bu...
Rhs block information.
matrix block information
A class that stores values, gradients, and Hessians of evaluated shape functions.
Dune::FieldMatrix< Scalar, components, dim > derivative
The shape function's spatial derivative, a components x dim matrix.
ValueType value
The shape function's value, a vector of dimension components