dune-pdelab  2.5-dev
function.hh
Go to the documentation of this file.
1 //-*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_COMMON_FUNCTION_HH
3 #define DUNE_PDELAB_COMMON_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  {
139  cellData
140  };
141  };
142 
144 
147  GridFunctionOutputParameters(Output::DataSetType dataSetType = Output::vertexData)
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 
193  GridFunctionInterface(Output::DataSetType dataSetType = Output::vertexData)
194  : GridFunctionOutputParameters(dataSetType)
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  (std::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  (std::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  auto e = hsearch.findEntity(x);
384  gf.evaluate(e,e.geometry().local(x),y);
385  }
386 
387  private:
388  const GF &gf;
389  const Dune::HierarchicSearch<typename GF::Traits::GridViewType::Grid,
390  typename GF::Traits::GridViewType::IndexSet> hsearch;
391  };
392 
393 
399  template<typename T, typename E>
401  public FunctionInterface<typename T::Traits,
402  GlobalFunctionToLocalFunctionAdapter<T,E> >
403  {
404  public:
405  typedef typename T::Traits Traits;
406 
412  GlobalFunctionToLocalFunctionAdapter (const T& t_, const E& e_) : t(t_), e(e_) {}
413 
419  inline void evaluate (const typename Traits::DomainType& x,
420  typename Traits::RangeType& y) const
421  {
422  t.evaluate(e.geometry().global(x),y);
423  }
424 
425  private:
426  const T& t;
427  const E& e;
428  };
429 
430 
435  template<typename T> // T: GridFunction, E: Entity
437  public FunctionInterface<typename T::Traits,
438  GridFunctionToLocalFunctionAdapter<T> >
439  {
440  public:
441  typedef typename T::Traits Traits;
442 
449  const typename Traits::ElementType& e_)
450  : t(t_), e(e_) {}
451 
457  inline void evaluate (const typename Traits::DomainType& x,
458  typename Traits::RangeType& y) const
459  {
460  t.evaluate(e,x,y);
461  }
462 
463  private:
464  const T& t;
465  const typename Traits::ElementType& e;
466  };
467 
468 
470  template<class T>
471  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> >
472  {
474  public:
476  typedef typename BaseT::Traits Traits;
477 
478  SelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
479 
485  inline void evaluate (const typename Traits::DomainType& x,
486  typename Traits::RangeType& y) const
487  {
488  typename T::Traits::RangeType Y;
489  t.evaluate(x,Y);
490  y = Y[k];
491  }
492 
494  void select (int k_)
495  {
496  k = k_;
497  }
498 
499  private:
500  const T& t;
501  int k;
502  };
503 
505  template<class T>
507  : public BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
508  typename T::Traits::RangeFieldType,1,
509  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
510  BoundaryGridFunctionSelectComponentAdapter<T> >
511  {
512  typedef BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
513  typename T::Traits::RangeFieldType,1,
514  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
516  public:
518  typedef typename BaseT::Traits Traits;
519 
520  BoundaryGridFunctionSelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
521 
527  template<typename I>
528  inline void evaluate (const IntersectionGeometry<I>& ig,
529  const typename Traits::DomainType& x,
530  typename Traits::RangeType& y) const
531  {
532  typename T::Traits::RangeType Y;
533  t.evaluate(ig,x,Y);
534  y = Y[k];
535  }
536 
538  inline const typename Traits::GridViewType& getGridView () const
539  {
540  return t.getGridView();
541  }
542 
543 
545  void select (int k_)
546  {
547  k = k_;
548  }
549 
550  private:
551  const T& t;
552  int k;
553  };
554 
556 
557  //============================
558  // Function tree
559  //============================
560 
563 
564  struct GridFunctionTag {};
565 
574  template<class T, class Imp>
576  : public GridFunctionInterface<T,Imp>
577  , public TypeTree::LeafNode
578  {
579  public:
582  typedef typename T::GridViewType GridViewType;
583  };
584 
585 
594  template<class T, class Imp>
596  : public BoundaryGridFunctionInterface<T,Imp>
597  , public TypeTree::LeafNode
598  {
599  public:
602  typedef typename T::GridViewType GridViewType;
603  };
604 
605 
612  template<typename TT>
614  : public TypeTree::TreeVisitor, public TypeTree::DynamicTraversal
615  {
616  TT time;
617  PowerCompositeSetTimeVisitor(const TT time_) : time(time_) {}
618 
619  template<typename LeafNode, typename TreePath>
620  void leaf(LeafNode& node, TreePath treePath) const
621  {
622  node.setTime(time);
623  }
624  };
625 
627 
635  template<class T, std::size_t k>
637  : public TypeTree::PowerNode<T,k>
638  {
639 
640  typedef TypeTree::PowerNode<T,k> BaseT;
641 
642  public:
643 
645 
647 
649  typedef typename T::GridViewType GridViewType;
650 
652  template <typename TT>
653  void setTime(TT time){
654  PowerCompositeSetTimeVisitor<TT> visitor(time);
655  TypeTree::applyToTree(*this,visitor);
656  }
657 
659  {}
660 
663  : BaseT(t) {}
664 
674  // TODO: PowerGridFunction (T** t) : ...
675 
676 #ifdef DOXYGEN
677 
687  PowerGridFunction (T& t0, T& t1, ...)
688  {
689  }
690 
691 #else
692 
693  PowerGridFunction (T& c0,
694  T& c1)
695  : BaseT(c0,c1)
696  {
697  }
698 
699  PowerGridFunction (T& c0,
700  T& c1,
701  T& c2)
702  : BaseT(c0,c1,c2)
703  {
704  }
705 
706  PowerGridFunction (T& c0,
707  T& c1,
708  T& c2,
709  T& c3)
710  : BaseT(c0,c1,c2,c3)
711  {
712  }
713 
714  PowerGridFunction (T& c0,
715  T& c1,
716  T& c2,
717  T& c3,
718  T& c4)
719  : BaseT(c0,c1,c2,c3,c4)
720  {
721  }
722 
723  PowerGridFunction (T& c0,
724  T& c1,
725  T& c2,
726  T& c3,
727  T& c4,
728  T& c5)
729  : BaseT(c0,c1,c2,c3,c4,c5)
730  {
731  }
732 
733  PowerGridFunction (T& c0,
734  T& c1,
735  T& c2,
736  T& c3,
737  T& c4,
738  T& c5,
739  T& c6)
740  : BaseT(c0,c1,c2,c3,c4,c5,c6)
741  {
742  }
743 
744  PowerGridFunction (T& c0,
745  T& c1,
746  T& c2,
747  T& c3,
748  T& c4,
749  T& c5,
750  T& c6,
751  T& c7)
752  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7)
753  {
754  }
755 
756  PowerGridFunction (T& c0,
757  T& c1,
758  T& c2,
759  T& c3,
760  T& c4,
761  T& c5,
762  T& c6,
763  T& c7,
764  T& c8)
765  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8)
766  {
767  }
768 
769  PowerGridFunction (T& c0,
770  T& c1,
771  T& c2,
772  T& c3,
773  T& c4,
774  T& c5,
775  T& c6,
776  T& c7,
777  T& c8,
778  T& c9)
779  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9)
780  {
781  }
782 
783 #endif // DOXYGEN
784  };
785 
787 
797  template<typename... Children>
799  : public TypeTree::CompositeNode<Children...>
800  {
801 
802  typedef TypeTree::CompositeNode<Children...> BaseT;
803 
804  public:
805 
807 
809 
811  typedef typename BaseT::template Child<0>::Type::GridViewType GridViewType;
812 
814  {}
815 
816  CompositeGridFunction (Children&... children)
817  : BaseT(TypeTree::assertGridViewType<typename BaseT::template Child<0>::Type>(children)...)
818  {
819  }
820 
822  template <typename TT>
823  void setTime(TT time){
824  PowerCompositeSetTimeVisitor<TT> visitor(time);
825  TypeTree::applyToTree(*this,visitor);
826  }
827 
828 #ifdef DOXYGEN
829 
838  CompositeGridFunction (T0& t0, T1& t1, ...) {}
839 #endif //DOXYGEN
840  };
841 
842  //========================================================
843  // helper template to turn an ordinary GridFunction into a
844  // GridFunctionTree leaf
845  //========================================================
847 
850  template<class Imp>
852  : public GridFunctionBase<typename Imp::Traits,
853  GridFunctionBaseAdapter<Imp> >
854  {
855  const Imp &imp;
856 
857  public:
859 
864  GridFunctionBaseAdapter(const Imp& imp_)
865  : imp(imp_)
866  { }
867 
869 
877  inline void evaluate (const typename Imp::Traits::ElementType& e,
878  const typename Imp::Traits::DomainType& x,
879  typename Imp::Traits::RangeType& y) const
880  {
881  imp.evaluate(e,x,y);
882  }
883 
885  inline const typename Imp::Traits::GridViewType& getGridView () const
886  {
887  return imp.getGridView();
888  }
889  };
890 
891  //=======================================
892  // helper template for analytic functions
893  //=======================================
894 
896  template<typename GV, typename RF, int m>
898  : public GridFunctionTraits<GV, RF, m, Dune::FieldVector<RF,m> >
899  {
900  };
901 
914  template<typename T, typename Imp>
916  : public GridFunctionBase<T,AnalyticGridFunctionBase<T,Imp> >
917  {
918  public:
919  typedef T Traits;
920 
922  AnalyticGridFunctionBase (const typename Traits::GridViewType& g_) : g(g_) {}
923 
925  inline void evaluate (const typename Traits::ElementType& e,
926  const typename Traits::DomainType& x,
927  typename Traits::RangeType& y) const
928  {
929  asImp().evaluateGlobal(e.geometry().global(x),y);
930  }
931 
932  inline const typename Traits::GridViewType& getGridView () const
933  {
934  return g;
935  }
936 
937  private:
938  typename Traits::GridViewType g;
939  Imp& asImp () {return static_cast<Imp &> (*this);}
940  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
941  };
942 
943 
944  // Adapter takes a vector-valued grid function and provides evaluation
945  // of normal flux on the interior of faces.
946  template<typename T>
948  : public Dune::PDELab::GridFunctionInterface<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
949  typename T::Traits::RangeFieldType,
950  1,
951  Dune::FieldVector<typename T::Traits::RangeFieldType,1>
952  >,
953  NormalFluxGridFunctionAdapter<T> >
954  , public TypeTree::LeafNode
955  {
956  public:
959 
960  NormalFluxGridFunctionAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
961 
962 
963  inline void evaluate (const typename Traits::ElementType& e,
964  const typename Traits::DomainType& x,
965  typename Traits::RangeType& y) const
966  {
967  // ensure correct size
968  static_assert((static_cast<int>(T::Traits::GridViewType::dimension)==static_cast<int>(T::Traits::dimRange)),"number of components must equal dimension");
969 
970  // evaluate velocity
971  typename T::Traits::RangeType v;
972  t->evaluate(e,x,v);
973 
974  // implementation only handles triangles so far
975  if (!e.geometry().type().isTriangle())
976  DUNE_THROW(Dune::NotImplemented, "only implemented for triangles");
977 
978  // start and end corner in local numbering
979  int n0, n1;
980 
981  typename Traits::DomainType nu;
982 
983  // determine outer unit normal
984  if (std::abs(x[0])<1E-10)
985  {
986  // edge 1
987  n0 = 2;
988  n1 = 0;
989 
990  nu = e.geometry().corner(n1);
991  nu -= e.geometry().corner(n0);
992  typename Traits::DomainFieldType temp = nu[0];
993  nu[0] = nu[1];
994  nu[1] = -temp;
995  nu /= nu.two_norm();
996  y = v[0]*nu[0]+v[1]*nu[1];
997  return;
998  }
999 
1000  if (std::abs(x[1])<1E-10)
1001  {
1002  // edge 2
1003  n0 = 0;
1004  n1 = 1;
1005 
1006  nu = e.geometry().corner(n1);
1007  nu -= e.geometry().corner(n0);
1008  typename Traits::DomainFieldType temp = nu[0];
1009  nu[0] = nu[1];
1010  nu[1] = -temp;
1011  nu /= nu.two_norm();
1012  y = v[0]*nu[0]+v[1]*nu[1];
1013  return;
1014  }
1015 
1016  if (std::abs(x[0]+x[1]-1.0)<1E-10)
1017  {
1018  // edge 0
1019  n0 = 1;
1020  n1 = 2;
1021 
1022  nu = e.geometry().corner(n1);
1023  nu -= e.geometry().corner(n0);
1024  typename Traits::DomainFieldType temp = nu[0];
1025  nu[0] = nu[1];
1026  nu[1] = -temp;
1027  nu /= nu.two_norm();
1028  y = v[0]*nu[0]+v[1]*nu[1];
1029  return;
1030  }
1031 
1032  DUNE_THROW(Dune::Exception, "x needs to be on an edge");
1033  }
1034 
1036  inline const typename Traits::GridViewType& getGridView () const
1037  {
1038  return t->getGridView();
1039  }
1040 
1041  private:
1042  shared_ptr<T const> t;
1043  };
1044 
1045  // Adapter takes a vector-valued grid function and applies
1046  // backward Piola transformation on each element
1047  template<typename T>
1049  : public Dune::PDELab::GridFunctionInterface<typename T::Traits,PiolaBackwardAdapter<T> >
1050  , public TypeTree::LeafNode
1051  {
1052  public:
1053  typedef typename T::Traits::GridViewType GridViewType;
1054  typedef typename T::Traits Traits;
1056 
1057  PiolaBackwardAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
1058 
1059 
1060  inline void evaluate (const typename Traits::ElementType& e,
1061  const typename Traits::DomainType& x,
1062  typename Traits::RangeType& y) const
1063  {
1064  // evaluate velocity
1065  typename T::Traits::RangeType v;
1066  t->evaluate(e,x,v);
1067 
1068  // apply Piola transformation
1069  typename Traits::ElementType::Geometry::JacobianInverseTransposed
1070  J = e.geometry().jacobianInverseTransposed(x);
1071  y = 0;
1072  J.umtv(v,y);
1073  y *= e.geometry().integrationElement(x);
1074  }
1075 
1077  inline const typename Traits::GridViewType& getGridView () const
1078  {
1079  return t->getGridView();
1080  }
1081 
1082  private:
1083  shared_ptr<T const> t;
1084  };
1085 
1086 
1087  //==========================
1088  // template metaprograms
1089  //==========================
1090 
1091  namespace {
1092 
1094  template<typename VTKWriter>
1095  struct AddGridFunctionsToVTKWriter
1096  : public TypeTree::TreeVisitor
1097  , public TypeTree::DynamicTraversal
1098  {
1099 
1100  VTKWriter& w;
1101  const std::string s;
1102 
1103  AddGridFunctionsToVTKWriter(VTKWriter& w_, const std::string & s_) :
1104  w(w_), s(s_) {}
1105 
1106  template<typename T, typename TreePath>
1107  void leaf(const T& t, TreePath treePath) {
1108  std::stringstream name;
1109  name << s;
1110  for (std::size_t i=0; i < treePath.size(); ++i)
1111  name << "_" << treePath.element(i);
1112  w.addVertexData(make_shared< VTKGridFunctionAdapter<T> >(t,name.str()));
1113  }
1114  };
1115 
1116  } // anonymous namespace
1117 
1123  template<typename GV, typename T>
1124  void vtkwriter_tree_addvertexdata (Dune::VTKWriter<GV>& w, const T& t, std::string s = "data")
1125  {
1126  AddGridFunctionsToVTKWriter<Dune::VTKWriter<GV> > visitor(w,s);
1127  TypeTree::applyToTree(t,visitor);
1128  }
1129 
1131 
1133 
1134  } // namespace PDELab
1135 } // namespace Dune
1136 
1137 #endif // DUNE_PDELAB_COMMON_FUNCTION_HH
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition: function.hh:613
T Traits
Definition: function.hh:919
PowerCompositeGridFunctionTraits< typename T::GridViewType > Traits
Definition: function.hh:644
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:528
PowerCompositeSetTimeVisitor(const TT time_)
Definition: function.hh:617
BoundaryGridFunctionSelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:520
const IG & ig
Definition: constraints.hh:148
product of identical functions
Definition: function.hh:636
void leaf(LeafNode &node, TreePath treePath) const
Definition: function.hh:620
T::Traits Traits
Definition: function.hh:1054
T::Traits::GridViewType GridViewType
Definition: function.hh:1053
GridFunctionInterface(Output::DataSetType dataSetType=Output::vertexData)
Definition: function.hh:193
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:823
PowerGridFunction(T &t0, T &t1,...)
Initialize all children with different function objects.
Definition: function.hh:687
dimension of the domain
Definition: function.hh:44
T::GridViewType GridViewType
record the GridView
Definition: function.hh:649
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:485
D DomainType
domain type in dim-size coordinates
Definition: function.hh:48
SelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:478
an analytic grid function
Definition: function.hh:915
a Function that maps x in DomainType to y in RangeType
Definition: function.hh:67
FunctionToGridFunctionAdapter(const G &g_, const T &t_)
Create a FunctionToGridFunctionAdapter.
Definition: function.hh:319
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:321
NormalFluxGridFunctionAdapter(const T &t_)
Definition: function.hh:960
composite functions
Definition: function.hh:798
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:419
CompositeGridFunction()
Definition: function.hh:813
GV GridViewType
Export grid view type in addition.
Definition: function.hh:237
GridFunctionTraits< G, typename T::Traits::RangeFieldType, T::Traits::dimRange, typename T::Traits::RangeType > Traits
Definition: function.hh:301
traits class holding the function signature, same as in local function
Definition: function.hh:175
const Traits::GridViewType & getGridView() const
Definition: function.hh:328
Definition: function.hh:1048
const std::string s
Definition: function.hh:1101
GV The type of the grid view the function lives on.
Definition: function.hh:111
PiolaBackwardAdapter(const T &t_)
Definition: function.hh:1057
GridFunctionTag ImplementationTag
Definition: function.hh:600
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:1060
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Wrap intersection.
Definition: geometrywrapper.hh:56
make a Function from a GridFunction
Definition: function.hh:343
traits class holding function signature, same as in local function
Definition: function.hh:230
GridFunctionTag ImplementationTag
Definition: function.hh:580
Output::DataSetType dataSetType() const
Return the data set type of this function.
Definition: function.hh:152
BaseT::Traits Traits
Export type traits.
Definition: function.hh:518
PowerGridFunction(T &t)
Construct a PowerGridFunction with k clones of the function t.
Definition: function.hh:662
Definition: vtk.hh:26
GridFunctionToLocalFunctionAdapter(const T &t_, const typename Traits::ElementType &e_)
Create a GridFunctionToLocalFunctionAdapter.
Definition: function.hh:448
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:653
PowerGridFunction()
Definition: function.hh:658
Definition: function.hh:564
function signature for analytic functions on a grid
Definition: function.hh:897
Definition: function.hh:36
make a LocalFunction from a GridFunction using local coordinates
Definition: function.hh:436
Definition: function.hh:786
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:457
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, 1, Dune::FieldVector< typename T::Traits::RangeFieldType, 1 > > Traits
Definition: function.hh:957
const Traits::GridViewType & getGridView() const
Definition: function.hh:932
const Entity & e
Definition: localfunctionspace.hh:111
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:602
dimension of the range
Definition: function.hh:56
PowerGridFunctionTag ImplementationTag
Definition: function.hh:646
Namespace for output-related data types and enums.
Definition: function.hh:129
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
T::Traits Traits
Definition: function.hh:405
leaf of a function tree
Definition: function.hh:595
Default class for additional methods in instationary functions.
Definition: function.hh:90
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:925
void select(int k_)
set component to be selected
Definition: function.hh:494
void setTime(Time t)
set time for subsequent evaluation
Definition: function.hh:105
Turn an ordinary GridFunction into a GridFunctionTree leaf.
Definition: function.hh:851
BaseT::Traits Traits
Export type traits.
Definition: function.hh:476
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:380
T Traits
Export type traits.
Definition: function.hh:191
VTKWriter & w
Definition: function.hh:1100
A data set with vertex values.
Definition: function.hh:138
T::Traits Traits
Definition: function.hh:441
CompositeGridFunction(T0 &t0, T1 &t1,...)
Initialize all children.
Definition: function.hh:838
make a GridFunction from a Function
Definition: function.hh:288
DF DomainFieldType
Export type for domain field.
Definition: function.hh:39
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:186
GlobalFunctionToLocalFunctionAdapter(const T &t_, const E &e_)
Create a GlobalFunctionToLocalFunctionAdapter.
Definition: function.hh:412
AnalyticGridFunctionBase(const typename Traits::GridViewType &g_)
Construct an Analytic GridFunctionBase given a GridView g_.
Definition: function.hh:922
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
Mixin base class for specifying output hints to I/O routines like VTK.
Definition: function.hh:123
RF RangeFieldType
Export type for range field.
Definition: function.hh:51
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:78
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1036
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:538
Dune::PDELab::GridFunctionInterface< Traits, NormalFluxGridFunctionAdapter< T > > BaseT
Definition: function.hh:958
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:582
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 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:877
void select(int k_)
set component to be selected
Definition: function.hh:545
GridFunctionOutputParameters(Output::DataSetType dataSetType=Output::vertexData)
Standard constructor.
Definition: function.hh:147
Takes a BoundaryGridFunction and acts as a single component.
Definition: function.hh:506
CompositeGridFunctionTag ImplementationTag
Definition: function.hh:806
GridFunctionBaseAdapter(const Imp &imp_)
construct a GridFunctionBaseAdapter
Definition: function.hh:864
make a Function in local coordinates from a Function in global coordinates
Definition: function.hh:400
const Imp::Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:885
A BoundaryGridFunction allows evaluation on boundary intersections.
Definition: function.hh:245
T Traits
Export type traits.
Definition: function.hh:71
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:214
TT time
Definition: function.hh:616
Dune::PDELab::GridFunctionInterface< Traits, PiolaBackwardAdapter< T > > BaseT
Definition: function.hh:1055
DataSetType
The type of the data set.
Definition: function.hh:136
void setDataSetType(Output::DataSetType dataSetType)
Set the data set type of this function.
Definition: function.hh:158
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:117
Definition: function.hh:626
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:114
leaf of a function tree
Definition: function.hh:575
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:1124
BaseT::template Child< 0 >::Type::GridViewType GridViewType
record the GridView
Definition: function.hh:811
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:269
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:963
a Function maps x in DomainType to y in RangeType
Definition: function.hh:471
PowerCompositeGridFunctionTraits< typename BaseT::template Child< 0 >::Type::GridViewType > Traits
Definition: function.hh:808
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1077
GridFunctionToFunctionAdapter(const GF &gf_)
make a GridFunctionToFunctionAdapter
Definition: function.hh:370
CompositeGridFunction(Children &... children)
Definition: function.hh:816
R RangeType
range type
Definition: function.hh:60
T Traits
Export type traits of the boundary grid function.
Definition: function.hh:249