dune-pdelab 2.7-git
Loading...
Searching...
No Matches
sqr.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_SQR_HH
4#define DUNE_PDELAB_FUNCTION_SQR_HH
5
6#include <dune/common/fvector.hh>
7
9
10namespace Dune {
11 namespace PDELab {
12
14
17 template<typename GF>
19 public GridFunctionBase<
20 GridFunctionTraits<
21 typename GF::Traits::GridViewType,
22 typename GF::Traits::RangeFieldType, 1,
23 FieldVector<typename GF::Traits::RangeFieldType, 1>
24 >,
25 SqrGridFunctionAdapter<GF>
26 >
27 {
28 typedef GridFunctionTraits<
29 typename GF::Traits::GridViewType,
30 typename GF::Traits::RangeFieldType, 1,
31 FieldVector<typename GF::Traits::RangeFieldType, 1>
32 > T;
34 Base;
35 typedef typename T::RangeFieldType RF;
36
37 GF& gf;
38
39 public:
40 typedef typename Base::Traits Traits;
41
43 : gf(gf_)
44 { }
45
46 void evaluate(const typename Traits::ElementType &e,
47 const typename Traits::DomainType &x,
48 typename Traits::RangeType &y) const
49 {
50 typename GF::Traits::RangeType y_;
51 gf.evaluate(e,x,y_);
52 y[0] = y_*y_;
53 }
54
55 const typename Traits::GridViewType& getGridView() const {
56 return gf.getGridView();
57 }
58
59 template<typename Time>
60 void setTime(Time time) { gf.setTime(time); }
61 };
62
63 } // namspace PDELab
64} // namspace Dune
65
66#endif // DUNE_PDELAB_FUNCTION_SQR_HH
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
traits class holding the function signature, same as in local function
Definition: function.hh:183
T Traits
Export type traits.
Definition: function.hh:193
leaf of a function tree
Definition: function.hh:302
Take square of a GridFunction.
Definition: sqr.hh:27
void setTime(Time time)
Definition: sqr.hh:60
const Traits::GridViewType & getGridView() const
Definition: sqr.hh:55
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: sqr.hh:46
Base::Traits Traits
Definition: sqr.hh:40
SqrGridFunctionAdapter(GF &gf_)
Definition: sqr.hh:42