3#ifndef DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
4#define DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
13#include <dune/localfunctions/common/localinterpolation.hh>
18 template<
class LB,
unsigned int size>
19 class MonomialLocalInterpolation
21 typedef typename LB::Traits::DomainType D;
22 typedef typename LB::Traits::DomainFieldType DF;
23 static const int dimD=LB::Traits::dimDomain;
24 typedef typename LB::Traits::RangeType R;
25 typedef typename LB::Traits::RangeFieldType RF;
27 typedef QuadratureRule<DF,dimD> QR;
31 MonomialLocalInterpolation (
const GeometryType >_,
33 :
gt(gt_), lb(lb_), Minv(0)
34 , qr(QuadratureRules<DF,dimD>::rule(
gt, 2*lb.order()))
38 DUNE_THROW(Exception,
"size template parameter does not match size of "
41 const QRiterator qrend = qr.end();
42 for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
44 lb.evaluateFunction(qrit->position(),base);
46 for(
unsigned int i = 0; i < size; ++i)
47 for(
unsigned int j = 0; j < size; ++j)
48 Minv[i][j] += qrit->weight() * base[i] * base[j];
60 template<
typename F,
typename C>
61 void interpolate (
const F& ff, std::vector<C>& out)
const
63 using DomainType = std::decay_t<
decltype(qr.begin()->position())>;
65 auto&& f = Impl::makeFunctionWithCallOperator<DomainType>(ff);
70 const QRiterator qrend = qr.end();
71 for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
73 R y = f(qrit->position());
76 lb.evaluateFunction(qrit->position(),base);
78 for(
unsigned int i = 0; i < size; ++i)
79 for(
unsigned int j = 0; j < size; ++j)
80 out[i] += Minv[i][j] * qrit->weight() * y * base[j];
87 FieldMatrix<RF, size, size> Minv;
std::vector< QuadraturePoint< ct, dim > >::const_iterator iterator
Definition: quadraturerules.hh:183
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
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:216
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156
void interpolate(const F &f, const GFS &gfs, XG &xg)
interpolation from a given grid function
Definition: interpolate.hh:177
Dune namespace.
Definition: alignedallocator.hh:11
A unique label for each type of element that can occur in a grid.