/usr/include/dune/localfunctions/lagrange/qk/qklocalinterpolation.hh is in libdune-localfunctions-dev 2.4.1-1.
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 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_LOCALFUNCTIONS_QKLOCALINTERPOLATION_HH
#define DUNE_LOCALFUNCTIONS_QKLOCALINTERPOLATION_HH
#include <dune/common/fvector.hh>
#include <dune/common/power.hh>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/localbasis.hh>
#include <dune/localfunctions/common/localfiniteelementtraits.hh>
namespace Dune
{
/** \todo Please doc me! */
template<int k, int d, class LB>
class QkLocalInterpolation
{
// Return i as a d-digit number in the (k+1)-nary system
static Dune::FieldVector<int,d> multiindex (int i)
{
Dune::FieldVector<int,d> alpha;
for (int j=0; j<d; j++)
{
alpha[j] = i % (k+1);
i = i/(k+1);
}
return alpha;
}
public:
//! \brief Local interpolation of a function
template<typename F, typename C>
void interpolate (const F& f, std::vector<C>& out) const
{
typename LB::Traits::DomainType x;
typename LB::Traits::RangeType y;
out.resize(StaticPower<k+1,d>::power);
for (int i=0; i<StaticPower<k+1,d>::power; i++)
{
// convert index i to multiindex
Dune::FieldVector<int,d> alpha(multiindex(i));
// Generate coordinate of the i-th Lagrange point
for (int j=0; j<d; j++)
x[j] = (1.0*alpha[j])/k;
f.evaluate(x,y); out[i] = y;
}
}
};
/** \todo Please doc me! */
template<int d, class LB>
class QkLocalInterpolation<0,d,LB>
{
public:
//! \brief Local interpolation of a function
template<typename F, typename C>
void interpolate (const F& f, std::vector<C>& out) const
{
typename LB::Traits::DomainType x(0);
typename LB::Traits::RangeType y;
f.evaluate(x,y);
out.resize(1);
out[0] = y;
}
};
}
#endif
|