DUNE PDELab (git)

sqr.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_SQR_HH
4#define DUNE_PDELAB_FUNCTION_SQR_HH
5
7
8#include <dune/pdelab/common/function.hh>
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,
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
vector space out of a tensor product of fields.
Definition: fvector.hh:91
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
Take square of a GridFunction.
Definition: sqr.hh:27
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
traits class holding the function signature, same as in local function
Definition: function.hh:183
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)