1 #ifndef GENERIC_INTERPOLATIONHELPER_HH
2 #define GENERIC_INTERPOLATIONHELPER_HH
6 #include <dune/common/fvector.hh>
14 template<
class F,
unsigned int dimension >
17 template <
class Func,
class Container,
bool type>
20 template <
class F,
unsigned int d>
21 template <
class Func,
class Vector>
25 typedef std::vector< Dune::FieldVector<F,d> >
Result;
26 Helper(
const Func& func, Vector &vec)
31 const typename Vector::value_type &operator()(
unsigned int row,
unsigned int col)
36 void set(
unsigned int row,
unsigned int col,
40 assert(row<vec_.size());
44 void add(
unsigned int row,
unsigned int col,
48 assert(row<vec_.size());
49 vec_[row] +=
field_cast<
typename Vector::value_type>(val);
51 template <
class DomainVector>
52 const Result &evaluate(
const DomainVector &x)
const
54 typename Func::DomainType xx ;
55 typename Func::RangeType ff ;
57 func_.evaluate(xx,ff);
61 unsigned int size()
const
69 template <
class F,
unsigned int d>
70 template <
class Basis,
class Matrix>
74 typedef std::vector< Dune::FieldVector<F,d> >
Result;
75 Helper(
const Basis& basis, Matrix &matrix)
80 const F &operator()(
unsigned int row,
unsigned int col)
const
82 return matrix_(row,col);
84 F &operator()(
unsigned int row,
unsigned int col)
86 return matrix_(row,col);
89 void set(
unsigned int row,
unsigned int col,
92 assert(col<matrix_.cols());
93 assert(row<matrix_.rows());
97 void add(
unsigned int row,
unsigned int col,
100 assert(col<matrix_.cols());
101 assert(row<matrix_.rows());
102 matrix_(row,col) += val;
104 template <
class DomainVector>
105 const Result &evaluate(
const DomainVector &x)
const
107 basis_.template evaluate<0>(x,tmp_);
110 unsigned int size()
const
112 return basis_.size();
120 #endif // GENERIC_INTERPOLATIONHELPER_HH