4#ifndef DUNE_PDELAB_COMMON_FUNCTIONWRAPPERS_HH
5#define DUNE_PDELAB_COMMON_FUNCTIONWRAPPERS_HH
10#include <dune/typetree/nodetags.hh>
32 template<
typename Engine,
typename F0,
typename... Functions>
36 PointwiseGridFunctionAdapter<Engine, F0, Functions...> >
39 typedef typename F0::Traits Traits;
43 std::tuple<
const F0*,
const Functions*...> storage;
54 template<
unsigned int I,
unsigned int N>
56 const typename Traits::ElementType& e,
57 const typename Traits::DomainType& x,
58 std::vector<typename Traits::RangeType>& y,
59 std::integral_constant<unsigned int, I>,
60 std::integral_constant<unsigned int, N>,
61 std::integral_constant<bool, true>)
const {
62 std::get<I>(storage)->
evaluate(e, x, y[I]);
64 std::integral_constant<unsigned int, I+1>(),
65 std::integral_constant<unsigned int, N>(),
66 std::integral_constant<
bool, (I+1<N)>()
71 template<
unsigned int I>
73 const typename Traits::ElementType& e,
74 const typename Traits::DomainType& x,
75 std::vector<typename Traits::RangeType>& y,
76 std::integral_constant<unsigned int, I>,
77 std::integral_constant<unsigned int, I>,
78 std::integral_constant<bool, false>)
const
93 template<
typename... F>
95 : engine(engine_), storage(&functions...)
98 inline void evaluate (
const typename Traits::ElementType& e,
99 const typename Traits::DomainType& x,
100 typename Traits::RangeType& y)
const
102 static const unsigned int N =
sizeof...(Functions)+1;
103 std::vector<typename Traits::RangeType> in(N);
105 std::integral_constant<unsigned int, 0>(),
106 std::integral_constant<unsigned int, N>(),
107 std::integral_constant<bool, true>()
109 engine.evaluate(y, in);
112 inline const typename Traits::GridViewType& getGridView ()
const
114 return std::get<0>(storage)->getGridView();
121 template<
typename Engine,
typename... Functions>
122 PointwiseGridFunctionAdapter<Engine, Functions...>
123 makePointwiseGridFunctionAdapter(
const Engine& engine,
const Functions&... f)
125 return PointwiseGridFunctionAdapter
126 <Engine,Functions...>
148 template<
typename Domain,
typename Range>
150 const std::vector<Domain>& in)
const;
175 template<
typename Domain,
typename Range>
177 const std::vector<Domain>& in)
const {
178 assert(in.size() == 1);
188 PointwiseScaleAdapterEngine<S>
204 template<
typename Domain,
typename Range>
206 const std::vector<Domain>& in)
const {
208 for(
unsigned i = 0; i < in.size(); ++i)
leaf of a function tree
Definition: function.hh:302
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: function.hh:208
Interface of a pointwise adapter engine.
Definition: functionwrappers.hh:137
void evaluate(Range &out, const std::vector< Domain > &in) const
calculate the adapted value from a set of input values
Definition: functionwrappers.hh:37
PointwiseGridFunctionAdapter(const Engine &engine_, const F &... functions)
construct a PointwiseGridFunctionAdapter
Definition: functionwrappers.hh:94
Scale the output value.
Definition: functionwrappers.hh:161
PointwiseScaleAdapterEngine(const S scale_)
create a PointwiseScaleAdapterEngine
Definition: functionwrappers.hh:170
void evaluate(Range &out, const std::vector< Domain > &in) const
calculate the adapted value from a set of input values
Definition: functionwrappers.hh:176
PointwiseScaleAdapterEngine< S > makePointwiseScaleAdapterEngine(const S scale)
syntactic sugar to create a PointwiseScaleAdapterEngine
Definition: functionwrappers.hh:189
Sum all terms.
Definition: functionwrappers.hh:200
void evaluate(Range &out, const std::vector< Domain > &in) const
calculate the adapted value from a set of input values
Definition: functionwrappers.hh:205
Dune namespace.
Definition: alignedallocator.hh:11