3 #ifndef DUNE_DUAL_Q1_LOCALINTERPOLATION_HH
4 #define DUNE_DUAL_Q1_LOCALINTERPOLATION_HH
8 #include <dune/common/fvector.hh>
9 #include <dune/common/fmatrix.hh>
15 template<
int dim,
class LB>
20 void setCoefficients(
const Dune::array<Dune::FieldVector<
typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)>& coefficients)
22 coefficients_ = coefficients;
27 template<
typename F,
typename C>
30 typename LB::Traits::DomainType x;
31 typename LB::Traits::RangeType y;
33 const int size = 1<<dim;
36 Dune::FieldVector<C,size> q1Coefficients;
38 for (
int i=0; i< (1<<dim); i++) {
43 for (
int j=0; j<dim; j++)
44 x[j] = (i & (1<<j)) ? 1.0 : 0.0;
46 f.evaluate(x,y); q1Coefficients[i] = y;
53 Dune::FieldMatrix<C,size,size> mat;
55 for (
int i=0; i<size; i++)
56 for (
int j=0; j<size; j++)
57 mat[i][j] = coefficients_[j][i];
60 Dune::FieldVector<C,size> sol(0);
62 mat.solve(sol,q1Coefficients);
65 for (
int i=0; i<size; i++)
70 Dune::array<Dune::FieldVector<typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)> coefficients_;
void setCoefficients(const Dune::array< Dune::FieldVector< typename LB::Traits::RangeFieldType,(1<< dim)>,(1<< dim)> &coefficients)
Definition: dualq1localinterpolation.hh:20
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: dualq1localinterpolation.hh:28
Definition: dualq1localinterpolation.hh:16