DUNE PDELab (git)

minus.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_MINUS_HH
4#define DUNE_PDELAB_FUNCTION_MINUS_HH
5
6#include <cstddef>
7
8#include <dune/pdelab/common/function.hh>
9
10namespace Dune {
11 namespace PDELab {
12
14
18 template<typename GF1, typename GF2>
20 : public GridFunctionBase<typename GF1::Traits,
21 MinusGridFunctionAdapter<GF1,GF2> >
22 {
23 static_assert(std::size_t(GF1::Traits::dimRange) ==
24 std::size_t(GF2::Traits::dimRange),
25 "Range dimension must match for both operands of a "
26 "MinusGridFunctionAdapter");
27 typedef typename GF1::Traits T;
29 Base;
30
31 GF1& gf1;
32 GF2& gf2;
33
34 public:
35 typedef typename Base::Traits Traits;
36
37 MinusGridFunctionAdapter(GF1& gf1_, GF2& gf2_)
38 : gf1(gf1_), gf2(gf2_)
39 { }
40
41 void evaluate(const typename Traits::ElementType &e,
42 const typename Traits::DomainType &x,
43 typename Traits::RangeType &y) const {
44 gf1.evaluate(e,x,y);
45 typename GF2::Traits::RangeType y2;
46 gf2.evaluate(e,x,y2);
47 y -= y2;
48 }
49
50 const typename Traits::GridViewType& getGridView() const {
51 return gf1.getGridView();
52 }
53
54 template<typename Time>
55 void setTime(Time time) {
56 gf1.setTime(time);
57 gf2.setTime(time);
58 }
59 };
60
61 } // namspace PDELab
62} // namspace Dune
63
64#endif // DUNE_PDELAB_FUNCTION_MINUS_HH
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
Substract two GridFunctions.
Definition: minus.hh:22
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)