DUNE PDELab (git)

scalarscaled.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_SCALARSCALED_HH
4#define DUNE_PDELAB_FUNCTION_SCALARSCALED_HH
5
6#include <dune/pdelab/common/function.hh>
7
8namespace Dune {
9 namespace PDELab {
10
12
15 template<typename GF>
17 : public GridFunctionBase<typename GF::Traits,
18 ScalarScaledGridFunctionAdapter<GF> >
19 {
20 typedef typename GF::Traits T;
22 Base;
23 typedef typename T::RangeFieldType RF;
24
25 RF factor;
26 GF& gf;
27
28 public:
29 typedef typename Base::Traits Traits;
30
31 ScalarScaledGridFunctionAdapter(RF factor_, GF& gf_)
32 : factor(factor_), gf(gf_)
33 { }
34
35 void evaluate(const typename Traits::ElementType &e,
36 const typename Traits::DomainType &x,
37 typename Traits::RangeType &y) const {
38 gf.evaluate(e,x,y);
39 y *= factor;
40 }
41
42 const typename Traits::GridViewType& getGridView() const {
43 return gf.getGridView();
44 }
45
46 template<typename Time>
47 void setTime(Time time) { gf.setTime(time); }
48 };
49
50 } // namspace PDELab
51} // namspace Dune
52
53#endif // DUNE_PDELAB_FUNCTION_SCALARSCALED_HH
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
Scale a GridFunction by a constant.
Definition: scalarscaled.hh:19
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)