DUNE PDELab (git)

division.hh
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
6#include <dune/pdelab/common/function.hh>
7
8namespace 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
Substract two GridFunctions.
Definition: division.hh:20
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)