5#ifndef DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
6#define DUNE_LOCALFUNCTIONS_MONOMIAL_MONOMIALLOCALINTERPOLATION_HH
10#include <dune/common/fvector.hh>
11#include <dune/common/fmatrix.hh>
13#include <dune/geometry/type.hh>
14#include <dune/geometry/quadraturerules.hh>
22 template<
class LB,
unsigned int size>
23 class MonomialLocalInterpolation
25 typedef typename LB::Traits::DomainType D;
26 typedef typename LB::Traits::DomainFieldType DF;
27 static const int dimD=LB::Traits::dimDomain;
28 typedef typename LB::Traits::RangeType R;
29 typedef typename LB::Traits::RangeFieldType RF;
31 typedef QuadratureRule<DF,dimD> QR;
32 typedef typename QR::iterator QRiterator;
35 MonomialLocalInterpolation (
const GeometryType >_,
37 : gt(gt_), lb(lb_), Minv(0)
38 , qr(QuadratureRules<DF,dimD>::rule(gt, 2*lb.order()))
42 DUNE_THROW(Exception,
"size template parameter does not match size of "
45 const QRiterator qrend = qr.end();
46 for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
48 lb.evaluateFunction(qrit->position(),base);
50 for(
unsigned int i = 0; i < size; ++i)
51 for(
unsigned int j = 0; j < size; ++j)
52 Minv[i][j] += qrit->weight() * base[i] * base[j];
64 template<
typename F,
typename C>
65 void interpolate (
const F& f, std::vector<C>& out)
const
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;