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>
17 template<
int dim,
class LB>
22 void setCoefficients(
const std::array<Dune::FieldVector<
typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)>& coefficients)
24 coefficients_ = coefficients;
29 template<
typename F,
typename C>
32 typename LB::Traits::DomainType x;
34 auto&& f = Impl::makeFunctionWithCallOperator<decltype(x)>(ff);
36 const int size = 1<<dim;
39 Dune::FieldVector<C,size> q1Coefficients;
41 for (
int i=0; i< (1<<dim); i++) {
46 for (
int j=0; j<dim; j++)
47 x[j] = (i & (1<<j)) ? 1.0 : 0.0;
49 q1Coefficients[i] = f(x);
56 Dune::FieldMatrix<C,size,size> mat;
58 for (
int i=0; i<size; i++)
59 for (
int j=0; j<size; j++)
60 mat[i][j] = coefficients_[j][i];
63 Dune::FieldVector<C,size> sol(0);
65 mat.solve(sol,q1Coefficients);
68 for (
int i=0; i<size; i++)
73 std::array<Dune::FieldVector<
typename LB::Traits::RangeFieldType, (1<<dim)> ,(1<<dim)> coefficients_;
Definition: bdfmcube.hh:16
Definition: dualq1localinterpolation.hh:19
void setCoefficients(const std::array< Dune::FieldVector< typename LB::Traits::RangeFieldType,(1<< dim)>,(1<< dim)> &coefficients)
Definition: dualq1localinterpolation.hh:22
void interpolate(const F &ff, std::vector< C > &out) const
Local interpolation of a function.
Definition: dualq1localinterpolation.hh:30