4#ifndef DUNE_LOCALFUNCTIONS_META_POWER_INTERPOLATION_HH
5#define DUNE_LOCALFUNCTIONS_META_POWER_INTERPOLATION_HH
12#include <dune/localfunctions/common/localinterpolation.hh>
24 template<
class Backend,
class BasisTraits>
26 static_assert(Backend::Traits::dimRange == 1,
27 "PowerInterpolation works only with scalar backends");
29 const Backend *backend;
46 class ComponentEvaluator :
47 public Function<typename Backend::Traits::DomainLocal, typename Backend::Traits::Range>
53 ComponentEvaluator(
const F &f_, std::size_t comp_) :
57 void evaluate(
const typename Backend::Traits::DomainLocal &x,
58 typename Backend::Traits::Range &y)
const
60 typename Traits::Range fy = f(x);
76 template<
typename F,
typename C>
79 auto&& f = Impl::makeFunctionWithCallOperator<typename Backend::Traits::DomainLocal>(ff);
84 for(std::size_t d = 0; d < Traits::dimRange; ++d) {
89 backend->interpolate(ComponentEvaluator<std::decay_t<
decltype(f)>>(f, d), cout);
91 out.resize(cout.size()*Traits::dimRange);
93 assert(out.size() == cout.size()*Traits::dimRange);
94 std::copy(cout.begin(), cout.end(), out.begin() + d*cout.size());
Base class template for function classes.
Definition: function.hh:29
Meta-interpolation turning a scalar interpolation into vector-valued interpolation.
Definition: interpolation.hh:25
void interpolate(const F &ff, std::vector< C > &out) const
Determine coefficients interpolating a given function.
Definition: interpolation.hh:77
BasisTraits Traits
Export basis traits.
Definition: interpolation.hh:33
PowerInterpolation(const Backend &backend_)
Construct a PowerInterpolation.
Definition: interpolation.hh:42
Simple base class templates for functions.
Dune namespace.
Definition: alignedallocator.hh:14