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_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 #include "typetraits.hh"
21 
22 namespace Dune {
23  namespace PDELab {
24 
28 
36  template<class DF, int n, class D, class RF, int m, class R>
38  {
40  typedef DF DomainFieldType;
41 
43  enum {
46  };
47 
49  typedef D DomainType;
50 
52  typedef RF RangeFieldType;
53 
55  enum {
58  };
59 
61  typedef R RangeType;
62  };
63 
67  template<class T, class Imp>
69  {
70  public:
72  typedef T Traits;
73 
79  inline void evaluate (const typename Traits::DomainType& x,
80  typename Traits::RangeType& y) const
81  {
82  asImp().evaluate(x,y);
83  }
84 
85  private:
86  Imp& asImp () {return static_cast<Imp &> (*this);}
87  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
88  };
89 
92  {
93  public:
95 
105  template<typename Time>
106  inline void setTime(Time t)
107  { }
108  };
109 
111  template<typename GV>
113  {
115  typedef GV GridViewType;
116 
118  typedef typename GV::Traits::template Codim<0>::Entity ElementType;
119 
120  };
121 
122 
125  {
126 
127  public:
128 
130  struct Output
131  {
133 
138  {
140  cellData
141  };
142  };
143 
145 
148  GridFunctionOutputParameters(Output::DataSetType dataSetType = Output::vertexData)
149  : _dataSetType(dataSetType)
150  {}
151 
154  {
155  return _dataSetType;
156  }
157 
160  {
161  _dataSetType = dataSetType;
162  }
163 
164  private:
165 
166  Output::DataSetType _dataSetType;
167 
168  };
169 
175  template<class GV, class RF, int m, class R>
177  : public FunctionTraits<typename GV::Grid::ctype, GV::dimension,
178  Dune::FieldVector<typename GV::Grid::ctype,
179  GV::dimension>,
180  RF, m, R>
182  {
183  };
184 
186  template<class T, class Imp>
189  {
190  public:
192  typedef T Traits;
193 
194  GridFunctionInterface(Output::DataSetType dataSetType = Output::vertexData)
195  : GridFunctionOutputParameters(dataSetType)
196  {}
197 
207  inline void evaluate (const typename Traits::ElementType& e,
208  const typename Traits::DomainType& x,
209  typename Traits::RangeType& y) const
210  {
211  asImp().evaluate(e,x,y);
212  }
213 
215  inline const typename Traits::GridViewType& getGridView () const
216  {
217  return asImp().getGridView();
218  }
219 
220  private:
221  Imp& asImp () {return static_cast<Imp &> (*this);}
222  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
223  };
224 
230  template<class GV, class RF, int m, class R>
232  : public FunctionTraits<typename GV::Grid::ctype, GV::dimension-1,
233  Dune::FieldVector<typename GV::Grid::ctype,
234  GV::dimension-1>,
235  RF, m, R>
236  {
238  typedef GV GridViewType;
239  };
240 
241 
243  // \tparam T The type of the BoundaryGridFunctionTraits.
244  // \tparam Imp The type of the implementing class.
245  template<class T, class Imp>
247  {
248  public:
250  typedef T Traits;
251 
261  template<typename I>
262  inline void evaluate (const IntersectionGeometry<I>& ig,
263  const typename Traits::DomainType& x,
264  typename Traits::RangeType& y) const
265  {
266  asImp().evaluate(ig,x,y);
267  }
268 
270  inline const typename Traits::GridViewType& getGridView () const
271  {
272  return asImp().getGridView();
273  }
274 
275  private:
276  Imp& asImp () {return static_cast<Imp &> (*this);}
277  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
278  };
279 
280  //============================
281  // Function tree
282  //============================
283 
286 
287  struct GridFunctionTag {};
288 
297  template<class T, class Imp>
299  : public GridFunctionInterface<T,Imp>
300  , public TypeTree::LeafNode
301  {
303  public:
306  typedef typename T::GridViewType GridViewType;
307 
308  using Output = typename Base::Output;
309 
310  GridFunctionBase(typename Output::DataSetType dataSetType = Output::vertexData)
311  : Base(dataSetType)
312  {}
313  };
314 
315 
324  template<class T, class Imp>
326  : public BoundaryGridFunctionInterface<T,Imp>
327  , public TypeTree::LeafNode
328  {
329  public:
332  typedef typename T::GridViewType GridViewType;
333  };
334 
335 
342  template<typename TT>
344  : public TypeTree::TreeVisitor, public TypeTree::DynamicTraversal
345  {
346  TT time;
347  PowerCompositeSetTimeVisitor(const TT time_) : time(time_) {}
348 
349  template<typename LeafNode, typename TreePath>
350  void leaf(LeafNode& node, TreePath treePath) const
351  {
352  node.setTime(time);
353  }
354  };
355 
357 
365  template<class T, std::size_t k>
367  : public TypeTree::PowerNode<T,k>
368  {
369 
370  typedef TypeTree::PowerNode<T,k> BaseT;
371 
372  public:
373 
375 
377 
379  typedef typename T::GridViewType GridViewType;
380 
382  template <typename TT>
383  void setTime(TT time){
384  PowerCompositeSetTimeVisitor<TT> visitor(time);
385  TypeTree::applyToTree(*this,visitor);
386  }
387 
389  {}
390 
393  : BaseT(t) {}
394 
404  // TODO: PowerGridFunction (T** t) : ...
405 
406 #ifdef DOXYGEN
407 
417  PowerGridFunction (T& t0, T& t1, ...)
418  {
419  }
420 
421 #else
422 
423  PowerGridFunction (T& c0,
424  T& c1)
425  : BaseT(c0,c1)
426  {
427  }
428 
429  PowerGridFunction (T& c0,
430  T& c1,
431  T& c2)
432  : BaseT(c0,c1,c2)
433  {
434  }
435 
436  PowerGridFunction (T& c0,
437  T& c1,
438  T& c2,
439  T& c3)
440  : BaseT(c0,c1,c2,c3)
441  {
442  }
443 
444  PowerGridFunction (T& c0,
445  T& c1,
446  T& c2,
447  T& c3,
448  T& c4)
449  : BaseT(c0,c1,c2,c3,c4)
450  {
451  }
452 
453  PowerGridFunction (T& c0,
454  T& c1,
455  T& c2,
456  T& c3,
457  T& c4,
458  T& c5)
459  : BaseT(c0,c1,c2,c3,c4,c5)
460  {
461  }
462 
463  PowerGridFunction (T& c0,
464  T& c1,
465  T& c2,
466  T& c3,
467  T& c4,
468  T& c5,
469  T& c6)
470  : BaseT(c0,c1,c2,c3,c4,c5,c6)
471  {
472  }
473 
474  PowerGridFunction (T& c0,
475  T& c1,
476  T& c2,
477  T& c3,
478  T& c4,
479  T& c5,
480  T& c6,
481  T& c7)
482  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7)
483  {
484  }
485 
486  PowerGridFunction (T& c0,
487  T& c1,
488  T& c2,
489  T& c3,
490  T& c4,
491  T& c5,
492  T& c6,
493  T& c7,
494  T& c8)
495  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8)
496  {
497  }
498 
499  PowerGridFunction (T& c0,
500  T& c1,
501  T& c2,
502  T& c3,
503  T& c4,
504  T& c5,
505  T& c6,
506  T& c7,
507  T& c8,
508  T& c9)
509  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9)
510  {
511  }
512 
513 #endif // DOXYGEN
514  };
515 
517 
527  template<typename... Children>
529  : public TypeTree::CompositeNode<Children...>
530  {
531 
532  typedef TypeTree::CompositeNode<Children...> BaseT;
533 
534  public:
535 
537 
539 
541  typedef typename BaseT::template Child<0>::Type::GridViewType GridViewType;
542 
544  {}
545 
546  CompositeGridFunction (Children&... children)
547  : BaseT(TypeTree::assertGridViewType<typename BaseT::template Child<0>::Type>(children)...)
548  {
549  }
550 
552  template <typename TT>
553  void setTime(TT time){
554  PowerCompositeSetTimeVisitor<TT> visitor(time);
555  TypeTree::applyToTree(*this,visitor);
556  }
557 
558 #ifdef DOXYGEN
559 
568  CompositeGridFunction (T0& t0, T1& t1, ...) {}
569 #endif //DOXYGEN
570  };
571 
572  //========================================================
573  // helper template to turn an ordinary GridFunction into a
574  // GridFunctionTree leaf
575  //========================================================
577 
580  template<class Imp>
582  : public GridFunctionBase<typename Imp::Traits,
583  GridFunctionBaseAdapter<Imp> >
584  {
585  const Imp &imp;
586 
587  public:
589 
594  GridFunctionBaseAdapter(const Imp& imp_)
595  : imp(imp_)
596  { }
597 
599 
607  inline void evaluate (const typename Imp::Traits::ElementType& e,
608  const typename Imp::Traits::DomainType& x,
609  typename Imp::Traits::RangeType& y) const
610  {
611  imp.evaluate(e,x,y);
612  }
613 
615  inline const typename Imp::Traits::GridViewType& getGridView () const
616  {
617  return imp.getGridView();
618  }
619  };
620 
621  //=======================================
622  // helper template for analytic functions
623  //=======================================
624 
626  template<typename GV, typename RF, int m>
628  : public GridFunctionTraits<GV, RF, m, Dune::FieldVector<RF,m> >
629  {
630  };
631 
644  template<typename T, typename Imp>
646  : public GridFunctionBase<T,AnalyticGridFunctionBase<T,Imp> >
647  {
648  public:
649  typedef T Traits;
650 
652  AnalyticGridFunctionBase (const typename Traits::GridViewType& g_) : g(g_) {}
653 
655  inline void evaluate (const typename Traits::ElementType& e,
656  const typename Traits::DomainType& x,
657  typename Traits::RangeType& y) const
658  {
659  asImp().evaluateGlobal(e.geometry().global(x),y);
660  }
661 
662  inline const typename Traits::GridViewType& getGridView () const
663  {
664  return g;
665  }
666 
667  private:
668  typename Traits::GridViewType g;
669  Imp& asImp () {return static_cast<Imp &> (*this);}
670  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
671  };
672 
673 
674  // Adapter takes a vector-valued grid function and provides evaluation
675  // of normal flux on the interior of faces.
676  template<typename T>
678  : public Dune::PDELab::GridFunctionBase<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
679  typename T::Traits::RangeFieldType,
680  1,
681  Dune::FieldVector<typename T::Traits::RangeFieldType,1>
682  >,
683  NormalFluxGridFunctionAdapter<T> >
684  {
685  public:
688 
689  NormalFluxGridFunctionAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
690 
691 
692  inline void evaluate (const typename Traits::ElementType& e,
693  const typename Traits::DomainType& x,
694  typename Traits::RangeType& y) const
695  {
696  // ensure correct size
697  static_assert((static_cast<int>(T::Traits::GridViewType::dimension)==static_cast<int>(T::Traits::dimRange)),"number of components must equal dimension");
698 
699  // evaluate velocity
700  typename T::Traits::RangeType v;
701  t->evaluate(e,x,v);
702 
703  // implementation only handles triangles so far
704  if (!e.geometry().type().isTriangle())
705  DUNE_THROW(Dune::NotImplemented, "only implemented for triangles");
706 
707  // start and end corner in local numbering
708  int n0, n1;
709 
710  typename Traits::DomainType nu;
711 
712  // determine outer unit normal
713  if (std::abs(x[0])<1E-10)
714  {
715  // edge 1
716  n0 = 2;
717  n1 = 0;
718 
719  nu = e.geometry().corner(n1);
720  nu -= e.geometry().corner(n0);
721  typename Traits::DomainFieldType temp = nu[0];
722  nu[0] = nu[1];
723  nu[1] = -temp;
724  nu /= nu.two_norm();
725  y = v[0]*nu[0]+v[1]*nu[1];
726  return;
727  }
728 
729  if (std::abs(x[1])<1E-10)
730  {
731  // edge 2
732  n0 = 0;
733  n1 = 1;
734 
735  nu = e.geometry().corner(n1);
736  nu -= e.geometry().corner(n0);
737  typename Traits::DomainFieldType temp = nu[0];
738  nu[0] = nu[1];
739  nu[1] = -temp;
740  nu /= nu.two_norm();
741  y = v[0]*nu[0]+v[1]*nu[1];
742  return;
743  }
744 
745  if (std::abs(x[0]+x[1]-1.0)<1E-10)
746  {
747  // edge 0
748  n0 = 1;
749  n1 = 2;
750 
751  nu = e.geometry().corner(n1);
752  nu -= e.geometry().corner(n0);
753  typename Traits::DomainFieldType temp = nu[0];
754  nu[0] = nu[1];
755  nu[1] = -temp;
756  nu /= nu.two_norm();
757  y = v[0]*nu[0]+v[1]*nu[1];
758  return;
759  }
760 
761  DUNE_THROW(Dune::Exception, "x needs to be on an edge");
762  }
763 
765  inline const typename Traits::GridViewType& getGridView () const
766  {
767  return t->getGridView();
768  }
769 
770  private:
771  shared_ptr<T const> t;
772  };
773 
774  // Adapter takes a vector-valued grid function and applies
775  // backward Piola transformation on each element
776  template<typename T>
778  : public Dune::PDELab::GridFunctionBase<typename T::Traits,PiolaBackwardAdapter<T> >
779  {
780  public:
781  typedef typename T::Traits::GridViewType GridViewType;
782  typedef typename T::Traits Traits;
784  // typedef GridFunctionTag ImplementationTag;
785 
786  PiolaBackwardAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
787 
788 
789  inline void evaluate (const typename Traits::ElementType& e,
790  const typename Traits::DomainType& x,
791  typename Traits::RangeType& y) const
792  {
793  // evaluate velocity
794  typename T::Traits::RangeType v;
795  t->evaluate(e,x,v);
796 
797  // apply Piola transformation
798  typename Traits::ElementType::Geometry::JacobianInverseTransposed
799  J = e.geometry().jacobianInverseTransposed(x);
800  y = 0;
801  J.umtv(v,y);
802  y *= e.geometry().integrationElement(x);
803  }
804 
806  inline const typename Traits::GridViewType& getGridView () const
807  {
808  return t->getGridView();
809  }
810 
811  private:
812  shared_ptr<T const> t;
813  };
814 
815 
816  //==========================
817  // template metaprograms
818  //==========================
819 
820  namespace {
821 
823  template<typename VTKWriter>
824  struct AddGridFunctionsToVTKWriter
825  : public TypeTree::TreeVisitor
826  , public TypeTree::DynamicTraversal
827  {
828 
829  VTKWriter& w;
830  const std::string s;
831 
832  AddGridFunctionsToVTKWriter(VTKWriter& w_, const std::string & s_) :
833  w(w_), s(s_) {}
834 
835  template<typename T, typename TreePath>
836  void leaf(const T& t, TreePath treePath) {
837  std::stringstream name;
838  name << s;
839  for (std::size_t i=0; i < treePath.size(); ++i)
840  name << "_" << treePath.element(i);
841  w.addVertexData(make_shared< VTKGridFunctionAdapter<T> >(t,name.str()));
842  }
843  };
844 
845  } // anonymous namespace
846 
852  template<typename GV, typename T>
853  void vtkwriter_tree_addvertexdata (Dune::VTKWriter<GV>& w, const T& t, std::string s = "data")
854  {
855  AddGridFunctionsToVTKWriter<Dune::VTKWriter<GV> > visitor(w,s);
856  TypeTree::applyToTree(t,visitor);
857  }
858 
860 
863 
869  template<typename G, typename T>
871  public GridFunctionBase<GridFunctionTraits<
872  G,
873  typename T::Traits::RangeFieldType,
874  T::Traits::dimRange,
875  typename T::Traits::RangeType>,
876  FunctionToGridFunctionAdapter<G,T> >
877  {
878  public:
879  typedef GridFunctionTraits<G,
880  typename T::Traits::RangeFieldType,
881  T::Traits::dimRange,
882  typename T::Traits::RangeType> Traits;
883  static_assert(
884  (std::is_same<typename T::Traits::DomainFieldType,
885  typename Traits::DomainFieldType>::value),
886  "GridView's and wrapped Functions DomainFieldType don't match");
887  static_assert(
888  T::Traits::dimDomain==Traits::dimDomain,
889  "GridView's and wrapped Functions dimDomain don't match");
890  static_assert(
891  (std::is_same<typename T::Traits::DomainType,
892  typename Traits::DomainType>::value),
893  "GridView's and wrapped Functions DomainType don't match");
894 
900  FunctionToGridFunctionAdapter (const G& g_, const T& t_) : g(g_), t(t_) {}
901 
902  inline void evaluate (const typename Traits::ElementType& e,
903  const typename Traits::DomainType& x,
904  typename Traits::RangeType& y) const
905  {
906  t.evaluate(e.geometry().global(x),y);
907  }
908 
909  inline const typename Traits::GridViewType& getGridView () const
910  {
911  return g;
912  }
913 
914  private:
915  G g;
916  const T& t;
917  };
918 
923  template<typename GF>
925  : public FunctionInterface<FunctionTraits<typename GF::Traits::GridViewType::ctype,
926  GF::Traits::GridViewType::dimensionworld,
927  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
928  GF::Traits::GridViewType::dimensionworld
929  >,
930  typename GF::Traits::RangeFieldType,
931  GF::Traits::dimRange,
932  Dune::FieldVector<typename GF::Traits::RangeFieldType,
933  GF::Traits::dimRange>
934  >,
935  GridFunctionToFunctionAdapter<GF> >
936  {
937  public:
939  typedef FunctionTraits<typename GF::Traits::GridViewType::ctype,
940  GF::Traits::GridViewType::dimensionworld,
941  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
942  GF::Traits::GridViewType::dimensionworld
943  >,
944  typename GF::Traits::RangeFieldType,
945  GF::Traits::dimRange,
946  Dune::FieldVector<typename GF::Traits::RangeFieldType,
947  GF::Traits::dimRange>
949 
952  : gf(gf_)
953  , hsearch(gf.getGridView().grid(), gf.getGridView().indexSet())
954  { }
955 
961  inline void evaluate (const typename Traits::DomainType& x,
962  typename Traits::RangeType& y) const
963  {
964  typename GF::Traits::GridViewType::Grid::Traits::template Codim<0>::EntityPointer
965  ep = hsearch.findEntity(x);
966  gf.evaluate(*ep, ep->geometry().local(x), y);
967  }
968 
969  private:
970  const GF &gf;
971  const Dune::HierarchicSearch<typename GF::Traits::GridViewType::Grid,
972  typename GF::Traits::GridViewType::IndexSet> hsearch;
973  };
974 
975 
981  template<typename T, typename E>
983  public FunctionInterface<typename T::Traits,
984  GlobalFunctionToLocalFunctionAdapter<T,E> >
985  {
986  public:
987  typedef typename T::Traits Traits;
988 
994  GlobalFunctionToLocalFunctionAdapter (const T& t_, const E& e_) : t(t_), e(e_) {}
995 
1001  inline void evaluate (const typename Traits::DomainType& x,
1002  typename Traits::RangeType& y) const
1003  {
1004  t.evaluate(e.geometry().global(x),y);
1005  }
1006 
1007  private:
1008  const T& t;
1009  const E& e;
1010  };
1011 
1012 
1017  template<typename T> // T: GridFunction, E: Entity
1019  public FunctionInterface<typename T::Traits,
1020  GridFunctionToLocalFunctionAdapter<T> >
1021  {
1022  public:
1023  typedef typename T::Traits Traits;
1024 
1031  const typename Traits::ElementType& e_)
1032  : t(t_), e(e_) {}
1033 
1039  inline void evaluate (const typename Traits::DomainType& x,
1040  typename Traits::RangeType& y) const
1041  {
1042  t.evaluate(e,x,y);
1043  }
1044 
1045  private:
1046  const T& t;
1047  const typename Traits::ElementType& e;
1048  };
1049 
1050 
1052  template<class T>
1053  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> >
1054  {
1056  public:
1058  typedef typename BaseT::Traits Traits;
1059 
1060  SelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
1061 
1067  inline void evaluate (const typename Traits::DomainType& x,
1068  typename Traits::RangeType& y) const
1069  {
1070  typename T::Traits::RangeType Y;
1071  t.evaluate(x,Y);
1072  y = Y[k];
1073  }
1074 
1076  void select (int k_)
1077  {
1078  k = k_;
1079  }
1080 
1081  private:
1082  const T& t;
1083  int k;
1084  };
1085 
1087  template<class T>
1089  : public BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
1090  typename T::Traits::RangeFieldType,1,
1091  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
1092  BoundaryGridFunctionSelectComponentAdapter<T> >
1093  {
1094  typedef BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
1095  typename T::Traits::RangeFieldType,1,
1096  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
1098  public:
1100  typedef typename BaseT::Traits Traits;
1101 
1102  BoundaryGridFunctionSelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
1103 
1109  template<typename I>
1110  inline void evaluate (const IntersectionGeometry<I>& ig,
1111  const typename Traits::DomainType& x,
1112  typename Traits::RangeType& y) const
1113  {
1114  typename T::Traits::RangeType Y;
1115  t.evaluate(ig,x,Y);
1116  y = Y[k];
1117  }
1118 
1120  inline const typename Traits::GridViewType& getGridView () const
1121  {
1122  return t.getGridView();
1123  }
1124 
1125 
1127  void select (int k_)
1128  {
1129  k = k_;
1130  }
1131 
1132  private:
1133  const T& t;
1134  int k;
1135  };
1136 
1138 
1140 
1141  } // namespace PDELab
1142 } // namespace Dune
1143 
1144 #endif
VTKWriter & w
Definition: function.hh:829
R RangeType
range type
Definition: function.hh:61
Namespace for output-related data types and enums.
Definition: function.hh:130
Definition: function.hh:356
make a LocalFunction from a GridFunction using local coordinates
Definition: function.hh:1018
DataSetType
The type of the data set.
Definition: function.hh:137
Default class for additional methods in instationary functions.
Definition: function.hh:91
const Entity & e
Definition: localfunctionspace.hh:120
Wrap intersection.
Definition: geometrywrapper.hh:56
leaf of a function tree
Definition: function.hh:298
T::Traits Traits
Definition: function.hh:987
traits class holding function signature, same as in local function
Definition: function.hh:231
function signature for analytic functions on a grid
Definition: function.hh:627
Definition: function.hh:516
BaseT::Traits Traits
Export type traits.
Definition: function.hh:1058
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:853
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition: function.hh:343
NormalFluxGridFunctionAdapter(const T &t_)
Definition: function.hh:689
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, 1, Dune::FieldVector< typename T::Traits::RangeFieldType, 1 > > Traits
Definition: function.hh:686
PowerGridFunction(T &t)
Construct a PowerGridFunction with k clones of the function t.
Definition: function.hh:392
PowerGridFunction(T &t0, T &t1,...)
Initialize all children with different function objects.
Definition: function.hh:417
void select(int k_)
set component to be selected
Definition: function.hh:1076
BoundaryGridFunctionSelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:1102
GV GridViewType
Export grid view type in addition.
Definition: function.hh:238
CompositeGridFunction(T0 &t0, T1 &t1,...)
Initialize all children.
Definition: function.hh:568
make a GridFunction from a Function
Definition: function.hh:870
GridFunctionToLocalFunctionAdapter(const T &t_, const typename Traits::ElementType &e_)
Create a GridFunctionToLocalFunctionAdapter.
Definition: function.hh:1030
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:948
GridFunctionBaseAdapter(const Imp &imp_)
construct a GridFunctionBaseAdapter
Definition: function.hh:594
T Traits
Export type traits.
Definition: function.hh:72
Turn an ordinary GridFunction into a GridFunctionTree leaf.
Definition: function.hh:581
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:1110
const Traits::GridViewType & getGridView() const
Definition: function.hh:662
dimension of the range
Definition: function.hh:57
TT time
Definition: function.hh:346
SelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:1060
GridFunctionBase(typename Output::DataSetType dataSetType=Output::vertexData)
Definition: function.hh:310
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:383
Takes a BoundaryGridFunction and acts as a single component.
Definition: function.hh:1088
Mixin base class for specifying output hints to I/O routines like VTK.
Definition: function.hh:124
CompositeGridFunctionTag ImplementationTag
Definition: function.hh:536
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
FunctionToGridFunctionAdapter(const G &g_, const T &t_)
Create a FunctionToGridFunctionAdapter.
Definition: function.hh:900
make a Function in local coordinates from a Function in global coordinates
Definition: function.hh:982
a Function that maps x in DomainType to y in RangeType
Definition: function.hh:68
BaseT::template Child< 0 >::Type::GridViewType GridViewType
record the GridView
Definition: function.hh:541
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:1001
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:262
A data set with vertex values.
Definition: function.hh:139
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:655
D DomainType
domain type in dim-size coordinates
Definition: function.hh:49
PowerCompositeGridFunctionTraits< typename BaseT::template Child< 0 >::Type::GridViewType > Traits
Definition: function.hh:538
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:118
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:806
PowerGridFunctionTag ImplementationTag
Definition: function.hh:376
traits class holding the function signature, same as in local function
Definition: function.hh:176
GridFunctionTag ImplementationTag
Definition: function.hh:304
a Function maps x in DomainType to y in RangeType
Definition: function.hh:1053
GV The type of the grid view the function lives on.
Definition: function.hh:112
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:1039
Dune::PDELab::GridFunctionBase< Traits, PiolaBackwardAdapter< T > > BaseT
Definition: function.hh:783
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:961
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
CompositeGridFunction(Children &... children)
Definition: function.hh:546
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:270
GridFunctionToFunctionAdapter(const GF &gf_)
make a GridFunctionToFunctionAdapter
Definition: function.hh:951
RF RangeFieldType
Export type for range field.
Definition: function.hh:52
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:692
T::Traits Traits
Definition: function.hh:782
T::Traits::GridViewType GridViewType
Definition: function.hh:781
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:1067
void leaf(LeafNode &node, TreePath treePath) const
Definition: function.hh:350
void setDataSetType(Output::DataSetType dataSetType)
Set the data set type of this function.
Definition: function.hh:159
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:332
PowerCompositeSetTimeVisitor(const TT time_)
Definition: function.hh:347
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:765
const IG & ig
Definition: constraints.hh:148
GridFunctionInterface(Output::DataSetType dataSetType=Output::vertexData)
Definition: function.hh:194
Definition: function.hh:287
const Imp::Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:615
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:187
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:553
GridFunctionOutputParameters(Output::DataSetType dataSetType=Output::vertexData)
Standard constructor.
Definition: function.hh:148
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:207
PowerGridFunction()
Definition: function.hh:388
product of identical functions
Definition: function.hh:366
dimension of the domain
Definition: function.hh:45
DF DomainFieldType
Export type for domain field.
Definition: function.hh:40
leaf of a function tree
Definition: function.hh:325
CompositeGridFunction()
Definition: function.hh:543
Definition: vtk.hh:26
T Traits
Definition: function.hh:649
GridFunctionTag ImplementationTag
Definition: function.hh:330
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1120
Dune::PDELab::GridFunctionInterface< Traits, NormalFluxGridFunctionAdapter< T > > BaseT
Definition: function.hh:687
BaseT::Traits Traits
Export type traits.
Definition: function.hh:1100
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:789
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:607
void select(int k_)
set component to be selected
Definition: function.hh:1127
T Traits
Export type traits of the boundary grid function.
Definition: function.hh:250
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:115
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:79
an analytic grid function
Definition: function.hh:645
GlobalFunctionToLocalFunctionAdapter(const T &t_, const E &e_)
Create a GlobalFunctionToLocalFunctionAdapter.
Definition: function.hh:994
GridFunctionTraits< G, typename T::Traits::RangeFieldType, T::Traits::dimRange, typename T::Traits::RangeType > Traits
Definition: function.hh:882
composite functions
Definition: function.hh:528
PiolaBackwardAdapter(const T &t_)
Definition: function.hh:786
AnalyticGridFunctionBase(const typename Traits::GridViewType &g_)
Construct an Analytic GridFunctionBase given a GridView g_.
Definition: function.hh:652
void setTime(Time t)
set time for subsequent evaluation
Definition: function.hh:106
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:902
T::Traits Traits
Definition: function.hh:1023
Output::DataSetType dataSetType() const
Return the data set type of this function.
Definition: function.hh:153
make a Function from a GridFunction
Definition: function.hh:924
Definition: function.hh:37
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:306
A BoundaryGridFunction allows evaluation on boundary intersections.
Definition: function.hh:246
const std::string s
Definition: function.hh:830
Definition: function.hh:777
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:215
T Traits
Export type traits.
Definition: function.hh:192
const Traits::GridViewType & getGridView() const
Definition: function.hh:909
T::GridViewType GridViewType
record the GridView
Definition: function.hh:379
PowerCompositeGridFunctionTraits< typename T::GridViewType > Traits
Definition: function.hh:374