KASKADE 7 development version
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-2023 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"
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
223 template <class TestVars, int row, class AnsatzVars, int col>
224 using D2Result = Dune::FieldMatrix<typename TestVars::Scalar,
225 TestVars::template Components<row>::m,
226 AnsatzVars::template Components<col>::m>;
227
228 // ----------------------------------------------------------------------------------------------
229
230 namespace Functional_Aux_Detail
231 {
232 template <class Functional, int n>
234 {
235 static constexpr bool ok = (!Functional::template D2<n,n>::present)
236 || Functional::template D2<n,n>::symmetric;
237 static constexpr bool pass = Functional::type != VariationalFunctional
238 || (ok && checkSymmetry<Functional,n-1>::pass);
239 };
240
241 template <class Functional>
242 struct checkSymmetry<Functional,-1>
243 {
244 static constexpr bool pass = true;
245 };
246 }
247
248 template <class Functional, int n>
250
251
252 // ----------------------------------------------------------------------------------------------
253
254
256 namespace Functional_Aux_Detail
257 {
258 template <int a, int b>
259 struct LessThan
260 {
261 static constexpr bool value = a<b;
262 };
263
264 template <int a, int b>
265 struct Equals
266 {
267 static constexpr bool value = a==b;
268 };
269 }
271
279 template <class AnsatzVars, class TestVars>
281 {
282 public:
283 using Scalar = typename AnsatzVars::Scalar;
284
285 template <class Entity>
286 void moveTo(Entity const&) {}
287
288 template <class Position, class Evaluators>
289 void evaluateAt(Position const&, Evaluators const&) {}
290
292 {
293 return 0;
294 }
295
296 template <int row, int dim>
298 {
299 return 0;
300 }
301
302 template <int row, int col, int dim>
303 Dune::FieldMatrix <Scalar,TestVars::template components<row>,AnsatzVars::template components<row>>
305 {
306 return 0;
307 }
308
309 };
310
326 template <class Functional, class Cache, class ScalarT = typename Functional::Scalar>
327 class CacheBase: public TrivialCacheBase<typename Functional::AnsatzVars,typename Functional::TestVars>
328 {
329 public:
330 using Scalar = ScalarT;
331 using AnsatzVars = typename Functional::AnsatzVars;
332 using TestVars = typename Functional::TestVars;
333
334 private:
336 template <int row, int col> using Matrix = Dune::FieldMatrix<Scalar, TestVars::template Components<row>::m, AnsatzVars::template Components<col>::m>;
337 template <int row> using TestComponents = std::integral_constant<int,TestVars::template Components<row>::m>;
338 template <int row> using AnsatzComponents = std::integral_constant<int,AnsatzVars::template Components<row>::m>;
339
340 public:
342 template <int row, int dimw>
343 Scalar d1_local(VariationalArg<Scalar,dimw,TestComponents<row>::value> const& arg) const
344 {
345 return static_cast<Cache const*>(this)->template d1_impl<row>(arg);
346 }
347
348 template <int row, int dimw>
349 Dune::FieldVector<Scalar,1> d1(VariationalArg<Scalar,dimw,TestComponents<row>::value> const& arg) const
350 {
351 return Dune::FieldVector<Scalar,1>(d1_local<row>(arg));
352 }
353
355 template <int row, int dimw, class enable = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>>
357 {
358 Vector<row> result(0);
360
361 for(int i=0; i<TestComponents<row>::value; ++i)
362 {
363 arg.value = 0; arg.value[i] = scalarArg.value[0];
364 arg.derivative = 0; arg.derivative[i] = scalarArg.derivative[0];
365
366 result[i] = d1_local<row>(arg);
367 }
368
369 return result;
370 }
371
373 template <int row, int col, int dim>
374 Scalar d2_local(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
375 {
376 return static_cast<Cache const*>(this)->template d2_impl<row,col>(arg1,arg2);
377 }
378
379 template <int row, int col, int dim,
380 class enable1 = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>,
381 class enable2 = typename std::enable_if_t<Functional_Aux_Detail::LessThan<1,AnsatzComponents<row>::value>::value>
382 >
383 Dune::FieldMatrix<Scalar,1,1> d2(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
384 {
385 return d2_local<row,col>(arg1,arg2);
386 }
387
389 template <int row, int col, int dim, int m2,
390 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
391 class enable2 = typename std::enable_if<Functional_Aux_Detail::Equals<m2,AnsatzComponents<col>::value>::value>::type,
392 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
393 >
395 {
396 Vector<row> result(0);
398 for(int i=0; i<AnsatzComponents<row>::value; ++i)
399 {
400 arg1.value = 0; arg1.value[i] = scalarArg.value[0];
401 arg1.derivative = 0; arg1.derivative[i] = scalarArg.derivative[0];
402
403 result[i] = d2_local<row,col>(arg1,arg2);
404 }
405
406 return result;
407 }
408
410 template <int row, int col, int dim, int m1,
411 class enable1 = typename std::enable_if<Functional_Aux_Detail::Equals<m1,TestComponents<row>::value>::value>::type,
412 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
413 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
414 >
416 {
417 Vector<row> result(0);
419 for(int i=0; i<AnsatzComponents<row>::value; ++i)
420 {
421 arg2.value = 0; arg2.value[i] = scalarArg.value[0];
422 arg2.derivative = 0; arg2.derivative[i] = scalarArg.derivative[0];
423
424 result[i] = d2_local<row,col>(arg1,arg2);
425 }
426
427 return result;
428 }
429
431 template <int row, int col, int dim>
433 {
434 Matrix<row,col> result(0);
437 for(int i=0; i<TestComponents<row>::value; ++i)
438 {
439 arg1.value = 0; arg1.value[i] = scalarArg1.value[0];
440 arg1.derivative = 0; arg1.derivative[i] = scalarArg1.derivative[0];
441 for(int j=0; j<AnsatzComponents<col>::value; ++j)
442 {
443 arg2.value = 0; arg2.value[j] = scalarArg2.value[0];
444 arg2.derivative = 0; arg2.derivative[j] = scalarArg2.derivative[0];
445
446 result[i][j] = d2_local<row,col>(arg1,arg2);
447 }
448 }
449
450 return result;
451 }
452
453
455 template <int row, int col, int dim>
456 Scalar b2_local(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
457 {
458 return static_cast<Cache const*>(this)->template b2_impl<row,col>(arg1,arg2);
459 }
460
461 template <int row, int col, int dim,
462 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
463 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<row>::value>::value>::type
464 >
465 Dune::FieldMatrix<Scalar,1,1> b2(VariationalArg<Scalar,dim,TestComponents<row>::value> const& arg1, VariationalArg<Scalar,dim,AnsatzComponents<col>::value> const& arg2) const
466 {
467 return b2_local<row,col>(arg1,arg2);
468 }
469
471 template <int row, int col, int dim, int m2,
472 class enable1 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
473 class enable2 = typename std::enable_if<Functional_Aux_Detail::Equals<m2,AnsatzComponents<col>::value>::value>::type,
474 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
475 >
477 {
478 Vector<row> result(0);
480 for(int i=0; i<AnsatzComponents<row>::value; ++i)
481 {
482 arg1.value = 0; arg1.value[i] = scalarArg.value[0];
483 arg1.derivative = 0; arg1.derivative[i] = scalarArg.derivative[0];
484
485 result[i] = b2_local<row,col>(arg1,arg2);
486 }
487
488 return result;
489 }
490
492 template <int row, int col, int dim, int m1,
493 class enable1 = typename std::enable_if<Functional_Aux_Detail::Equals<m1,TestComponents<row>::value>::value>::type,
494 class enable2 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,TestComponents<row>::value>::value>::type,
495 class enable3 = typename std::enable_if<Functional_Aux_Detail::LessThan<1,AnsatzComponents<col>::value>::value>::type
496 >
498 {
499 Vector<row> result(0);
501 for(int i=0; i<AnsatzComponents<row>::value; ++i)
502 {
503 arg2.value = 0; arg2.value[i] = scalarArg.value[0];
504 arg2.derivative = 0; arg2.derivative[i] = scalarArg.derivative[0];
505
506 result[i] = b2_local<row,col>(arg1,arg2);
507 }
508
509 return result;
510 }
511
513 template <int row, int col, int dim>
515 {
516 Matrix<row,col> result(0);
519 for(int i=0; i<TestComponents<row>::value; ++i)
520 {
521 arg1.value = 0; arg1.value[i] = scalarArg1.value[0];
522 arg1.derivative = 0; arg1.derivative[i] = scalarArg1.derivative[0];
523 for(int j=0; j<AnsatzComponents<col>::value; ++j)
524 {
525 arg2.value = 0; arg2.value[j] = scalarArg2.value[0];
526 arg2.derivative = 0; arg2.derivative[j] = scalarArg2.derivative[0];
527
528 result[i][j] = b2_local<row,col>(arg1,arg2);
529 }
530 }
531
532 return result;
533 }
534 };
535
536 // ----------------------------------------------------------------------------
537
539 namespace Functional_Aux_Detail
540 {
541 // helper function that detects if InnerBoundaryCache is declared in Functional
542 // If it exists, calling this with a nullptr argument selects this more specific template,
543 // otherwise the less specific version below.
544 template <class Functional>
545 constexpr std::true_type hasInnerBoundaryCacheImpl(typename Functional::InnerBoundaryCache*);
546
548 template <class Functional>
549 constexpr std::false_type hasInnerBoundaryCacheImpl(...);
550 }
552
557 template <class Functional>
558 constexpr bool hasInnerBoundaryCache =
559 decltype(Functional_Aux_Detail::hasInnerBoundaryCacheImpl<Functional>(nullptr))::value;
560
561
562
563 // ----------------------------------------------------------------------------
564
566 namespace Functional_Aux_Detail
567 {
568 template <class Functional, class Linearization, bool hasInnerBoundaryCache>
569 struct InnerBoundaryPolicyImpl
570 {
571 };
572
573 template <class Functional, class Linearization>
574 struct InnerBoundaryPolicyImpl<Functional,Linearization,true>
575 {
576 using InnerBoundaryCache = typename Functional::InnerBoundaryCache;
577
579 InnerBoundaryCache createInnerBoundaryCache(int flags) const
580 {
581 return InnerBoundaryCache(static_cast<Linearization const*>(this)->getFunctional(),
582 static_cast<Linearization const*>(this)->getOrigin(),flags);
583 }
584
585 template <class Face>
586 bool considerFace(Face const& face) const
587 {
588 return static_cast<Linearization const*>(this)->getFunctional().considerFace(face);
589 }
590 };
591
592 template <class Functional,class Linearization>
593 using InnerBoundaryPolicy = InnerBoundaryPolicyImpl<Functional,Linearization,hasInnerBoundaryCache<Functional>>;
594 }
596
613 template<class Functional_>
614 class LinearizationAt : public Functional_Aux_Detail::InnerBoundaryPolicy<Functional_,LinearizationAt<Functional_>>
615 {
616 public:
617 typedef Functional_ Functional;
618 static ProblemType const type = Functional::type;
619
620 typedef typename Functional::Scalar Scalar;
621
622 typedef typename Functional::AnsatzVars AnsatzVars;
623 typedef typename Functional::TestVars TestVars;
624 typedef typename Functional::OriginVars OriginVars;
625
626 typedef typename Functional::DomainCache DomainCache;
627 typedef typename Functional::BoundaryCache BoundaryCache;
628
641 typedef typename Functional::OriginVars::VariableSet PointOfLinearization;
642
647 : f(f_)
648 , u(u_)
649 { }
650
653 {
654 return DomainCache(f,u,flags);
655 }
656
659 {
660 return BoundaryCache(f,u,flags);
661 }
662
668 template <int row>
669 struct D1: public Functional::template D1<row> {};
670
672 template <int row, int col>
673 struct D2: public Functional::template D2<row,col> {};
674
676 template <class Cell>
677 int integrationOrder(Cell const& cell, int shapeFunctionOrder, bool boundary) const
678 {
679 return f.integrationOrder(cell,shapeFunctionOrder,boundary);
680 }
681
682 template <int row, int col>
684 {
685 return f.template makePositiveThreshold<row,col>();
686 }
687
690 {
691 return u;
692 }
693
695 Functional const& getFunctional() const
696 {
697 return f;
698 }
699
703 int derivatives() const
704 {
705 return f.derivatives();
706 }
707
708 protected:
709 Functional const& f;
711 };
712
713
714
720 template<class Functional>
721 LinearizationAt<Functional> linearization(Functional const& f, typename Functional::OriginVars::VariableSet const & u)
722 {
723 return LinearizationAt<Functional>(f,u);
724 }
725
747 template<class Functional_>
748 class LinearizationDifferenceAt : public Functional_Aux_Detail::InnerBoundaryPolicy<Functional_,LinearizationDifferenceAt<Functional_> >
749 {
750 public:
751 typedef Functional_ Functional;
752 static ProblemType const type = Functional::type;
753
754 typedef typename Functional::Scalar Scalar;
755
756 typedef typename Functional::AnsatzVars AnsatzVars;
757 typedef typename Functional::TestVars TestVars;
758 typedef typename Functional::OriginVars OriginVars;
759
760
770 typedef typename Functional::OriginVars::VariableSet PointOfLinearization;
771
776 : f(f_), u1(u1_), u2(u2_) {};
777
779 {
780 public:
782 : dc1(f,u1,flags), dc2(f,u2,flags) {}
783
784 template <class Cell>
785 void moveTo(Cell const& entity) { dc1.moveTo(entity); dc2.moveTo(entity); }
786
787 template <class Position, class Evaluators>
788 void evaluateAt(Position const& x, Evaluators const& evaluators) { dc1.evaluateAt(x,evaluators); dc2.evaluateAt(x,evaluators); }
789
790 Scalar d0() const { return dc1.d0()-dc2.d0(); }
791
792 template<int row, int dim>
795 {
796 return dc1.template d1<row>(arg)-dc2.template d1<row>(arg);
797 }
798
799 template<int row, int col, int dim>
802 {
803 return dc1.template d2<row,col>(arg1,arg2)-dc2.template d2<row,col>(arg1,arg2);
804 }
805
806
807 private:
808 typename Functional::DomainCache dc1, dc2;
809 };
810
812 {
813 public:
815 : bc1(f,u1,flags), bc2(f,u2,flags) {}
816
817 template <class FaceIterator>
818 void moveTo(FaceIterator const& entity) { bc1.moveTo(entity); bc2.moveTo(entity); }
819
820 template <class Position, class Evaluators>
821 void evaluateAt(Position const& x, Evaluators const& evaluators) { bc1.evaluateAt(x,evaluators); bc2.evaluateAt(x,evaluators); }
822
823 Scalar d0() const { return bc1.d0()-bc2.d0(); }
824
825 template<int row, int dim>
828 {
829 return bc1.template d1<row>(arg)-bc2.template d1<row>(arg);
830 }
831
832 template<int row, int col, int dim>
835 {
836 return bc1.template d2<row,col>(arg1,arg2)-bc2.template d2<row,col>(arg1,arg2);
837 }
838
839 private:
840 typename Functional::BoundaryCache bc1, bc2;
841 };
842
845 {
846 return DomainCache(f,u1,u2,flags);
847 }
848
851 {
852 return BoundaryCache(f,u1,u2,flags);
853 }
854
858 template <int row>
859 struct D1: public Functional::template D1<row> {};
860
862 template <int row, int col>
863 struct D2: public Functional::template D2<row,col> {};
864
866 template <class Cell>
867 int integrationOrder(Cell const& cell, int shapeFunctionOrder, bool boundary) const
868 {
869 return f.template integrationOrder<Cell>(cell, shapeFunctionOrder, boundary);
870 }
871
873 Functional const& getFunctional() const {return f;}
874
875 protected:
876 Functional const& f;
879 };
880
881
882
884 template<class Functional>
886 typename Functional::OriginVars::VariableSet const & u1,
887 typename Functional::OriginVars::VariableSet const & u2)
888 {
890 }
891
892 //---------------------------------------------------------------------
893
905 template <class Functional>
906 class SemiLinearizationAt: public LinearizationAt<Functional>
907 {
908 public:
917 typename Functional::AnsatzVars::VariableSet const& u_,
918 typename Functional::AnsatzVars::VariableSet const& uJ_,
919 typename Functional::AnsatzVars::VariableSet const& du_):
920 LinearizationAt<Functional>(f_,u_), uJ(uJ_), du(du_) {}
921
922 typename Functional::DomainCache createDomainCache(int flags) const
923 {
924 return typename Functional::DomainCache(this->f,this->u,uJ,du,flags);
925 }
926
927 typename Functional::BoundaryCache createBoundaryCache(int flags) const
928 {
929 return typename Functional::BoundaryCache(this->f,this->u,uJ,du,flags);
930 }
931
932 private:
933 typename Functional::AnsatzVars::VariableSet const& uJ;
934 typename Functional::AnsatzVars::VariableSet const& du;
935 };
936
937 template <class Functional>
939 {
940 public:
949 typename Functional::AnsatzVars::VariableSet const& u_,
950 typename Functional::AnsatzVars::VariableSet const& uJ_,
951 typename Functional::AnsatzVars::VariableSet const& du_):
952 LinearizationAt<Functional>(f_,u_), uJ(uJ_), du(du_) {}
953
954 typename Functional::DomainCache createDomainCache(int flags) const
955 {
956 return typename Functional::DomainCache(this->f,this->u,uJ,du,flags);
957 }
958
959 typename Functional::BoundaryCache createBoundaryCache(int flags) const
960 {
961 return typename Functional::BoundaryCache(this->f,this->u,uJ,du,flags);
962 }
963
964 typename Functional::InnerBoundaryCache createInnerBoundaryCache(int flags) const
965 {
966 return typename Functional::InnerBoundaryCache(this->f,this->u,uJ,du,flags);
967 }
968
969 private:
970 typename Functional::AnsatzVars::VariableSet const& uJ;
971 typename Functional::AnsatzVars::VariableSet const& du;
972 };
973
978 template<class Functional>
980 typename Functional::AnsatzVars::VariableSet const& u,
981 typename Functional::AnsatzVars::VariableSet const& uJ,
982 typename Functional::AnsatzVars::VariableSet const& du)
983 {
984 return SemiLinearizationAt<Functional>(f,u,uJ,du);
985 }
986
987 //---------------------------------------------------------------------------------------------
988 //---------------------------------------------------------------------------------------------
989
990
991} /* end of namespace Kaskade */
992
993#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.
Proxy class for the linearization of a nonlinear functional.
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.
Functional const & f
auto makePositiveThreshold() const
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.
Functional::OriginVars OriginVars
BoundaryCache createBoundaryCache(int flags) const
create a boundary cache
DomainCache createDomainCache(int flags) const
create a domain cache
static ProblemType const type
Functional::AnsatzVars AnsatzVars
Proxy class for the linearization of semi-linear time stepping schemes.
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 &)
Documentation of the concept of a quadratic variational functionalThe variational functional concept ...
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.
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
Definition: gridBasics.hh:35
typename GridView::Intersection Face
The type of faces in the grid view.
Definition: gridBasics.hh:42
std::unique_ptr< AbstractFunctional > getFunctional(std::unique_ptr< Functional > &&F)
bool considerFace(Face const &face, std::vector< int > const &boundaryIds, std::vector< int > const &usedIds)
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
Helper class for specifying the number of components of a variable.
Definition: variables.hh:100
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