dune-pdelab  2.5-dev
division.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_FUNCTION_DIVISION_HH
4 #define DUNE_PDELAB_FUNCTION_DIVISION_HH
5 
7 
8 namespace Dune {
9  namespace PDELab {
10 
12 
16  template<typename GF1, typename GF2>
18  : public GridFunctionBase<typename GF1::Traits,
19  DivisionGridFunctionAdapter<GF1,GF2> >
20  {
21  static_assert(GF2::Traits::dimRange == 1, "Range dimension must be "
22  "1 for the divisor of a DivisionGridFunctionAdapter");
23  typedef typename GF1::Traits T;
25  > Base;
26 
27  GF1& gf1;
28  GF2& gf2;
29 
30  public:
31  typedef typename Base::Traits Traits;
32 
33  DivisionGridFunctionAdapter(GF1& gf1_, GF2& gf2_)
34  : gf1(gf1_), gf2(gf2_)
35  { }
36 
37  void evaluate(const typename Traits::ElementType &e,
38  const typename Traits::DomainType &x,
39  typename Traits::RangeType &y) const {
40  gf1.evaluate(e,x,y);
41  typename GF2::Traits::RangeType y2;
42  gf2.evaluate(e,x,y2);
43  y /= y2;
44  }
45 
46  const typename Traits::GridViewType& getGridView() const {
47  return gf1.getGridView();
48  }
49 
50  template<typename Time>
51  void setTime(Time time) {
52  gf1.setTime(time);
53  gf2.setTime(time);
54  }
55  };
56 
57  } // namspace PDELab
58 } // namspace Dune
59 
60 #endif // DUNE_PDELAB_FUNCTION_DIVISION_HH
const Entity & e
Definition: localfunctionspace.hh:111
leaf of a function tree
Definition: function.hh:298
DivisionGridFunctionAdapter(GF1 &gf1_, GF2 &gf2_)
Definition: division.hh:33
void setTime(Time time)
Definition: division.hh:51
Substract two GridFunctions.
Definition: division.hh:17
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
T Traits
Export type traits.
Definition: function.hh:192
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: division.hh:37
Base::Traits Traits
Definition: division.hh:31
const Traits::GridViewType & getGridView() const
Definition: division.hh:46