DUNE PDELab (git)

function.hh
1//-*- tab-width: 4; indent-tabs-mode: nil -*-
2#ifndef DUNE_PDELAB_FUNCTION_HH
3#define DUNE_PDELAB_FUNCTION_HH
4
5#include <iostream>
6#include <sstream>
7
14
16
17#include <dune/typetree/typetree.hh>
18
19#include "vtkexport.hh"
20#include "geometrywrapper.hh"
21#include "typetraits.hh"
22
23namespace Dune {
24 namespace PDELab {
25
29
37 template<class DF, int n, class D, class RF, int m, class R>
39 {
41 typedef DF DomainFieldType;
42
44 enum {
46 dimDomain = n
47 };
48
50 typedef D DomainType;
51
53 typedef RF RangeFieldType;
54
56 enum {
58 dimRange = m
59 };
60
62 typedef R RangeType;
63 };
64
68 template<class T, class Imp>
70 {
71 public:
73 typedef T Traits;
74
80 inline void evaluate (const typename Traits::DomainType& x,
81 typename Traits::RangeType& y) const
82 {
83 asImp().evaluate(x,y);
84 }
85
86 private:
87 Imp& asImp () {return static_cast<Imp &> (*this);}
88 const Imp& asImp () const {return static_cast<const Imp &>(*this);}
89 };
90
93 {
94 public:
96
106 template<typename Time>
107 inline void setTime(Time t)
108 { }
109 };
110
112 template<typename GV>
114 {
116 typedef GV GridViewType;
117
119 typedef typename GV::Traits::template Codim<0>::Entity ElementType;
120
121 };
122
123
126 {
127
128 public:
129
131 struct Output
132 {
134
139 {
141 cellData
142 };
143 };
144
146
150 : _dataSetType(dataSetType)
151 {}
152
155 {
156 return _dataSetType;
157 }
158
161 {
162 _dataSetType = dataSetType;
163 }
164
165 private:
166
167 Output::DataSetType _dataSetType;
168
169 };
170
176 template<class GV, class RF, int m, class R>
178 : public FunctionTraits<typename GV::Grid::ctype, GV::dimension,
179 Dune::FieldVector<typename GV::Grid::ctype,
180 GV::dimension>,
181 RF, m, R>
183 {
184 };
185
187 template<class T, class Imp>
190 {
191 public:
193 typedef T Traits;
194
197 {}
198
208 inline void evaluate (const typename Traits::ElementType& e,
209 const typename Traits::DomainType& x,
210 typename Traits::RangeType& y) const
211 {
212 asImp().evaluate(e,x,y);
213 }
214
216 inline const typename Traits::GridViewType& getGridView () const
217 {
218 return asImp().getGridView();
219 }
220
221 private:
222 Imp& asImp () {return static_cast<Imp &> (*this);}
223 const Imp& asImp () const {return static_cast<const Imp &>(*this);}
224 };
225
231 template<class GV, class RF, int m, class R>
233 : public FunctionTraits<typename GV::Grid::ctype, GV::dimension-1,
234 Dune::FieldVector<typename GV::Grid::ctype,
235 GV::dimension-1>,
236 RF, m, R>
237 {
239 typedef GV GridViewType;
240 };
241
242
244 // \tparam T The type of the BoundaryGridFunctionTraits.
245 // \tparam Imp The type of the implementing class.
246 template<class T, class Imp>
248 {
249 public:
251 typedef T Traits;
252
262 template<typename I>
263 inline void evaluate (const IntersectionGeometry<I>& ig,
264 const typename Traits::DomainType& x,
265 typename Traits::RangeType& y) const
266 {
267 asImp().evaluate(ig,x,y);
268 }
269
271 inline const typename Traits::GridViewType& getGridView () const
272 {
273 return asImp().getGridView();
274 }
275
276 private:
277 Imp& asImp () {return static_cast<Imp &> (*this);}
278 const Imp& asImp () const {return static_cast<const Imp &>(*this);}
279 };
280
281 //============================
282 // Function tree
283 //============================
284
287
288 struct GridFunctionTag {};
289
298 template<class T, class Imp>
300 : public GridFunctionInterface<T,Imp>
301 , public TypeTree::LeafNode
302 {
304 public:
305 typedef GridFunctionTag ImplementationTag;
307 typedef typename T::GridViewType GridViewType;
308
309 using Output = typename Base::Output;
310
311 GridFunctionBase(typename Output::DataSetType dataSetType = Output::vertexData)
313 {}
314 };
315
316
325 template<class T, class Imp>
327 : public BoundaryGridFunctionInterface<T,Imp>
328 , public TypeTree::LeafNode
329 {
330 public:
331 typedef GridFunctionTag ImplementationTag;
333 typedef typename T::GridViewType GridViewType;
334 };
335
336
343 template<typename TT>
346 {
347 TT time;
348 PowerCompositeSetTimeVisitor(const TT time_) : time(time_) {}
349
350 template<typename LeafNode, typename TreePath>
351 void leaf(LeafNode& node, TreePath treePath) const
352 {
353 node.setTime(time);
354 }
355 };
356
357 struct PowerGridFunctionTag {};
358
366 template<class T, std::size_t k>
368 : public TypeTree::PowerNode<T,k>
369 {
370
372
373 public:
374
376
377 typedef PowerGridFunctionTag ImplementationTag;
378
380 typedef typename T::GridViewType GridViewType;
381
383 template <typename TT>
384 void setTime(TT time){
386 TypeTree::applyToTree(*this,visitor);
387 }
388
390 {}
391
397 PowerGridFunction (const std::array<std::shared_ptr<T>,k>& container)
398 : BaseT(container) {}
399
402 : BaseT(t) {}
403
413 // TODO: PowerGridFunction (T** t) : ...
414
415#ifdef DOXYGEN
426 PowerGridFunction (T& t0, T& t1, ...)
427 {
428 }
429
430#else
431
432 PowerGridFunction (T& c0,
433 T& c1)
434 : BaseT(c0,c1)
435 {
436 }
437
438 PowerGridFunction (T& c0,
439 T& c1,
440 T& c2)
441 : BaseT(c0,c1,c2)
442 {
443 }
444
445 PowerGridFunction (T& c0,
446 T& c1,
447 T& c2,
448 T& c3)
449 : BaseT(c0,c1,c2,c3)
450 {
451 }
452
453 PowerGridFunction (T& c0,
454 T& c1,
455 T& c2,
456 T& c3,
457 T& c4)
458 : BaseT(c0,c1,c2,c3,c4)
459 {
460 }
461
462 PowerGridFunction (T& c0,
463 T& c1,
464 T& c2,
465 T& c3,
466 T& c4,
467 T& c5)
468 : BaseT(c0,c1,c2,c3,c4,c5)
469 {
470 }
471
472 PowerGridFunction (T& c0,
473 T& c1,
474 T& c2,
475 T& c3,
476 T& c4,
477 T& c5,
478 T& c6)
479 : BaseT(c0,c1,c2,c3,c4,c5,c6)
480 {
481 }
482
483 PowerGridFunction (T& c0,
484 T& c1,
485 T& c2,
486 T& c3,
487 T& c4,
488 T& c5,
489 T& c6,
490 T& c7)
491 : BaseT(c0,c1,c2,c3,c4,c5,c6,c7)
492 {
493 }
494
495 PowerGridFunction (T& c0,
496 T& c1,
497 T& c2,
498 T& c3,
499 T& c4,
500 T& c5,
501 T& c6,
502 T& c7,
503 T& c8)
504 : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8)
505 {
506 }
507
508 PowerGridFunction (T& c0,
509 T& c1,
510 T& c2,
511 T& c3,
512 T& c4,
513 T& c5,
514 T& c6,
515 T& c7,
516 T& c8,
517 T& c9)
518 : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9)
519 {
520 }
521
522#endif // DOXYGEN
523 };
524
525 struct CompositeGridFunctionTag {};
526
536 template<typename... Children>
538 : public TypeTree::CompositeNode<Children...>
539 {
540
541 typedef TypeTree::CompositeNode<Children...> BaseT;
542
543 public:
544
545 typedef CompositeGridFunctionTag ImplementationTag;
546
548
550 typedef typename BaseT::template Child<0>::Type::GridViewType GridViewType;
551
553 {}
554
555 CompositeGridFunction (Children&... children)
556 : BaseT(TypeTree::assertGridViewType<typename BaseT::template Child<0>::Type>(children)...)
557 {
558 }
559
560 CompositeGridFunction (std::shared_ptr<Children>... children)
561 : BaseT(children...)
562 {}
563
565 template <typename TT>
566 void setTime(TT time){
568 TypeTree::applyToTree(*this,visitor);
569 }
570
571#ifdef DOXYGEN
581 CompositeGridFunction (T0& t0, T1& t1, ...) {}
582#endif //DOXYGEN
583 };
584
585 //========================================================
586 // helper template to turn an ordinary GridFunction into a
587 // GridFunctionTree leaf
588 //========================================================
590
593 template<class Imp>
595 : public GridFunctionBase<typename Imp::Traits,
596 GridFunctionBaseAdapter<Imp> >
597 {
598 const Imp &imp;
599
600 public:
602
607 GridFunctionBaseAdapter(const Imp& imp_)
608 : imp(imp_)
609 { }
610
612
620 inline void evaluate (const typename Imp::Traits::ElementType& e,
621 const typename Imp::Traits::DomainType& x,
622 typename Imp::Traits::RangeType& y) const
623 {
624 imp.evaluate(e,x,y);
625 }
626
628 inline const typename Imp::Traits::GridViewType& getGridView () const
629 {
630 return imp.getGridView();
631 }
632 };
633
634 //=======================================
635 // helper template for analytic functions
636 //=======================================
637
639 template<typename GV, typename RF, int m>
641 : public GridFunctionTraits<GV, RF, m, Dune::FieldVector<RF,m> >
642 {
643 };
644
657 template<typename T, typename Imp>
659 : public GridFunctionBase<T,AnalyticGridFunctionBase<T,Imp> >
660 {
661 public:
662 typedef T Traits;
663
665 AnalyticGridFunctionBase (const typename Traits::GridViewType& g_) : g(g_) {}
666
668 inline void evaluate (const typename Traits::ElementType& e,
669 const typename Traits::DomainType& x,
670 typename Traits::RangeType& y) const
671 {
672 asImp().evaluateGlobal(e.geometry().global(x),y);
673 }
674
675 inline const typename Traits::GridViewType& getGridView () const
676 {
677 return g;
678 }
679
680 private:
681 typename Traits::GridViewType g;
682 Imp& asImp () {return static_cast<Imp &> (*this);}
683 const Imp& asImp () const {return static_cast<const Imp &>(*this);}
684 };
685
686
687 // Adapter takes a vector-valued grid function and provides evaluation
688 // of normal flux on the interior of faces.
689 template<typename T>
690 class NormalFluxGridFunctionAdapter
691 : public Dune::PDELab::GridFunctionBase<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
692 typename T::Traits::RangeFieldType,
693 1,
694 Dune::FieldVector<typename T::Traits::RangeFieldType,1>
695 >,
696 NormalFluxGridFunctionAdapter<T> >
697 {
698 public:
701
702 NormalFluxGridFunctionAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
703
704
705 inline void evaluate (const typename Traits::ElementType& e,
706 const typename Traits::DomainType& x,
707 typename Traits::RangeType& y) const
708 {
709 // ensure correct size
710 static_assert((static_cast<int>(T::Traits::GridViewType::dimension)==static_cast<int>(T::Traits::dimRange)),"number of components must equal dimension");
711
712 // evaluate velocity
713 typename T::Traits::RangeType v;
714 t->evaluate(e,x,v);
715
716 // implementation only handles triangles so far
717 if (!e.geometry().type().isTriangle())
718 DUNE_THROW(Dune::NotImplemented, "only implemented for triangles");
719
720 // start and end corner in local numbering
721 int n0, n1;
722
723 typename Traits::DomainType nu;
724
725 // determine outer unit normal
726 if (std::abs(x[0])<1E-10)
727 {
728 // edge 1
729 n0 = 2;
730 n1 = 0;
731
732 nu = e.geometry().corner(n1);
733 nu -= e.geometry().corner(n0);
734 typename Traits::DomainFieldType temp = nu[0];
735 nu[0] = nu[1];
736 nu[1] = -temp;
737 nu /= nu.two_norm();
738 y = v[0]*nu[0]+v[1]*nu[1];
739 return;
740 }
741
742 if (std::abs(x[1])<1E-10)
743 {
744 // edge 2
745 n0 = 0;
746 n1 = 1;
747
748 nu = e.geometry().corner(n1);
749 nu -= e.geometry().corner(n0);
750 typename Traits::DomainFieldType temp = nu[0];
751 nu[0] = nu[1];
752 nu[1] = -temp;
753 nu /= nu.two_norm();
754 y = v[0]*nu[0]+v[1]*nu[1];
755 return;
756 }
757
758 if (std::abs(x[0]+x[1]-1.0)<1E-10)
759 {
760 // edge 0
761 n0 = 1;
762 n1 = 2;
763
764 nu = e.geometry().corner(n1);
765 nu -= e.geometry().corner(n0);
766 typename Traits::DomainFieldType temp = nu[0];
767 nu[0] = nu[1];
768 nu[1] = -temp;
769 nu /= nu.two_norm();
770 y = v[0]*nu[0]+v[1]*nu[1];
771 return;
772 }
773
774 DUNE_THROW(Dune::Exception, "x needs to be on an edge");
775 }
776
778 inline const typename Traits::GridViewType& getGridView () const
779 {
780 return t->getGridView();
781 }
782
783 private:
784 std::shared_ptr<T const> t;
785 };
786
787 // Adapter takes a vector-valued grid function and applies
788 // backward Piola transformation on each element
789 template<typename T>
790 class PiolaBackwardAdapter
791 : public Dune::PDELab::GridFunctionBase<typename T::Traits,PiolaBackwardAdapter<T> >
792 {
793 public:
794 typedef typename T::Traits::GridViewType GridViewType;
795 typedef typename T::Traits Traits;
797 // typedef GridFunctionTag ImplementationTag;
798
799 PiolaBackwardAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
800
801
802 inline void evaluate (const typename Traits::ElementType& e,
803 const typename Traits::DomainType& x,
804 typename Traits::RangeType& y) const
805 {
806 // evaluate velocity
807 typename T::Traits::RangeType v;
808 t->evaluate(e,x,v);
809
810 // apply Piola transformation
811 typename Traits::ElementType::Geometry::JacobianInverseTransposed
812 J = e.geometry().jacobianInverseTransposed(x);
813 y = 0;
814 J.umtv(v,y);
815 y *= e.geometry().integrationElement(x);
816 }
817
819 inline const typename Traits::GridViewType& getGridView () const
820 {
821 return t->getGridView();
822 }
823
824 private:
825 std::shared_ptr<T const> t;
826 };
827
828
829 //==========================
830 // template metaprograms
831 //==========================
832
833 namespace {
834
836 template<typename VTKWriter>
837 struct AddGridFunctionsToVTKWriter
838 : public TypeTree::TreeVisitor
839 , public TypeTree::DynamicTraversal
840 {
841
842 VTKWriter& w;
843 const std::string s;
844
845 AddGridFunctionsToVTKWriter(VTKWriter& w_, const std::string & s_) :
846 w(w_), s(s_) {}
847
848 template<typename T, typename TreePath>
849 void leaf(const T& t, TreePath treePath) {
850 std::stringstream name;
851 name << s;
852 for (std::size_t i=0; i < treePath.size(); ++i)
853 name << "_" << treePath.element(i);
854 w.addVertexData(std::make_shared< VTKGridFunctionAdapter<T> >(t,name.str()));
855 }
856 };
857
858 } // anonymous namespace
859
865 template<typename GV, typename T>
866 void vtkwriter_tree_addvertexdata (Dune::VTKWriter<GV>& w, const T& t, std::string s = "data")
867 {
868 AddGridFunctionsToVTKWriter<Dune::VTKWriter<GV> > visitor(w,s);
869 TypeTree::applyToTree(t,visitor);
870 }
871
873
876
882 template<typename G, typename T>
884 public GridFunctionBase<GridFunctionTraits<
885 G,
886 typename T::Traits::RangeFieldType,
887 T::Traits::dimRange,
888 typename T::Traits::RangeType>,
889 FunctionToGridFunctionAdapter<G,T> >
890 {
891 public:
892 typedef GridFunctionTraits<G,
893 typename T::Traits::RangeFieldType,
894 T::Traits::dimRange,
895 typename T::Traits::RangeType> Traits;
896 static_assert(
897 (std::is_same<typename T::Traits::DomainFieldType,
898 typename Traits::DomainFieldType>::value),
899 "GridView's and wrapped Functions DomainFieldType don't match");
900 static_assert(
901 T::Traits::dimDomain==Traits::dimDomain,
902 "GridView's and wrapped Functions dimDomain don't match");
903 static_assert(
904 (std::is_same<typename T::Traits::DomainType,
905 typename Traits::DomainType>::value),
906 "GridView's and wrapped Functions DomainType don't match");
907
913 FunctionToGridFunctionAdapter (const G& g_, const T& t_) : g(g_), t(t_) {}
914
915 inline void evaluate (const typename Traits::ElementType& e,
916 const typename Traits::DomainType& x,
917 typename Traits::RangeType& y) const
918 {
919 t.evaluate(e.geometry().global(x),y);
920 }
921
922 inline const typename Traits::GridViewType& getGridView () const
923 {
924 return g;
925 }
926
927 private:
928 G g;
929 const T& t;
930 };
931
936 template<typename GF>
938 : public FunctionInterface<FunctionTraits<typename GF::Traits::GridViewType::ctype,
939 GF::Traits::GridViewType::dimensionworld,
940 Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
941 GF::Traits::GridViewType::dimensionworld
942 >,
943 typename GF::Traits::RangeFieldType,
944 GF::Traits::dimRange,
945 Dune::FieldVector<typename GF::Traits::RangeFieldType,
946 GF::Traits::dimRange>
947 >,
948 GridFunctionToFunctionAdapter<GF> >
949 {
950 public:
952 typedef FunctionTraits<typename GF::Traits::GridViewType::ctype,
953 GF::Traits::GridViewType::dimensionworld,
954 Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
955 GF::Traits::GridViewType::dimensionworld
956 >,
957 typename GF::Traits::RangeFieldType,
958 GF::Traits::dimRange,
959 Dune::FieldVector<typename GF::Traits::RangeFieldType,
960 GF::Traits::dimRange>
962
965 : gf(gf_)
966 , hsearch(gf.getGridView().grid(), gf.getGridView().indexSet())
967 { }
968
974 inline void evaluate (const typename Traits::DomainType& x,
975 typename Traits::RangeType& y) const
976 {
977 typename GF::Traits::GridViewType::Grid::Traits::template Codim<0>::Entity
978 e = hsearch.findEntity(x);
979 gf.evaluate(e, e.geometry().local(x), y);
980 }
981
982 private:
983 const GF &gf;
984 const Dune::HierarchicSearch<typename GF::Traits::GridViewType::Grid,
985 typename GF::Traits::GridViewType::IndexSet> hsearch;
986 };
987
988
994 template<typename T, typename E>
996 public FunctionInterface<typename T::Traits,
997 GlobalFunctionToLocalFunctionAdapter<T,E> >
998 {
999 public:
1000 typedef typename T::Traits Traits;
1001
1007 GlobalFunctionToLocalFunctionAdapter (const T& t_, const E& e_) : t(t_), e(e_) {}
1008
1014 inline void evaluate (const typename Traits::DomainType& x,
1015 typename Traits::RangeType& y) const
1016 {
1017 t.evaluate(e.geometry().global(x),y);
1018 }
1019
1020 private:
1021 const T& t;
1022 const E& e;
1023 };
1024
1025
1030 template<typename T> // T: GridFunction, E: Entity
1032 public FunctionInterface<typename T::Traits,
1033 GridFunctionToLocalFunctionAdapter<T> >
1034 {
1035 public:
1036 typedef typename T::Traits Traits;
1037
1044 const typename Traits::ElementType& e_)
1045 : t(t_), e(e_) {}
1046
1052 inline void evaluate (const typename Traits::DomainType& x,
1053 typename Traits::RangeType& y) const
1054 {
1055 t.evaluate(e,x,y);
1056 }
1057
1058 private:
1059 const T& t;
1060 const typename Traits::ElementType& e;
1061 };
1062
1063
1065 template<class T>
1066 class SelectComponentAdapter : public FunctionInterface<FunctionTraits<typename T::Traits::DomainFieldType,T::Traits::dimDomain,typename T::Traits::DomainType,typename T::Traits::RangeFieldType,1,Dune::FieldVector<typename T::Traits::RangeFieldType,1> > , SelectComponentAdapter<T> >
1067 {
1069 public:
1071 typedef typename BaseT::Traits Traits;
1072
1073 SelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
1074
1080 inline void evaluate (const typename Traits::DomainType& x,
1081 typename Traits::RangeType& y) const
1082 {
1083 typename T::Traits::RangeType Y;
1084 t.evaluate(x,Y);
1085 y = Y[k];
1086 }
1087
1089 void select (int k_)
1090 {
1091 k = k_;
1092 }
1093
1094 private:
1095 const T& t;
1096 int k;
1097 };
1098
1100 template<class T>
1102 : public BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
1103 typename T::Traits::RangeFieldType,1,
1104 Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
1105 BoundaryGridFunctionSelectComponentAdapter<T> >
1106 {
1107 typedef BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
1108 typename T::Traits::RangeFieldType,1,
1111 public:
1113 typedef typename BaseT::Traits Traits;
1114
1115 BoundaryGridFunctionSelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
1116
1122 template<typename I>
1123 inline void evaluate (const IntersectionGeometry<I>& ig,
1124 const typename Traits::DomainType& x,
1125 typename Traits::RangeType& y) const
1126 {
1127 typename T::Traits::RangeType Y;
1128 t.evaluate(ig,x,Y);
1129 y = Y[k];
1130 }
1131
1133 inline const typename Traits::GridViewType& getGridView () const
1134 {
1135 return t.getGridView();
1136 }
1137
1138
1140 void select (int k_)
1141 {
1142 k = k_;
1143 }
1144
1145 private:
1146 const T& t;
1147 int k;
1148 };
1149
1151
1153
1154 } // namespace PDELab
1155} // namespace Dune
1156
1157#endif
Base class for Dune-Exceptions.
Definition: exceptions.hh:96
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Search an IndexSet for an Entity containing a given point.
Definition: hierarchicsearch.hh:35
Entity findEntity(const FieldVector< ct, dimw > &global) const
Search the IndexSet of this HierarchicSearch for an Entity containing point global.
Definition: hierarchicsearch.hh:127
Default exception for dummy implementations.
Definition: exceptions.hh:263
an analytic grid function
Definition: function.hh:660
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: function.hh:668
AnalyticGridFunctionBase(const typename Traits::GridViewType &g_)
Construct an Analytic GridFunctionBase given a GridView g_.
Definition: function.hh:665
leaf of a function tree
Definition: function.hh:329
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:333
A BoundaryGridFunction allows evaluation on boundary intersections.
Definition: function.hh:248
T Traits
Export type traits of the boundary grid function.
Definition: function.hh:251
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:271
void evaluate(const IntersectionGeometry< I > &ig, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: function.hh:263
Takes a BoundaryGridFunction and acts as a single component.
Definition: function.hh:1106
void select(int k_)
set component to be selected
Definition: function.hh:1140
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1133
BaseT::Traits Traits
Export type traits.
Definition: function.hh:1113
void evaluate(const IntersectionGeometry< I > &ig, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:1123
composite functions
Definition: function.hh:539
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:566
CompositeGridFunction(T0 &t0, T1 &t1,...)
Initialize all children.
Definition: function.hh:581
BaseT::template Child< 0 >::Type::GridViewType GridViewType
record the GridView
Definition: function.hh:550
a Function that maps x in DomainType to y in RangeType
Definition: function.hh:70
T Traits
Export type traits.
Definition: function.hh:73
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:80
make a GridFunction from a Function
Definition: function.hh:890
FunctionToGridFunctionAdapter(const G &g_, const T &t_)
Create a FunctionToGridFunctionAdapter.
Definition: function.hh:913
make a Function in local coordinates from a Function in global coordinates
Definition: function.hh:998
GlobalFunctionToLocalFunctionAdapter(const T &t_, const E &e_)
Create a GlobalFunctionToLocalFunctionAdapter.
Definition: function.hh:1007
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:1014
Turn an ordinary GridFunction into a GridFunctionTree leaf.
Definition: function.hh:597
void evaluate(const typename Imp::Traits::ElementType &e, const typename Imp::Traits::DomainType &x, typename Imp::Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: function.hh:620
const Imp::Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:628
GridFunctionBaseAdapter(const Imp &imp_)
construct a GridFunctionBaseAdapter
Definition: function.hh:607
leaf of a function tree
Definition: function.hh:302
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:307
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:190
T Traits
Export type traits.
Definition: function.hh:193
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: function.hh:208
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:216
Mixin base class for specifying output hints to I/O routines like VTK.
Definition: function.hh:126
Output::DataSetType dataSetType() const
Return the data set type of this function.
Definition: function.hh:154
void setDataSetType(Output::DataSetType dataSetType)
Set the data set type of this function.
Definition: function.hh:160
GridFunctionOutputParameters(Output::DataSetType dataSetType=Output::vertexData)
Standard constructor.
Definition: function.hh:149
make a Function from a GridFunction
Definition: function.hh:949
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:974
FunctionTraits< typename GF::Traits::GridViewType::ctype, GF::Traits::GridViewType::dimensionworld, Dune::FieldVector< typename GF::Traits::GridViewType::ctype, GF::Traits::GridViewType::dimensionworld >, typename GF::Traits::RangeFieldType, GF::Traits::dimRange, Dune::FieldVector< typename GF::Traits::RangeFieldType, GF::Traits::dimRange > > Traits
Export type traits.
Definition: function.hh:961
GridFunctionToFunctionAdapter(const GF &gf_)
make a GridFunctionToFunctionAdapter
Definition: function.hh:964
make a LocalFunction from a GridFunction using local coordinates
Definition: function.hh:1034
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:1052
GridFunctionToLocalFunctionAdapter(const T &t_, const typename Traits::ElementType &e_)
Create a GridFunctionToLocalFunctionAdapter.
Definition: function.hh:1043
Default class for additional methods in instationary functions.
Definition: function.hh:93
void setTime(Time t)
set time for subsequent evaluation
Definition: function.hh:107
Wrap intersection.
Definition: geometrywrapper.hh:57
product of identical functions
Definition: function.hh:369
PowerGridFunction(T &t)
Construct a PowerGridFunction with k clones of the function t.
Definition: function.hh:401
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:384
T::GridViewType GridViewType
record the GridView
Definition: function.hh:380
PowerGridFunction(T &t0, T &t1,...)
Initialize all children with different function objects.
Definition: function.hh:426
PowerGridFunction(const std::array< std::shared_ptr< T >, k > &container)
Construct a new Power Grid Function object.
Definition: function.hh:397
a Function maps x in DomainType to y in RangeType
Definition: function.hh:1067
void select(int k_)
set component to be selected
Definition: function.hh:1089
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:1080
BaseT::Traits Traits
Export type traits.
Definition: function.hh:1071
Base class for composite nodes based on variadic templates.
Definition: compositenode.hh:28
Base class for leaf nodes in a dune-typetree.
Definition: leafnode.hh:28
Collect k instances of type T within a dune-typetree.
Definition: powernode.hh:52
Writer for the output of grid functions in the vtk format.
Definition: vtkwriter.hh:95
Definition of the DUNE_NO_DEPRECATED_* macros.
A few common exception classes.
Traits for type conversions and type information.
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
void vtkwriter_tree_addvertexdata(Dune::VTKWriter< GV > &w, const T &t, std::string s="data")
add vertex data from a GridFunctionTree to a VTKWriter
Definition: function.hh:866
constexpr auto treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:326
void applyToTree(Tree &&tree, Visitor &&visitor)
Apply visitor to TypeTree.
Definition: traversal.hh:239
typename impl::_Child< Node, indices... >::type Child
Template alias for the type of a child node given by a list of child indices.
Definition: childextraction.hh:225
Utility class for hierarchically searching for an Entity containing a given point.
Dune namespace.
Definition: alignedallocator.hh:13
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:72
This file implements several utilities related to std::shared_ptr.
Static tag representing a codimension.
Definition: dimension.hh:24
function signature for analytic functions on a grid
Definition: function.hh:642
traits class holding function signature, same as in local function
Definition: function.hh:237
GV GridViewType
Export grid view type in addition.
Definition: function.hh:239
Definition: function.hh:39
D DomainType
domain type in dim-size coordinates
Definition: function.hh:50
R RangeType
range type
Definition: function.hh:62
DF DomainFieldType
Export type for domain field.
Definition: function.hh:41
RF RangeFieldType
Export type for range field.
Definition: function.hh:53
@ dimDomain
dimension of the domain
Definition: function.hh:46
@ dimRange
dimension of the range
Definition: function.hh:58
Namespace for output-related data types and enums.
Definition: function.hh:132
DataSetType
The type of the data set.
Definition: function.hh:139
@ cellData
A data set with cell values.
Definition: function.hh:141
@ vertexData
A data set with vertex values.
Definition: function.hh:140
traits class holding the function signature, same as in local function
Definition: function.hh:183
GV The type of the grid view the function lives on.
Definition: function.hh:114
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:119
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:116
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition: function.hh:346
Mixin base class for visitors that only need a dynamic TreePath during traversal.
Definition: visitor.hh:426
Convenience base class for visiting the entire tree.
Definition: visitor.hh:435
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)