5 #ifndef DUNE_DUAL_Q1_LOCALINTERPOLATION_HH 6 #define DUNE_DUAL_Q1_LOCALINTERPOLATION_HH 11 #include <dune/common/fvector.hh> 12 #include <dune/common/fmatrix.hh> 20 template<
int dim,
class LB>
25 void setCoefficients(
const std::array<Dune::FieldVector<
typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)>& coefficients)
27 coefficients_ = coefficients;
32 template<
typename F,
typename C>
35 typename LB::Traits::DomainType x;
37 const int size = 1<<dim;
40 Dune::FieldVector<C,size> q1Coefficients;
42 for (
int i=0; i< (1<<dim); i++) {
47 for (
int j=0; j<dim; j++)
48 x[j] = (i & (1<<j)) ? 1.0 : 0.0;
50 q1Coefficients[i] = f(x);
57 Dune::FieldMatrix<C,size,size> mat;
59 for (
int i=0; i<size; i++)
60 for (
int j=0; j<size; j++)
61 mat[i][j] = coefficients_[j][i];
64 Dune::FieldVector<C,size> sol(0);
66 mat.solve(sol,q1Coefficients);
69 for (
int i=0; i<size; i++)
74 std::array<Dune::FieldVector<typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)> coefficients_;
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: dualq1localinterpolation.hh:33
Definition: dualq1localinterpolation.hh:21
Definition: bdfmcube.hh:17
void setCoefficients(const std::array< Dune::FieldVector< typename LB::Traits::RangeFieldType,(1<< dim)>,(1<< dim)> &coefficients)
Definition: dualq1localinterpolation.hh:25