dune-pdelab  2.5-dev
const.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_CONST_HH
4 #define DUNE_PDELAB_FUNCTION_CONST_HH
5 
7 
8 namespace Dune {
9  namespace PDELab {
10 
12 
17  template<typename GV, typename RF, unsigned dimR = 1>
19  : public AnalyticGridFunctionBase<
20  AnalyticGridFunctionTraits<GV,RF,dimR>,
21  ConstGridFunction<GV,RF,dimR>
22  >,
24  {
25  public:
28  Traits,
30 
32 
39  ConstGridFunction(const GV& gv,
40  const typename Traits::RangeType& val_ = 1)
41  : BaseT(gv)
42  , val(val_)
43  {}
44 
46 
50  inline void
52  typename Traits::RangeType& y) const
53  {
54  y = val;
55  }
56 
57  private:
58  typename Traits::RangeType val;
59  };
60 
62 
67  template<typename GV, typename RF, unsigned dimR = 1>
69  : public BoundaryGridFunctionBase<
70  BoundaryGridFunctionTraits<
71  GV,
72  RF,dimR,FieldVector<RF,dimR> >,
73  ConstBoundaryGridFunction<GV, RF, dimR> >
74  {
75  public:
78  GV,
79  RF,dimR,FieldVector<RF,dimR> > Traits;
80 
81  private:
83  Traits,
85 
86  public:
88 
94  const typename Traits::RangeType& val_ = 1)
95  : gv(gv_)
96  , val(val_)
97  {}
98 
100 
107  template<typename I>
108  inline void
110  const typename Traits::DomainType& x,
111  typename Traits::RangeType& y) const
112  {
113  y = val;
114  }
115 
117  inline const GV& getGridView () const
118  {
119  return gv;
120  }
121 
122  private:
123  const GV gv;
124  const typename Traits::RangeType val;
125  };
126 
127  } // namspace PDELab
128 } // namspace Dune
129 
130 #endif // DUNE_PDELAB_FUNCTION_CONST_HH
Default class for additional methods in instationary functions.
Definition: function.hh:91
Wrap intersection.
Definition: geometrywrapper.hh:56
traits class holding function signature, same as in local function
Definition: function.hh:231
function signature for analytic functions on a grid
Definition: function.hh:627
AnalyticGridFunctionTraits< GV, RF, dimR > Traits
Definition: const.hh:26
GridFunction returning a constant value everywhere.
Definition: const.hh:18
ConstBoundaryGridFunction(const GV &gv_, const typename Traits::RangeType &val_=1)
Contruct a ConstBoundaryGridFunction.
Definition: const.hh:93
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:49
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
void evaluate(const IntersectionGeometry< I > &ig, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
evaluate the function
Definition: const.hh:109
const IG & ig
Definition: constraints.hh:148
leaf of a function tree
Definition: function.hh:325
ConstGridFunction(const GV &gv, const typename Traits::RangeType &val_=1)
Contruct a Const GridFunction.
Definition: const.hh:39
an analytic grid function
Definition: function.hh:645
BoundaryGridFunctionTraits< GV, RF, dimR, FieldVector< RF, dimR > > Traits
export Traits class
Definition: const.hh:79
void evaluateGlobal(const typename Traits::DomainType &x, typename Traits::RangeType &y) const
evaluate the function globally
Definition: const.hh:51
const GV & getGridView() const
get a reference to the GridView
Definition: const.hh:117
BoundaryGridFunction returning a constant value everywhere.
Definition: const.hh:68
AnalyticGridFunctionBase< Traits, ConstGridFunction< GV, RF, dimR > > BaseT
Definition: const.hh:29