DUNE PDELab (git)

sqrt.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_SQRT_HH
4#define DUNE_PDELAB_FUNCTION_SQRT_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 SqrtGridFunctionAdapter<GF> >
19 {
20 static_assert(GF::Traits::dimRange == 1, "Dimension of range must "
21 "be 1 to take the sqrt");
22
23 typedef typename GF::Traits T;
25 Base;
26 typedef typename T::RangeFieldType RF;
27
28 GF& gf;
29
30 public:
31 typedef typename Base::Traits Traits;
32
34 : gf(gf_)
35 { }
36
37 void evaluate(const typename Traits::ElementType &e,
38 const typename Traits::DomainType &x,
39 typename Traits::RangeType &y) const {
40 using std::sqrt;
41 gf.evaluate(e,x,y);
42 y[0] = sqrt(y[0]);
43 }
44
45 const typename Traits::GridViewType& getGridView() const {
46 return gf.getGridView();
47 }
48
49 template<typename Time>
50 void setTime(Time time) { gf.setTime(time); }
51 };
52
53 } // namspace PDELab
54} // namspace Dune
55
56#endif // DUNE_PDELAB_FUNCTION_SQRT_HH
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
Take sqrt of a GridFunction.
Definition: sqrt.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)