/usr/include/dune/localfunctions/monom/monomlocalinterpolation.hh is in libdune-localfunctions-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | // -*- tab-width: 4; indent-tabs-mode: nil -*-
#ifndef DUNE_MONOMLOCALINTERPOLATION_HH
#define DUNE_MONOMLOCALINTERPOLATION_HH
#include <vector>
#include <dune/common/deprecated.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/geometry/type.hh>
#include <dune/geometry/quadraturerules.hh>
namespace Dune
{
template<class LB, unsigned int size>
class MonomLocalInterpolation
{
typedef typename LB::Traits::DomainType D;
typedef typename LB::Traits::DomainFieldType DF;
static const int dimD=LB::Traits::dimDomain;
typedef typename LB::Traits::RangeType R;
typedef typename LB::Traits::RangeFieldType RF;
typedef QuadratureRule<DF,dimD> QR;
typedef typename QR::iterator QRiterator;
void init() {
if(size != lb.size())
DUNE_THROW(Exception, "size template parameter does not match size of "
"local basis");
const QRiterator qrend = qr.end();
for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
std::vector<R> base;
lb.evaluateFunction(qrit->position(),base);
for(unsigned int i = 0; i < size; ++i)
for(unsigned int j = 0; j < size; ++j)
Minv[i][j] += qrit->weight() * base[i] * base[j];
}
Minv.invert();
}
public:
MonomLocalInterpolation (const GeometryType::BasicType &bt_,
const LB &lb_) DUNE_DEPRECATED
: gt(bt_, dimD), lb(lb_), Minv(0)
, qr(QuadratureRules<DF,dimD>::rule(gt, 2*lb.order()))
{ init(); }
MonomLocalInterpolation (const GeometryType >_,
const LB &lb_)
: gt(gt_), lb(lb_), Minv(0)
, qr(QuadratureRules<DF,dimD>::rule(gt, 2*lb.order()))
{ init(); }
//! determine coefficients interpolating a given function
template<typename F, typename C>
void interpolate (const F& f, std::vector<C>& out) const
{
out.clear();
out.resize(size, 0);
const QRiterator qrend = qr.end();
for(QRiterator qrit = qr.begin(); qrit != qrend; ++qrit) {
//TODO: mass matrix
R y;
f.evaluate(qrit->position(),y);
std::vector<R> base;
lb.evaluateFunction(qrit->position(),base);
for(unsigned int i = 0; i < size; ++i)
for(unsigned int j = 0; j < size; ++j)
out[i] += Minv[i][j] * qrit->weight() * y * base[j];
}
}
private:
GeometryType gt;
const LB &lb;
FieldMatrix<RF, size, size> Minv;
const QR &qr;
};
}
#endif //DUNE_MONOMLOCALINTERPOLATION_HH
|