5#ifndef DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
6#define DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
15#include <dune/localfunctions/common/localinterpolation.hh>
20 template<
class LB,
unsigned int size>
21 class MonomialLocalInterpolation
23 typedef typename LB::Traits::DomainType D;
24 typedef typename LB::Traits::DomainFieldType DF;
25 static const int dimD=LB::Traits::dimDomain;
26 typedef typename LB::Traits::RangeType R;
27 typedef typename LB::Traits::RangeFieldType RF;
29 typedef QuadratureRule<DF,dimD> QR;
33 MonomialLocalInterpolation (
const GeometryType >_,
35 :
gt(gt_), lb(lb_), Minv(0)
36 , qr(QuadratureRules<DF,dimD>::rule(
gt, 2*lb.order()))
40 DUNE_THROW(Exception,
"size template parameter does not match size of "
43 const QRiterator qrend = qr.end();
44 for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
46 lb.evaluateFunction(qrit->position(),base);
48 for(
unsigned int i = 0; i < size; ++i)
49 for(
unsigned int j = 0; j < size; ++j)
50 Minv[i][j] += qrit->weight() * base[i] * base[j];
62 template<
typename F,
typename C>
63 void interpolate (
const F& ff, std::vector<C>& out)
const
65 using DomainType = std::decay_t<
decltype(qr.begin()->position())>;
67 auto&& f = Impl::makeFunctionWithCallOperator<DomainType>(ff);
72 const QRiterator qrend = qr.end();
73 for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
75 R y = f(qrit->position());
78 lb.evaluateFunction(qrit->position(),base);
80 for(
unsigned int i = 0; i < size; ++i)
81 for(
unsigned int j = 0; j < size; ++j)
82 out[i] += Minv[i][j] * qrit->weight() * y * base[j];
89 FieldMatrix<RF, size, size> Minv;
std::vector< QuadraturePoint< ct, dim > >::const_iterator iterator
Definition: quadraturerules.hh:185
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
Dune namespace.
Definition: alignedallocator.hh:13
A unique label for each type of element that can occur in a grid.