dune-pdelab  2.0.0
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/static_assert.hh>
10 #include <dune/common/exceptions.hh>
11 #include <dune/common/typetraits.hh>
12 #include <dune/common/fvector.hh>
13 #include <dune/common/fmatrix.hh>
14 
15 #include <dune/grid/utility/hierarchicsearch.hh>
16 
17 #include <dune/typetree/typetree.hh>
18 
19 #include "vtkexport.hh"
20 #include "geometrywrapper.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  {
141  };
142  };
143 
145 
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 
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 
282 
288  template<typename G, typename T>
290  public TypeTree::LeafNode,
291  public GridFunctionInterface<GridFunctionTraits<
292  G,
293  typename T::Traits::RangeFieldType,
294  T::Traits::dimRange,
295  typename T::Traits::RangeType>,
296  FunctionToGridFunctionAdapter<G,T> >
297  {
298  public:
299  typedef GridFunctionTraits<G,
300  typename T::Traits::RangeFieldType,
301  T::Traits::dimRange,
302  typename T::Traits::RangeType> Traits;
304  (is_same<typename T::Traits::DomainFieldType,
305  typename Traits::DomainFieldType>::value),
306  "GridView's and wrapped Functions DomainFieldType don't match");
308  T::Traits::dimDomain==Traits::dimDomain,
309  "GridView's and wrapped Functions dimDomain don't match");
311  (is_same<typename T::Traits::DomainType,
312  typename Traits::DomainType>::value),
313  "GridView's and wrapped Functions DomainType don't match");
314 
320  FunctionToGridFunctionAdapter (const G& g_, const T& t_) : g(g_), t(t_) {}
321 
322  inline void evaluate (const typename Traits::ElementType& e,
323  const typename Traits::DomainType& x,
324  typename Traits::RangeType& y) const
325  {
326  t.evaluate(e.geometry().global(x),y);
327  }
328 
329  inline const typename Traits::GridViewType& getGridView () const
330  {
331  return g;
332  }
333 
334  private:
335  const G& g;
336  const T& t;
337  };
338 
343  template<typename GF>
345  : public FunctionInterface<FunctionTraits<typename GF::Traits::GridViewType::ctype,
346  GF::Traits::GridViewType::dimensionworld,
347  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
348  GF::Traits::GridViewType::dimensionworld
349  >,
350  typename GF::Traits::RangeFieldType,
351  GF::Traits::dimRange,
352  Dune::FieldVector<typename GF::Traits::RangeFieldType,
353  GF::Traits::dimRange>
354  >,
355  GridFunctionToFunctionAdapter<GF> >
356  {
357  public:
359  typedef FunctionTraits<typename GF::Traits::GridViewType::ctype,
360  GF::Traits::GridViewType::dimensionworld,
361  Dune::FieldVector<typename GF::Traits::GridViewType::ctype,
362  GF::Traits::GridViewType::dimensionworld
363  >,
364  typename GF::Traits::RangeFieldType,
365  GF::Traits::dimRange,
366  Dune::FieldVector<typename GF::Traits::RangeFieldType,
367  GF::Traits::dimRange>
369 
372  : gf(gf_)
373  , hsearch(gf.getGridView().grid(), gf.getGridView().indexSet())
374  { }
375 
381  inline void evaluate (const typename Traits::DomainType& x,
382  typename Traits::RangeType& y) const
383  {
384  typename GF::Traits::GridViewType::Grid::Traits::template Codim<0>::EntityPointer
385  ep = hsearch.findEntity(x);
386  gf.evaluate(*ep, ep->geometry().local(x), y);
387  }
388 
389  private:
390  const GF &gf;
391  const Dune::HierarchicSearch<typename GF::Traits::GridViewType::Grid,
392  typename GF::Traits::GridViewType::IndexSet> hsearch;
393  };
394 
395 
401  template<typename T, typename E>
403  public FunctionInterface<typename T::Traits,
404  GlobalFunctionToLocalFunctionAdapter<T,E> >
405  {
406  public:
407  typedef typename T::Traits Traits;
408 
414  GlobalFunctionToLocalFunctionAdapter (const T& t_, const E& e_) : t(t_), e(e_) {}
415 
421  inline void evaluate (const typename Traits::DomainType& x,
422  typename Traits::RangeType& y) const
423  {
424  t.evaluate(e.geometry().global(x),y);
425  }
426 
427  private:
428  const T& t;
429  const E& e;
430  };
431 
432 
437  template<typename T> // T: GridFunction, E: Entity
439  public FunctionInterface<typename T::Traits,
440  GridFunctionToLocalFunctionAdapter<T> >
441  {
442  public:
443  typedef typename T::Traits Traits;
444 
451  const typename Traits::ElementType& e_)
452  : t(t_), e(e_) {}
453 
459  inline void evaluate (const typename Traits::DomainType& x,
460  typename Traits::RangeType& y) const
461  {
462  t.evaluate(e,x,y);
463  }
464 
465  private:
466  const T& t;
467  const typename Traits::ElementType& e;
468  };
469 
470 
472  template<class T>
473  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> >
474  {
476  public:
478  typedef typename BaseT::Traits Traits;
479 
480  SelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
481 
487  inline void evaluate (const typename Traits::DomainType& x,
488  typename Traits::RangeType& y) const
489  {
490  typename T::Traits::RangeType Y;
491  t.evaluate(x,Y);
492  y = Y[k];
493  }
494 
496  void select (int k_)
497  {
498  k = k_;
499  }
500 
501  private:
502  const T& t;
503  int k;
504  };
505 
507  template<class T>
509  : public BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
510  typename T::Traits::RangeFieldType,1,
511  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
512  BoundaryGridFunctionSelectComponentAdapter<T> >
513  {
514  typedef BoundaryGridFunctionInterface<BoundaryGridFunctionTraits<typename T::Traits::GridViewType,
515  typename T::Traits::RangeFieldType,1,
516  Dune::FieldVector<typename T::Traits::RangeFieldType,1> > ,
518  public:
520  typedef typename BaseT::Traits Traits;
521 
522  BoundaryGridFunctionSelectComponentAdapter (const T& t_, int k_) : t(t_), k(k_) {}
523 
529  template<typename I>
530  inline void evaluate (const IntersectionGeometry<I>& ig,
531  const typename Traits::DomainType& x,
532  typename Traits::RangeType& y) const
533  {
534  typename T::Traits::RangeType Y;
535  t.evaluate(ig,x,Y);
536  y = Y[k];
537  }
538 
540  inline const typename Traits::GridViewType& getGridView () const
541  {
542  return t.getGridView();
543  }
544 
545 
547  void select (int k_)
548  {
549  k = k_;
550  }
551 
552  private:
553  const T& t;
554  int k;
555  };
556 
558 
559  //============================
560  // Function tree
561  //============================
562 
565 
566  struct GridFunctionTag {};
567 
576  template<class T, class Imp>
578  : public GridFunctionInterface<T,Imp>
579  , public TypeTree::LeafNode
580  {
581  public:
584  typedef typename T::GridViewType GridViewType;
585  };
586 
587 
596  template<class T, class Imp>
598  : public BoundaryGridFunctionInterface<T,Imp>
599  , public TypeTree::LeafNode
600  {
601  public:
604  typedef typename T::GridViewType GridViewType;
605  };
606 
607 
614  template<typename TT>
616  : public TypeTree::TreeVisitor, public TypeTree::DynamicTraversal
617  {
618  TT time;
619  PowerCompositeSetTimeVisitor(const TT time_) : time(time_) {}
620 
621  template<typename LeafNode, typename TreePath>
622  void leaf(LeafNode& node, TreePath treePath) const
623  {
624  node.setTime(time);
625  }
626  };
627 
629 
637  template<class T, std::size_t k>
639  : public TypeTree::PowerNode<T,k>
640  {
641 
642  typedef TypeTree::PowerNode<T,k> BaseT;
643 
644  public:
645 
647 
649 
651  typedef typename T::GridViewType GridViewType;
652 
654  template <typename TT>
655  void setTime(TT time){
656  PowerCompositeSetTimeVisitor<TT> visitor(time);
657  Dune::TypeTree::applyToTree(*this,visitor);
658  }
659 
661  {}
662 
665  : BaseT(t) {}
666 
676  // TODO: PowerGridFunction (T** t) : ...
677 
678 #ifdef DOXYGEN
679 
689  PowerGridFunction (T& t0, T& t1, ...)
690  {
691  }
692 
693 #else
694 
695  PowerGridFunction (T& c0,
696  T& c1)
697  : BaseT(c0,c1)
698  {
699  }
700 
701  PowerGridFunction (T& c0,
702  T& c1,
703  T& c2)
704  : BaseT(c0,c1,c2)
705  {
706  }
707 
708  PowerGridFunction (T& c0,
709  T& c1,
710  T& c2,
711  T& c3)
712  : BaseT(c0,c1,c2,c3)
713  {
714  }
715 
716  PowerGridFunction (T& c0,
717  T& c1,
718  T& c2,
719  T& c3,
720  T& c4)
721  : BaseT(c0,c1,c2,c3,c4)
722  {
723  }
724 
725  PowerGridFunction (T& c0,
726  T& c1,
727  T& c2,
728  T& c3,
729  T& c4,
730  T& c5)
731  : BaseT(c0,c1,c2,c3,c4,c5)
732  {
733  }
734 
735  PowerGridFunction (T& c0,
736  T& c1,
737  T& c2,
738  T& c3,
739  T& c4,
740  T& c5,
741  T& c6)
742  : BaseT(c0,c1,c2,c3,c4,c5,c6)
743  {
744  }
745 
746  PowerGridFunction (T& c0,
747  T& c1,
748  T& c2,
749  T& c3,
750  T& c4,
751  T& c5,
752  T& c6,
753  T& c7)
754  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7)
755  {
756  }
757 
758  PowerGridFunction (T& c0,
759  T& c1,
760  T& c2,
761  T& c3,
762  T& c4,
763  T& c5,
764  T& c6,
765  T& c7,
766  T& c8)
767  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8)
768  {
769  }
770 
771  PowerGridFunction (T& c0,
772  T& c1,
773  T& c2,
774  T& c3,
775  T& c4,
776  T& c5,
777  T& c6,
778  T& c7,
779  T& c8,
780  T& c9)
781  : BaseT(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9)
782  {
783  }
784 
785 #endif // DOXYGEN
786  };
787 
789 
799  template<DUNE_TYPETREE_COMPOSITENODE_TEMPLATE_CHILDREN>
801  : public DUNE_TYPETREE_COMPOSITENODE_BASETYPE
802  {
803 
804  typedef DUNE_TYPETREE_COMPOSITENODE_BASETYPE BaseT;
805 
806  public:
807 
809 
811 
813  typedef typename BaseT::template Child<0>::Type::GridViewType GridViewType;
814 
816  {}
817 
818  CompositeGridFunction (DUNE_TYPETREE_COMPOSITENODE_CONSTRUCTOR_SIGNATURE)
819  : BaseT(DUNE_TYPETREE_COMPOSITENODE_CHILDVARIABLES_THROUGH_FUNCTION(TypeTree::assertGridViewType<typename BaseT::template Child<0>::Type>))
820  {
821  }
822 
824  template <typename TT>
825  void setTime(TT time){
826  PowerCompositeSetTimeVisitor<TT> visitor(time);
827  Dune::TypeTree::applyToTree(*this,visitor);
828  }
829 
830 #ifdef DOXYGEN
831 
840  CompositeGridFunction (T0& t0, T1& t1, ...) {}
841 #endif //DOXYGEN
842  };
843 
844  //========================================================
845  // helper template to turn an ordinary GridFunction into a
846  // GridFunctionTree leaf
847  //========================================================
849 
852  template<class Imp>
854  : public GridFunctionBase<typename Imp::Traits,
855  GridFunctionBaseAdapter<Imp> >
856  {
857  const Imp &imp;
858 
859  public:
861 
866  GridFunctionBaseAdapter(const Imp& imp_)
867  : imp(imp_)
868  { }
869 
871 
879  inline void evaluate (const typename Imp::Traits::ElementType& e,
880  const typename Imp::Traits::DomainType& x,
881  typename Imp::Traits::RangeType& y) const
882  {
883  imp.evaluate(e,x,y);
884  }
885 
887  inline const typename Imp::Traits::GridViewType& getGridView () const
888  {
889  return imp.getGridView();
890  }
891  };
892 
893  //=======================================
894  // helper template for analytic functions
895  //=======================================
896 
898  template<typename GV, typename RF, int m>
900  : public GridFunctionTraits<GV, RF, m, Dune::FieldVector<RF,m> >
901  {
902  };
903 
916  template<typename T, typename Imp>
918  : public GridFunctionBase<T,AnalyticGridFunctionBase<T,Imp> >
919  {
920  public:
921  typedef T Traits;
922 
924  AnalyticGridFunctionBase (const typename Traits::GridViewType& g_) : g(g_) {}
925 
927  inline void evaluate (const typename Traits::ElementType& e,
928  const typename Traits::DomainType& x,
929  typename Traits::RangeType& y) const
930  {
931  asImp().evaluateGlobal(e.geometry().global(x),y);
932  }
933 
934  inline const typename Traits::GridViewType& getGridView () const
935  {
936  return g;
937  }
938 
939  private:
940  typename Traits::GridViewType g;
941  Imp& asImp () {return static_cast<Imp &> (*this);}
942  const Imp& asImp () const {return static_cast<const Imp &>(*this);}
943  };
944 
945 
946  // Adapter takes a vector-valued grid function and provides evaluation
947  // of normal flux on the interior of faces.
948  template<typename T>
950  : public Dune::PDELab::GridFunctionInterface<Dune::PDELab::GridFunctionTraits<typename T::Traits::GridViewType,
951  typename T::Traits::RangeFieldType,
952  1,
953  Dune::FieldVector<typename T::Traits::RangeFieldType,1>
954  >,
955  NormalFluxGridFunctionAdapter<T> >
956  , public TypeTree::LeafNode
957  {
958  public:
961 
962  NormalFluxGridFunctionAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
963 
964 
965  inline void evaluate (const typename Traits::ElementType& e,
966  const typename Traits::DomainType& x,
967  typename Traits::RangeType& y) const
968  {
969  // ensure correct size
970  dune_static_assert((static_cast<int>(T::Traits::GridViewType::dimension)==static_cast<int>(T::Traits::dimRange)),"number of components must equal dimension");
971 
972  // evaluate velocity
973  typename T::Traits::RangeType v;
974  t->evaluate(e,x,v);
975 
976  // implementation only handles triangles so far
977  if (!e.geometry().type().isTriangle())
978  DUNE_THROW(Dune::NotImplemented, "only implemented for triangles");
979 
980  // start and end corner in local numbering
981  int n0, n1;
982 
983  typename Traits::DomainType nu;
984 
985  // determine outer unit normal
986  if (std::abs(x[0])<1E-10)
987  {
988  // edge 1
989  n0 = 2;
990  n1 = 0;
991 
992  nu = e.geometry().corner(n1);
993  nu -= e.geometry().corner(n0);
994  typename Traits::DomainFieldType temp = nu[0];
995  nu[0] = nu[1];
996  nu[1] = -temp;
997  nu /= nu.two_norm();
998  y = v[0]*nu[0]+v[1]*nu[1];
999  return;
1000  }
1001 
1002  if (std::abs(x[1])<1E-10)
1003  {
1004  // edge 2
1005  n0 = 0;
1006  n1 = 1;
1007 
1008  nu = e.geometry().corner(n1);
1009  nu -= e.geometry().corner(n0);
1010  typename Traits::DomainFieldType temp = nu[0];
1011  nu[0] = nu[1];
1012  nu[1] = -temp;
1013  nu /= nu.two_norm();
1014  y = v[0]*nu[0]+v[1]*nu[1];
1015  return;
1016  }
1017 
1018  if (std::abs(x[0]+x[1]-1.0)<1E-10)
1019  {
1020  // edge 0
1021  n0 = 1;
1022  n1 = 2;
1023 
1024  nu = e.geometry().corner(n1);
1025  nu -= e.geometry().corner(n0);
1026  typename Traits::DomainFieldType temp = nu[0];
1027  nu[0] = nu[1];
1028  nu[1] = -temp;
1029  nu /= nu.two_norm();
1030  y = v[0]*nu[0]+v[1]*nu[1];
1031  return;
1032  }
1033 
1034  DUNE_THROW(Dune::Exception, "x needs to be on an edge");
1035  }
1036 
1038  inline const typename Traits::GridViewType& getGridView () const
1039  {
1040  return t->getGridView();
1041  }
1042 
1043  private:
1044  shared_ptr<T const> t;
1045  };
1046 
1047  // Adapter takes a vector-valued grid function and applies
1048  // backward Piola transformation on each element
1049  template<typename T>
1051  : public Dune::PDELab::GridFunctionInterface<typename T::Traits,PiolaBackwardAdapter<T> >
1052  , public TypeTree::LeafNode
1053  {
1054  public:
1055  typedef typename T::Traits::GridViewType GridViewType;
1056  typedef typename T::Traits Traits;
1058 
1059  PiolaBackwardAdapter (const T& t_) : t(stackobject_to_shared_ptr(t_)) {}
1060 
1061 
1062  inline void evaluate (const typename Traits::ElementType& e,
1063  const typename Traits::DomainType& x,
1064  typename Traits::RangeType& y) const
1065  {
1066  // evaluate velocity
1067  typename T::Traits::RangeType v;
1068  t->evaluate(e,x,v);
1069 
1070  // apply Piola transformation
1071  typename Traits::ElementType::Geometry::JacobianInverseTransposed
1072  J = e.geometry().jacobianInverseTransposed(x);
1073  y = 0;
1074  J.umtv(v,y);
1075  y *= e.geometry().integrationElement(x);
1076  }
1077 
1079  inline const typename Traits::GridViewType& getGridView () const
1080  {
1081  return t->getGridView();
1082  }
1083 
1084  private:
1085  shared_ptr<T const> t;
1086  };
1087 
1088 
1089  //==========================
1090  // template metaprograms
1091  //==========================
1092 
1093  namespace {
1094 
1096  template<typename VTKWriter>
1097  struct AddGridFunctionsToVTKWriter
1098  : public TypeTree::TreeVisitor
1099  , public TypeTree::DynamicTraversal
1100  {
1101 
1102  VTKWriter& w;
1103  const std::string s;
1104 
1105  AddGridFunctionsToVTKWriter(VTKWriter& w_, const std::string & s_) :
1106  w(w_), s(s_) {}
1107 
1108  template<typename T, typename TreePath>
1109  void leaf(const T& t, TreePath treePath) {
1110  std::stringstream name;
1111  name << s;
1112  for (std::size_t i=0; i < treePath.size(); ++i)
1113  name << "_" << treePath.element(i);
1114  w.addVertexData(new VTKGridFunctionAdapter<T>(t,name.str()));
1115  }
1116  };
1117 
1118  } // anonymous namespace
1119 
1125  template<typename GV, typename T>
1126  void vtkwriter_tree_addvertexdata (Dune::VTKWriter<GV>& w, const T& t, std::string s = "data")
1127  {
1128  AddGridFunctionsToVTKWriter<Dune::VTKWriter<GV> > visitor(w,s);
1129  TypeTree::applyToTree(t,visitor);
1130  }
1131 
1133 
1135 
1136  } // namespace PDELab
1137 } // namespace Dune
1138 
1139 #endif
AnalyticGridFunctionBase(const typename Traits::GridViewType &g_)
Construct an Analytic GridFunctionBase given a GridView g_.
Definition: function.hh:924
dimension of the range
Definition: function.hh:57
GridFunctionInterface(Output::DataSetType dataSetType=Output::vertexData)
Definition: function.hh:194
const Traits::GridViewType & getGridView() const
Definition: function.hh:329
T::Traits::GridViewType GridViewType
Definition: function.hh:1055
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:459
dune_static_assert((is_same< typename T::Traits::DomainFieldType, typename Traits::DomainFieldType >::value),"GridView's and wrapped Functions DomainFieldType don't match")
PowerCompositeGridFunctionTraits< typename T::GridViewType > Traits
Definition: function.hh:646
T Traits
Export type traits of the boundary grid function.
Definition: function.hh:250
Takes a BoundaryGridFunction and acts as a single component.
Definition: function.hh:508
function signature for analytic functions on a grid
Definition: function.hh:899
BaseT::Traits Traits
Export type traits.
Definition: function.hh:478
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition: function.hh:615
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:215
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:825
Dune::PDELab::GridFunctionInterface< Traits, PiolaBackwardAdapter< T > > BaseT
Definition: function.hh:1057
a Function maps x in DomainType to y in RangeType
Definition: function.hh:473
void select(int k_)
set component to be selected
Definition: function.hh:496
T::Traits Traits
Definition: function.hh:407
PowerCompositeGridFunctionTraits< typename BaseT::template Child< 0 >::Type::GridViewType > Traits
Definition: function.hh:810
CompositeGridFunctionTag ImplementationTag
Definition: function.hh:808
make a GridFunction from a Function
Definition: function.hh:289
DF DomainFieldType
Export type for domain field.
Definition: function.hh:40
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:118
Definition: vtk.hh:27
GridFunctionTag ImplementationTag
Definition: function.hh:582
SelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:480
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1038
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:1079
VTKWriter & w
Definition: function.hh:1102
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition: function.hh:655
Output::DataSetType dataSetType() const
Return the data set type of this function.
Definition: function.hh:153
make a Function in local coordinates from a Function in global coordinates
Definition: function.hh:402
composite functions
Definition: function.hh:800
make a Function from a GridFunction
Definition: function.hh:344
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:965
void setDataSetType(Output::DataSetType dataSetType)
Set the data set type of this function.
Definition: function.hh:159
A BoundaryGridFunction allows evaluation on boundary intersections.
Definition: function.hh:246
Mixin base class for specifying output hints to I/O routines like VTK.
Definition: function.hh:124
BaseT::Traits Traits
Export type traits.
Definition: function.hh:520
GridFunctionOutputParameters(Output::DataSetType dataSetType=Output::vertexData)
Standard constructor.
Definition: function.hh:148
Turn an ordinary GridFunction into a GridFunctionTree leaf.
Definition: function.hh:853
NormalFluxGridFunctionAdapter(const T &t_)
Definition: function.hh:962
PiolaBackwardAdapter(const T &t_)
Definition: function.hh:1059
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:381
RF RangeFieldType
Export type for range field.
Definition: function.hh:52
D DomainType
domain type in dim-size coordinates
Definition: function.hh:49
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:879
PowerCompositeSetTimeVisitor(const TT time_)
Definition: function.hh:619
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: function.hh:322
Definition: function.hh:628
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:604
an analytic grid function
Definition: function.hh:917
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:1062
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:79
CompositeGridFunction(T0 &t0, T1 &t1,...)
Initialize all children.
Definition: function.hh:840
T Traits
Export type traits.
Definition: function.hh:72
PowerGridFunction()
Definition: function.hh:660
Default class for additional methods in instationary functions.
Definition: function.hh:91
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate all basis function at given position.
Definition: function.hh:487
Definition: function.hh:566
Definition: function.hh:788
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:187
a Function that maps x in DomainType to y in RangeType
Definition: function.hh:68
FunctionToGridFunctionAdapter(const G &g_, const T &t_)
Create a FunctionToGridFunctionAdapter.
Definition: function.hh:320
R RangeType
range type
Definition: function.hh:61
A data set with vertex values.
Definition: function.hh:139
const IG & ig
Definition: common/constraints.hh:146
CompositeGridFunction()
Definition: function.hh:815
PowerGridFunction(T &t)
Construct a PowerGridFunction with k clones of the function t.
Definition: function.hh:664
leaf of a function tree
Definition: function.hh:577
DataSetType
The type of the data set.
Definition: function.hh:137
void select(int k_)
set component to be selected
Definition: function.hh:547
T::Traits Traits
Definition: function.hh:443
GV GridViewType
Export grid view type in addition.
Definition: function.hh:238
Dune::PDELab::GridFunctionTraits< typename T::Traits::GridViewType, typename T::Traits::RangeFieldType, 1, Dune::FieldVector< typename T::Traits::RangeFieldType, 1 > > Traits
Definition: function.hh:959
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:927
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:540
static const unsigned int value
Definition: gridfunctionspace/tags.hh:175
leaf of a function tree
Definition: function.hh:597
CompositeGridFunction(DUNE_TYPETREE_COMPOSITENODE_CONSTRUCTOR_SIGNATURE)
Definition: function.hh:818
GV The type of the grid view the function lives on.
Definition: function.hh:112
T::Traits Traits
Definition: function.hh:1056
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:270
A data set with cell values.
Definition: function.hh:140
BaseT::template Child< 0 >::Type::GridViewType GridViewType
record the GridView
Definition: function.hh:813
Dune::PDELab::GridFunctionInterface< Traits, NormalFluxGridFunctionAdapter< T > > BaseT
Definition: function.hh:960
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
traits class holding the function signature, same as in local function
Definition: function.hh:176
traits class holding function signature, same as in local function
Definition: function.hh:231
PowerGridFunctionTag ImplementationTag
Definition: function.hh:648
void evaluate(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the local function at the given position.
Definition: function.hh:421
T Traits
Export type traits.
Definition: function.hh:192
T::GridViewType GridViewType
record the GridView
Definition: function.hh:651
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:368
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:115
GridFunctionBaseAdapter(const Imp &imp_)
construct a GridFunctionBaseAdapter
Definition: function.hh:866
const Imp::Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: function.hh:887
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
Definition: function.hh:37
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:1126
product of identical functions
Definition: function.hh:638
Namespace for output-related data types and enums.
Definition: function.hh:130
GridFunctionToLocalFunctionAdapter(const T &t_, const typename Traits::ElementType &e_)
Create a GridFunctionToLocalFunctionAdapter.
Definition: function.hh:450
GridFunctionToFunctionAdapter(const GF &gf_)
make a GridFunctionToFunctionAdapter
Definition: function.hh:371
BoundaryGridFunctionSelectComponentAdapter(const T &t_, int k_)
Definition: function.hh:522
GridFunctionTag ImplementationTag
Definition: function.hh:602
PowerGridFunction(T &t0, T &t1,...)
Initialize all children with different function objects.
Definition: function.hh:689
const E & e
Definition: interpolate.hh:172
Definition: function.hh:1050
const Traits::GridViewType & getGridView() const
Definition: function.hh:934
TT time
Definition: function.hh:618
T Traits
Definition: function.hh:921
make a LocalFunction from a GridFunction using local coordinates
Definition: function.hh:438
GlobalFunctionToLocalFunctionAdapter(const T &t_, const E &e_)
Create a GlobalFunctionToLocalFunctionAdapter.
Definition: function.hh:414
dimension of the domain
Definition: function.hh:45
GridFunctionTraits< G, typename T::Traits::RangeFieldType, T::Traits::dimRange, typename T::Traits::RangeType > Traits
Definition: function.hh:302
T::GridViewType GridViewType
Type of the GridView.
Definition: function.hh:584
Wrap intersection.
Definition: geometrywrapper.hh:56
void leaf(LeafNode &node, TreePath treePath) const
Definition: function.hh:622
const std::string s
Definition: function.hh:1103
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:530