dune-pdelab  2.4-dev
function.hh
Go to the documentation of this file.
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 
8 #include <dune/common/deprecated.hh>
9 #include <dune/common/exceptions.hh>
10 #include <dune/common/typetraits.hh>
11 #include <dune/common/fvector.hh>
12 #include <dune/common/fmatrix.hh>
13 
14 #include <dune/grid/utility/hierarchicsearch.hh>
15 
16 #include <dune/typetree/typetree.hh>
17 
18 #include "vtkexport.hh"
19 #include "geometrywrapper.hh"
20 
21 namespace Dune {
22  namespace PDELab {
23 
27 
35  template<class DF, int n, class D, class RF, int m, class R>
37  {
39  typedef DF DomainFieldType;
40 
42  enum {
45  };
46 
48  typedef D DomainType;
49 
51  typedef RF RangeFieldType;
52 
54  enum {
57  };
58 
60  typedef R RangeType;
61  };
62 
66  template<class T, class Imp>
68  {
69  public:
71  typedef T Traits;
72 
78  inline void evaluate (const typename Traits::DomainType& x,
79  typename Traits::RangeType& y) const
80  {
81  asImp().evaluate(x,y);
82  }
83 
84  private:
85  Imp& asImp () {return static_cast<Imp &> (*this);}
86  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
87  };
88 
91  {
92  public:
94 
104  template<typename Time>
105  inline void setTime(Time t)
106  { }
107  };
108 
110  template<typename GV>
112  {
114  typedef GV GridViewType;
115 
117  typedef typename GV::Traits::template Codim<0>::Entity ElementType;
118 
119  };
120 
121 
124  {
125 
126  public:
127 
129  struct Output
130  {
132 
137  {
140  };
141  };
142 
144 
148  : _dataSetType(dataSetType)
149  {}
150 
153  {
154  return _dataSetType;
155  }
156 
159  {
160  _dataSetType = dataSetType;
161  }
162 
163  private:
164 
165  Output::DataSetType _dataSetType;
166 
167  };
168 
174  template<class GV, class RF, int m, class R>
176  : public FunctionTraits<typename GV::Grid::ctype, GV::dimension,
177  Dune::FieldVector<typename GV::Grid::ctype,
178  GV::dimension>,
179  RF, m, R>
181  {
182  };
183 
185  template<class T, class Imp>
188  {
189  public:
191  typedef T Traits;
192 
195  {}
196 
206  inline void evaluate (const typename Traits::ElementType& e,
207  const typename Traits::DomainType& x,
208  typename Traits::RangeType& y) const
209  {
210  asImp().evaluate(e,x,y);
211  }
212 
214  inline const typename Traits::GridViewType& getGridView () const
215  {
216  return asImp().getGridView();
217  }
218 
219  private:
220  Imp& asImp () {return static_cast<Imp &> (*this);}
221  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
222  };
223 
229  template<class GV, class RF, int m, class R>
231  : public FunctionTraits<typename GV::Grid::ctype, GV::dimension-1,
232  Dune::FieldVector<typename GV::Grid::ctype,
233  GV::dimension-1>,
234  RF, m, R>
235  {
237  typedef GV GridViewType;
238  };
239 
240 
242  // \tparam T The type of the BoundaryGridFunctionTraits.
243  // \tparam Imp The type of the implementing class.
244  template<class T, class Imp>
246  {
247  public:
249  typedef T Traits;
250 
260  template<typename I>
261  inline void evaluate (const IntersectionGeometry<I>& ig,
262  const typename Traits::DomainType& x,
263  typename Traits::RangeType& y) const
264  {
265  asImp().evaluate(ig,x,y);
266  }
267 
269  inline const typename Traits::GridViewType& getGridView () const
270  {
271  return asImp().getGridView();
272  }
273 
274  private:
275  Imp& asImp () {return static_cast<Imp &> (*this);}
276  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
277  };
278 
281 
287  template<typename G, typename T>
289  public TypeTree::LeafNode,
290  public GridFunctionInterface<GridFunctionTraits<
291  G,
292  typename T::Traits::RangeFieldType,
293  T::Traits::dimRange,
294  typename T::Traits::RangeType>,
295  FunctionToGridFunctionAdapter<G,T> >
296  {
297  public:
298  typedef GridFunctionTraits<G,
299  typename T::Traits::RangeFieldType,
300  T::Traits::dimRange,
301  typename T::Traits::RangeType> Traits;
302  static_assert(
303  (is_same<typename T::Traits::DomainFieldType,
304  typename Traits::DomainFieldType>::value),
305  "GridView's and wrapped Functions DomainFieldType don't match");
306  static_assert(
307  T::Traits::dimDomain==Traits::dimDomain,
308  "GridView's and wrapped Functions dimDomain don't match");
309  static_assert(
310  (is_same<typename T::Traits::DomainType,
311  typename Traits::DomainType>::value),
312  "GridView's and wrapped Functions DomainType don't match");
313 
319  FunctionToGridFunctionAdapter (const G& g_, const T& t_) : g(g_), t(t_) {}
320 
321  inline void evaluate (const typename Traits::ElementType& e,
322  const typename Traits::DomainType& x,
323  typename Traits::RangeType& y) const
324  {
325  t.evaluate(e.geometry().global(x),y);
326  }
327 
328  inline const typename Traits::GridViewType& getGridView () const
329  {
330  return g;
331  }
332 
333  private:
334  G g;
335  const T& t;
336  };
337 
342  template<typename GF>
344  : public FunctionInterface<FunctionTraits<typename GF::Traits::GridViewType::ctype,
345  GF::Traits::GridViewType::dimensionworld,
346  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
347  GF::Traits::GridViewType::dimensionworld
348  >,
349  typename GF::Traits::RangeFieldType,
350  GF::Traits::dimRange,
351  Dune::FieldVector<typename GF::Traits::RangeFieldType,
352  GF::Traits::dimRange>
353  >,
354  GridFunctionToFunctionAdapter<GF> >
355  {
356  public:
358  typedef FunctionTraits<typename GF::Traits::GridViewType::ctype,
359  GF::Traits::GridViewType::dimensionworld,
360  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
361  GF::Traits::GridViewType::dimensionworld
362  >,
363  typename GF::Traits::RangeFieldType,
364  GF::Traits::dimRange,
365  Dune::FieldVector<typename GF::Traits::RangeFieldType,
366  GF::Traits::dimRange>
368 
371  : gf(gf_)
372  , hsearch(gf.getGridView().grid(), gf.getGridView().indexSet())
373  { }
374 
380  inline void evaluate (const typename Traits::DomainType& x,
381  typename Traits::RangeType& y) const
382  {
383  typename GF::Traits::GridViewType::Grid::Traits::template Codim<0>::EntityPointer
384  ep = hsearch.findEntity(x);
385  gf.evaluate(*ep, ep->geometry().local(x), y);
386  }
387 
388  private:
389  const GF &gf;
390  const Dune::HierarchicSearch<typename GF::Traits::GridViewType::Grid,
391  typename GF::Traits::GridViewType::IndexSet> hsearch;
392  };
393 
394 
400  template<typename T, typename E>
402  public FunctionInterface<typename T::Traits,
403  GlobalFunctionToLocalFunctionAdapter<T,E> >
404  {
405  public:
406  typedef typename T::Traits Traits;
407 
413  GlobalFunctionToLocalFunctionAdapter (const T& t_, const E& e_) : t(t_), e(e_) {}
414 
420  inline void evaluate (const typename Traits::DomainType& x,
421  typename Traits::RangeType& y) const
422  {
423  t.evaluate(e.geometry().global(x),y);
424  }
425 
426  private:
427  const T& t;
428  const E& e;
429  };
430 
431 
436  template<typename T> // T: GridFunction, E: Entity
438  public FunctionInterface<typename T::Traits,
439  GridFunctionToLocalFunctionAdapter<T> >
440  {
441  public:
442  typedef typename T::Traits Traits;
443 
450  const typename Traits::ElementType& e_)
451  : t(t_), e(e_) {}
452 
458  inline void evaluate (const typename Traits::DomainType& x,
459  typename Traits::RangeType& y) const
460  {
461  t.evaluate(e,x,y);
462  }
463 
464  private:
465  const T& t;
466  const typename Traits::ElementType& e;
467  };
468 
469 
471  template<class T>
472  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> >
473  {
475  public:
477  typedef typename BaseT::Traits Traits;
478 
479  SelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
480 
486  inline void evaluate (const typename Traits::DomainType& x,
487  typename Traits::RangeType& y) const
488  {
489  typename T::Traits::RangeType Y;
490  t.evaluate(x,Y);
491  y = Y[k];
492  }
493 
495  void select (int k_)
496  {
497  k = k_;
498  }
499 
500  private:
501  const T& t;
502  int k;
503  };
504 
506  template<class T>
508  : public BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
509  typename T::Traits::RangeFieldType,1,
510  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
511  BoundaryGridFunctionSelectComponentAdapter<T> >
512  {
513  typedef BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
514  typename T::Traits::RangeFieldType,1,
515  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
517  public:
519  typedef typename BaseT::Traits Traits;
520 
521  BoundaryGridFunctionSelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
522 
528  template<typename I>
529  inline void evaluate (const IntersectionGeometry<I>& ig,
530  const typename Traits::DomainType& x,
531  typename Traits::RangeType& y) const
532  {
533  typename T::Traits::RangeType Y;
534  t.evaluate(ig,x,Y);
535  y = Y[k];
536  }
537 
539  inline const typename Traits::GridViewType& getGridView () const
540  {
541  return t.getGridView();
542  }
543 
544 
546  void select (int k_)
547  {
548  k = k_;
549  }
550 
551  private:
552  const T& t;
553  int k;
554  };
555 
557 
558  //============================
559  // Function tree
560  //============================
561 
564 
565  struct GridFunctionTag {};
566 
575  template<class T, class Imp>
577  : public GridFunctionInterface<T,Imp>
578  , public TypeTree::LeafNode
579  {
580  public:
583  typedef typename T::GridViewType GridViewType;
584  };
585 
586 
595  template<class T, class Imp>
597  : public BoundaryGridFunctionInterface<T,Imp>
598  , public TypeTree::LeafNode
599  {
600  public:
603  typedef typename T::GridViewType GridViewType;
604  };
605 
606 
613  template<typename TT>
615  : public TypeTree::TreeVisitor, public TypeTree::DynamicTraversal
616  {
617  TT time;
618  PowerCompositeSetTimeVisitor(const TT time_) : time(time_) {}
619 
620  template<typename LeafNode, typename TreePath>
621  void leaf(LeafNode& node, TreePath treePath) const
622  {
623  node.setTime(time);
624  }
625  };
626 
628 
636  template<class T, std::size_t k>
638  : public TypeTree::PowerNode<T,k>
639  {
640 
641  typedef TypeTree::PowerNode<T,k> BaseT;
642 
643  public:
644 
646 
648 
650  typedef typename T::GridViewType GridViewType;
651 
653  template <typename TT>
654  void setTime(TT time){
655  PowerCompositeSetTimeVisitor<TT> visitor(time);
656  TypeTree::applyToTree(*this,visitor);
657  }
658 
660  {}
661 
664  : BaseT(t) {}
665 
675  // TODO: PowerGridFunction (T** t) : ...
676 
677 #ifdef DOXYGEN
678 
688  PowerGridFunction (T& t0, T& t1, ...)
689  {
690  }
691 
692 #else
693 
694  PowerGridFunction (T& c0,
695  T& c1)
696  : BaseT(c0,c1)
697  {
698  }
699 
700  PowerGridFunction (T& c0,
701  T& c1,
702  T& c2)
703  : BaseT(c0,c1,c2)
704  {
705  }
706 
707  PowerGridFunction (T& c0,
708  T& c1,
709  T& c2,
710  T& c3)
711  : BaseT(c0,c1,c2,c3)
712  {
713  }
714 
715  PowerGridFunction (T& c0,
716  T& c1,
717  T& c2,
718  T& c3,
719  T& c4)
720  : BaseT(c0,c1,c2,c3,c4)
721  {
722  }
723 
724  PowerGridFunction (T& c0,
725  T& c1,
726  T& c2,
727  T& c3,
728  T& c4,
729  T& c5)
730  : BaseT(c0,c1,c2,c3,c4,c5)
731  {
732  }
733 
734  PowerGridFunction (T& c0,
735  T& c1,
736  T& c2,
737  T& c3,
738  T& c4,
739  T& c5,
740  T& c6)
741  : BaseT(c0,c1,c2,c3,c4,c5,c6)
742  {
743  }
744 
745  PowerGridFunction (T& c0,
746  T& c1,
747  T& c2,
748  T& c3,
749  T& c4,
750  T& c5,
751  T& c6,
752  T& c7)
753  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7)
754  {
755  }
756 
757  PowerGridFunction (T& c0,
758  T& c1,
759  T& c2,
760  T& c3,
761  T& c4,
762  T& c5,
763  T& c6,
764  T& c7,
765  T& c8)
766  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8)
767  {
768  }
769 
770  PowerGridFunction (T& c0,
771  T& c1,
772  T& c2,
773  T& c3,
774  T& c4,
775  T& c5,
776  T& c6,
777  T& c7,
778  T& c8,
779  T& c9)
780  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9)
781  {
782  }
783 
784 #endif // DOXYGEN
785  };
786 
788 
798  template<typename... Children>
800  : public TypeTree::CompositeNode<Children...>
801  {
802 
803  typedef TypeTree::CompositeNode<Children...> BaseT;
804 
805  public:
806 
808 
810 
812  typedef typename BaseT::template Child<0>::Type::GridViewType GridViewType;
813 
815  {}
816 
817  CompositeGridFunction (Children&... children)
818  : BaseT(TypeTree::assertGridViewType<typename BaseT::template Child<0>::Type>(children)...)
819  {
820  }
821 
823  template <typename TT>
824  void setTime(TT time){
825  PowerCompositeSetTimeVisitor<TT> visitor(time);
826  TypeTree::applyToTree(*this,visitor);
827  }
828 
829 #ifdef DOXYGEN
830 
839  CompositeGridFunction (T0& t0, T1& t1, ...) {}
840 #endif //DOXYGEN
841  };
842 
843  //========================================================
844  // helper template to turn an ordinary GridFunction into a
845  // GridFunctionTree leaf
846  //========================================================
848 
851  template<class Imp>
853  : public GridFunctionBase<typename Imp::Traits,
854  GridFunctionBaseAdapter<Imp> >
855  {
856  const Imp &imp;
857 
858  public:
860 
865  GridFunctionBaseAdapter(const Imp& imp_)
866  : imp(imp_)
867  { }
868 
870 
878  inline void evaluate (const typename Imp::Traits::ElementType& e,
879  const typename Imp::Traits::DomainType& x,
880  typename Imp::Traits::RangeType& y) const
881  {
882  imp.evaluate(e,x,y);
883  }
884 
886  inline const typename Imp::Traits::GridViewType& getGridView () const
887  {
888  return imp.getGridView();
889  }
890  };
891 
892  //=======================================
893  // helper template for analytic functions
894  //=======================================
895 
897  template<typename GV, typename RF, int m>
899  : public GridFunctionTraits<GV, RF, m, Dune::FieldVector<RF,m> >
900  {
901  };
902 
915  template<typename T, typename Imp>
917  : public GridFunctionBase<T,AnalyticGridFunctionBase<T,Imp> >
918  {
919  public:
920  typedef T Traits;
921 
923  AnalyticGridFunctionBase (const typename Traits::GridViewType& g_) : g(g_) {}
924 
926  inline void evaluate (const typename Traits::ElementType& e,
927  const typename Traits::DomainType& x,
928  typename Traits::RangeType& y) const
929  {
930  asImp().evaluateGlobal(e.geometry().global(x),y);
931  }
932 
933  inline const typename Traits::GridViewType& getGridView () const
934  {
935  return g;
936  }
937 
938  private:
939  typename Traits::GridViewType g;
940  Imp& asImp () {return static_cast<Imp &> (*this);}
941  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
942  };
943 
944 
945  // Adapter takes a vector-valued grid function and provides evaluation
946  // of normal flux on the interior of faces.
947  template<typename T>
949  : public Dune::PDELab::GridFunctionInterface<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
950  typename T::Traits::RangeFieldType,
951  1,
952  Dune::FieldVector<typename T::Traits::RangeFieldType,1>
953  >,
954  NormalFluxGridFunctionAdapter<T> >
955  , public TypeTree::LeafNode
956  {
957  public:
960 
961  NormalFluxGridFunctionAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
962 
963 
964  inline void evaluate (const typename Traits::ElementType& e,
965  const typename Traits::DomainType& x,
966  typename Traits::RangeType& y) const
967  {
968  // ensure correct size
969  static_assert((static_cast<int>(T::Traits::GridViewType::dimension)==static_cast<int>(T::Traits::dimRange)),"number of components must equal dimension");
970 
971  // evaluate velocity
972  typename T::Traits::RangeType v;
973  t->evaluate(e,x,v);
974 
975  // implementation only handles triangles so far
976  if (!e.geometry().type().isTriangle())
977  DUNE_THROW(Dune::NotImplemented, "only implemented for triangles");
978 
979  // start and end corner in local numbering
980  int n0, n1;
981 
982  typename Traits::DomainType nu;
983 
984  // determine outer unit normal
985  if (std::abs(x[0])<1E-10)
986  {
987  // edge 1
988  n0 = 2;
989  n1 = 0;
990 
991  nu = e.geometry().corner(n1);
992  nu -= e.geometry().corner(n0);
993  typename Traits::DomainFieldType temp = nu[0];
994  nu[0] = nu[1];
995  nu[1] = -temp;
996  nu /= nu.two_norm();
997  y = v[0]*nu[0]+v[1]*nu[1];
998  return;
999  }
1000 
1001  if (std::abs(x[1])<1E-10)
1002  {
1003  // edge 2
1004  n0 = 0;
1005  n1 = 1;
1006 
1007  nu = e.geometry().corner(n1);
1008  nu -= e.geometry().corner(n0);
1009  typename Traits::DomainFieldType temp = nu[0];
1010  nu[0] = nu[1];
1011  nu[1] = -temp;
1012  nu /= nu.two_norm();
1013  y = v[0]*nu[0]+v[1]*nu[1];
1014  return;
1015  }
1016 
1017  if (std::abs(x[0]+x[1]-1.0)<1E-10)
1018  {
1019  // edge 0
1020  n0 = 1;
1021  n1 = 2;
1022 
1023  nu = e.geometry().corner(n1);
1024  nu -= e.geometry().corner(n0);
1025  typename Traits::DomainFieldType temp = nu[0];
1026  nu[0] = nu[1];
1027  nu[1] = -temp;
1028  nu /= nu.two_norm();
1029  y = v[0]*nu[0]+v[1]*nu[1];
1030  return;
1031  }
1032 
1033  DUNE_THROW(Dune::Exception, "x needs to be on an edge");
1034  }
1035 
1037  inline const typename Traits::GridViewType& getGridView () const
1038  {
1039  return t->getGridView();
1040  }
1041 
1042  private:
1043  shared_ptr<T const> t;
1044  };
1045 
1046  // Adapter takes a vector-valued grid function and applies
1047  // backward Piola transformation on each element
1048  template<typename T>
1050  : public Dune::PDELab::GridFunctionInterface<typename T::Traits,PiolaBackwardAdapter<T> >
1051  , public TypeTree::LeafNode
1052  {
1053  public:
1054  typedef typename T::Traits::GridViewType GridViewType;
1055  typedef typename T::Traits Traits;
1057 
1058  PiolaBackwardAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
1059 
1060 
1061  inline void evaluate (const typename Traits::ElementType& e,
1062  const typename Traits::DomainType& x,
1063  typename Traits::RangeType& y) const
1064  {
1065  // evaluate velocity
1066  typename T::Traits::RangeType v;
1067  t->evaluate(e,x,v);
1068 
1069  // apply Piola transformation
1070  typename Traits::ElementType::Geometry::JacobianInverseTransposed
1071  J = e.geometry().jacobianInverseTransposed(x);
1072  y = 0;
1073  J.umtv(v,y);
1074  y *= e.geometry().integrationElement(x);
1075  }
1076 
1078  inline const typename Traits::GridViewType& getGridView () const
1079  {
1080  return t->getGridView();
1081  }
1082 
1083  private:
1084  shared_ptr<T const> t;
1085  };
1086 
1087 
1088  //==========================
1089  // template metaprograms
1090  //==========================
1091 
1092  namespace {
1093 
1095  template<typename VTKWriter>
1096  struct AddGridFunctionsToVTKWriter
1097  : public TypeTree::TreeVisitor
1098  , public TypeTree::DynamicTraversal
1099  {
1100 
1101  VTKWriter& w;
1102  const std::string s;
1103 
1104  AddGridFunctionsToVTKWriter(VTKWriter& w_, const std::string & s_) :
1105  w(w_), s(s_) {}
1106 
1107  template<typename T, typename TreePath>
1108  void leaf(const T& t, TreePath treePath) {
1109  std::stringstream name;
1110  name << s;
1111  for (std::size_t i=0; i < treePath.size(); ++i)
1112  name << "_" << treePath.element(i);
1113  w.addVertexData(make_shared< VTKGridFunctionAdapter<T> >(t,name.str()));
1114  }
1115  };
1116 
1117  } // anonymous namespace
1118 
1124  template<typename GV, typename T>
1125  void vtkwriter_tree_addvertexdata (Dune::VTKWriter<GV>& w, const T& t, std::string s = "data")
1126  {
1127  AddGridFunctionsToVTKWriter<Dune::VTKWriter<GV> > visitor(w,s);
1128  TypeTree::applyToTree(t,visitor);
1129  }
1130 
1132 
1134 
1135  } // namespace PDELab
1136 } // namespace Dune
1137 
1138 #endif
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:1061
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:926
BaseT::Traits Traits
Export type traits.
Definition: function.hh:519
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:583
GridFunctionTag ImplementationTag
Definition: function.hh:601
const Traits::GridViewType & getGridView() const
Definition: function.hh:328
Dune::PDELab::GridFunctionInterface< Traits, PiolaBackwardAdapter< T > > BaseT
Definition: function.hh:1056
TT time
Definition: function.hh:617
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:486
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:529
PowerGridFunction(T &t)
Construct a PowerGridFunction with k clones of the function t.
Definition: function.hh:663
CompositeGridFunctionTag ImplementationTag
Definition: function.hh:807
NormalFluxGridFunctionAdapter(const T &t_)
Definition: function.hh:961
GV The type of the grid view the function lives on.
Definition: function.hh:111
GlobalFunctionToLocalFunctionAdapter(const T &t_, const E &e_)
Create a GlobalFunctionToLocalFunctionAdapter.
Definition: function.hh:413
make a Function from a GridFunction
Definition: function.hh:343
Turn an ordinary GridFunction into a GridFunctionTree leaf.
Definition: function.hh:852
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:321
void setTime(Time t)
set time for subsequent evaluation
Definition: function.hh:105
BaseT::template Child< 0 >::Type::GridViewType GridViewType
record the GridView
Definition: function.hh:812
CompositeGridFunction(Children &...children)
Definition: function.hh:817
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:380
make a GridFunction from a Function
Definition: function.hh:288
dimension of the domain
Definition: function.hh:44
a Function that maps x in DomainType to y in RangeType
Definition: function.hh:67
SelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:479
const E & e
Definition: interpolate.hh:172
product of identical functions
Definition: function.hh:637
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:539
PowerCompositeSetTimeVisitor(const TT time_)
Definition: function.hh:618
void select(int k_)
set component to be selected
Definition: function.hh:495
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:214
traits class holding function signature, same as in local function
Definition: function.hh:230
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:114
GridFunctionToLocalFunctionAdapter(const T &t_, const typename Traits::ElementType &e_)
Create a GridFunctionToLocalFunctionAdapter.
Definition: function.hh:449
Default class for additional methods in instationary functions.
Definition: function.hh:90
GridFunctionTraits< G, typename T::Traits::RangeFieldType, T::Traits::dimRange, typename T::Traits::RangeType > Traits
Definition: function.hh:301
Namespace for output-related data types and enums.
Definition: function.hh:129
T Traits
Definition: function.hh:920
Definition: function.hh:787
const IG & ig
Definition: constraints.hh:147
static const unsigned int value
Definition: gridfunctionspace/tags.hh:175
leaf of a function tree
Definition: function.hh:576
PowerGridFunctionTag ImplementationTag
Definition: function.hh:647
T::GridViewType GridViewType
record the GridView
Definition: function.hh:650
A data set with vertex values.
Definition: function.hh:138
CompositeGridFunction(T0 &t0, T1 &t1,...)
Initialize all children.
Definition: function.hh:839
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:824
function signature for analytic functions on a grid
Definition: function.hh:898
Mixin base class for specifying output hints to I/O routines like VTK.
Definition: function.hh:123
GV GridViewType
Export grid view type in addition.
Definition: function.hh:237
GridFunctionInterface(Output::DataSetType dataSetType=Output::vertexData)
Definition: function.hh:193
composite functions
Definition: function.hh:799
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:269
BoundaryGridFunctionSelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:521
RF RangeFieldType
Export type for range field.
Definition: function.hh:51
const Traits::GridViewType & getGridView() const
Definition: function.hh:933
T::Traits Traits
Definition: function.hh:442
const Imp::Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:886
D DomainType
domain type in dim-size coordinates
Definition: function.hh:48
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, 1, Dune::FieldVector< typename T::Traits::RangeFieldType, 1 > > Traits
Definition: function.hh:958
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:206
PowerGridFunction(T &t0, T &t1,...)
Initialize all children with different function objects.
Definition: function.hh:688
GridFunctionToFunctionAdapter(const GF &gf_)
make a GridFunctionToFunctionAdapter
Definition: function.hh:370
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition: function.hh:614
T Traits
Export type traits.
Definition: function.hh:191
traits class holding the function signature, same as in local function
Definition: function.hh:175
DataSetType
The type of the data set.
Definition: function.hh:136
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:878
CompositeGridFunction()
Definition: function.hh:814
GridFunctionBaseAdapter(const Imp &imp_)
construct a GridFunctionBaseAdapter
Definition: function.hh:865
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:603
PowerCompositeGridFunctionTraits< typename T::GridViewType > Traits
Definition: function.hh:645
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:964
T::Traits Traits
Definition: function.hh:406
Output::DataSetType dataSetType() const
Return the data set type of this function.
Definition: function.hh:152
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1037
Definition: adaptivity.hh:27
Takes a BoundaryGridFunction and acts as a single component.
Definition: function.hh:507
an analytic grid function
Definition: function.hh:916
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:78
GridFunctionTag ImplementationTag
Definition: function.hh:581
Wrap intersection.
Definition: geometrywrapper.hh:56
a Function maps x in DomainType to y in RangeType
Definition: function.hh:472
leaf of a function tree
Definition: function.hh:596
BaseT::Traits Traits
Export type traits.
Definition: function.hh:477
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:367
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:458
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:117
T Traits
Export type traits.
Definition: function.hh:71
T::Traits Traits
Definition: function.hh:1055
const std::string s
Definition: function.hh:1102
AnalyticGridFunctionBase(const typename Traits::GridViewType &g_)
Construct an Analytic GridFunctionBase given a GridView g_.
Definition: function.hh:923
Definition: function.hh:1049
A data set with cell values.
Definition: function.hh:139
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1078
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:186
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:420
R RangeType
range type
Definition: function.hh:60
void leaf(LeafNode &node, TreePath treePath) const
Definition: function.hh:621
Definition: function.hh:36
A BoundaryGridFunction allows evaluation on boundary intersections.
Definition: function.hh:245
DF DomainFieldType
Export type for domain field.
Definition: function.hh:39
T::Traits::GridViewType GridViewType
Definition: function.hh:1054
Definition: function.hh:627
T Traits
Export type traits of the boundary grid function.
Definition: function.hh:249
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:654
PowerCompositeGridFunctionTraits< typename BaseT::template Child< 0 >::Type::GridViewType > Traits
Definition: function.hh:809
PiolaBackwardAdapter(const T &t_)
Definition: function.hh:1058
make a LocalFunction from a GridFunction using local coordinates
Definition: function.hh:437
VTKWriter & w
Definition: function.hh:1101
Dune::PDELab::GridFunctionInterface< Traits, NormalFluxGridFunctionAdapter< T > > BaseT
Definition: function.hh:959
void setDataSetType(Output::DataSetType dataSetType)
Set the data set type of this function.
Definition: function.hh:158
PowerGridFunction()
Definition: function.hh:659
dimension of the range
Definition: function.hh:56
Definition: function.hh:565
FunctionToGridFunctionAdapter(const G &g_, const T &t_)
Create a FunctionToGridFunctionAdapter.
Definition: function.hh:319
make a Function in local coordinates from a Function in global coordinates
Definition: function.hh:401
GridFunctionOutputParameters(Output::DataSetType dataSetType=Output::vertexData)
Standard constructor.
Definition: function.hh:147
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:261
void select(int k_)
set component to be selected
Definition: function.hh:546
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:1125
Definition: vtk.hh:27