3 #ifndef DUNE_DUAL_Q1_LOCALINTERPOLATION_HH 4 #define DUNE_DUAL_Q1_LOCALINTERPOLATION_HH 9 #include <dune/common/fvector.hh> 10 #include <dune/common/fmatrix.hh> 16 template<
int dim,
class LB>
21 void setCoefficients(
const std::array<Dune::FieldVector<
typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)>& coefficients)
23 coefficients_ = coefficients;
28 template<
typename F,
typename C>
31 typename LB::Traits::DomainType x;
32 typename LB::Traits::RangeType y;
34 const int size = 1<<dim;
37 Dune::FieldVector<C,size> q1Coefficients;
39 for (
int i=0; i< (1<<dim); i++) {
44 for (
int j=0; j<dim; j++)
45 x[j] = (i & (1<<j)) ? 1.0 : 0.0;
47 f.evaluate(x,y); q1Coefficients[i] = y;
54 Dune::FieldMatrix<C,size,size> mat;
56 for (
int i=0; i<size; i++)
57 for (
int j=0; j<size; j++)
58 mat[i][j] = coefficients_[j][i];
61 Dune::FieldVector<C,size> sol(0);
63 mat.solve(sol,q1Coefficients);
66 for (
int i=0; i<size; i++)
71 std::array<Dune::FieldVector<typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)> coefficients_;
Definition: dualq1localinterpolation.hh:17
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:15
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: dualq1localinterpolation.hh:29
void setCoefficients(const std::array< Dune::FieldVector< typename LB::Traits::RangeFieldType,(1<< dim)>,(1<< dim)> &coefficients)
Definition: dualq1localinterpolation.hh:21