dune-pdelab
2.5-dev
dune
pdelab
function
sqrt.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_SQRT_HH
4
#define DUNE_PDELAB_FUNCTION_SQRT_HH
5
6
#include <
dune/pdelab/common/function.hh
>
7
8
namespace
Dune
{
9
namespace
PDELab {
10
12
15
template
<
typename
GF>
16
class
SqrtGridFunctionAdapter
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;
24
typedef
GridFunctionBase<T, SqrtGridFunctionAdapter<GF>
>
25
Base
;
26
typedef
typename
T::RangeFieldType RF;
27
28
GF& gf;
29
30
public
:
31
typedef
typename
Base::Traits
Traits
;
32
33
SqrtGridFunctionAdapter
(GF& gf_)
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
gf.evaluate(
e
,x,y);
41
y[0] = std::sqrt(y[0]);
42
}
43
44
const
typename
Traits::GridViewType&
getGridView
()
const
{
45
return
gf.getGridView();
46
}
47
48
template
<
typename
Time>
49
void
setTime
(Time time) { gf.setTime(time); }
50
};
51
52
}
// namspace PDELab
53
}
// namspace Dune
54
55
#endif // DUNE_PDELAB_FUNCTION_SQRT_HH
Dune
For backward compatibility – Do not use this!
Definition:
adaptivity.hh:28
Dune::PDELab::SqrtGridFunctionAdapter::evaluate
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition:
sqrt.hh:37
Dune::PDELab::SqrtGridFunctionAdapter::setTime
void setTime(Time time)
Definition:
sqrt.hh:49
Dune::PDELab::SqrtGridFunctionAdapter
Take sqrt of a GridFunction.
Definition:
sqrt.hh:16
Dune::PDELab::SqrtGridFunctionAdapter::getGridView
const Traits::GridViewType & getGridView() const
Definition:
sqrt.hh:44
Dune::PDELab::GridFunctionInterface::Traits
T Traits
Export type traits.
Definition:
function.hh:192
e
const Entity & e
Definition:
localfunctionspace.hh:120
function.hh
Dune::PDELab::GridFunctionBase
leaf of a function tree
Definition:
function.hh:298
Dune::PDELab::SqrtGridFunctionAdapter::SqrtGridFunctionAdapter
SqrtGridFunctionAdapter(GF &gf_)
Definition:
sqrt.hh:33
Dune::PDELab::SqrtGridFunctionAdapter::Traits
Base::Traits Traits
Definition:
sqrt.hh:31
Generated by
1.8.17