3 #ifndef GENERIC_INTERPOLATIONHELPER_HH 4 #define GENERIC_INTERPOLATIONHELPER_HH 8 #include <dune/common/fvector.hh> 16 template<
class F,
unsigned int dimension >
19 template <
class Func,
class Container,
bool type>
22 template <
class F,
unsigned int d>
23 template <
class Func,
class Vector>
27 typedef std::vector< Dune::FieldVector<F,d> >
Result;
28 Helper(
const Func & func, Vector &vec)
33 const typename Vector::value_type &
operator()(
unsigned int row,
unsigned int col)
38 void set(
unsigned int row,
unsigned int col,
42 assert(row<vec_.size());
46 void add(
unsigned int row,
unsigned int col,
50 assert(row<vec_.size());
51 vec_[row] +=
field_cast<
typename Vector::value_type>(val);
53 template <
class DomainVector>
54 const Result &
evaluate(
const DomainVector &x)
const 56 typename Func::DomainType xx ;
57 typename Func::RangeType ff ;
59 func_.evaluate(xx,ff);
71 template <
class F,
unsigned int d>
72 template <
class Basis,
class Matrix>
76 typedef std::vector< Dune::FieldVector<F,d> >
Result;
77 Helper(
const Basis & basis, Matrix &matrix)
81 const F &
operator()(
unsigned int row,
unsigned int col)
const 83 return matrix_(row,col);
87 return matrix_(row,col);
90 void set(
unsigned int row,
unsigned int col,
93 assert(col<matrix_.cols());
94 assert(row<matrix_.rows());
98 void add(
unsigned int row,
unsigned int col,
101 assert(col<matrix_.cols());
102 assert(row<matrix_.rows());
103 matrix_(row,col) += val;
105 template <
class DomainVector>
106 const Result &
evaluate(
const DomainVector &x)
const 108 basis_.template evaluate<0>(x,tmp_);
113 return basis_.size();
121 #endif // GENERIC_INTERPOLATIONHELPER_HH const Func & func_
Definition: interpolationhelper.hh:67
Result tmp_
Definition: interpolationhelper.hh:69
Vector & vec_
Definition: interpolationhelper.hh:68
const Basis & basis_
Definition: interpolationhelper.hh:116
unsigned int size() const
Definition: interpolationhelper.hh:111
Matrix & matrix_
Definition: interpolationhelper.hh:117
Result tmp_
Definition: interpolationhelper.hh:118
Helper(const Basis &basis, Matrix &matrix)
Definition: interpolationhelper.hh:77
const Result & evaluate(const DomainVector &x) const
Definition: interpolationhelper.hh:106
Definition: interpolationhelper.hh:17
const Vector::value_type & operator()(unsigned int row, unsigned int col)
Definition: interpolationhelper.hh:33
std::vector< Dune::FieldVector< F, d > > Result
Definition: interpolationhelper.hh:27
std::vector< Dune::FieldVector< F, d > > Result
Definition: interpolationhelper.hh:76
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:157
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:15
Helper(const Func &func, Vector &vec)
Definition: interpolationhelper.hh:28
void add(unsigned int row, unsigned int col, const Fy &val)
Definition: interpolationhelper.hh:46
F & operator()(unsigned int row, unsigned int col)
Definition: interpolationhelper.hh:85
void add(unsigned int row, unsigned int col, const Fy &val)
Definition: interpolationhelper.hh:98
Definition: interpolationhelper.hh:20
const Result & evaluate(const DomainVector &x) const
Definition: interpolationhelper.hh:54
const F & operator()(unsigned int row, unsigned int col) const
Definition: interpolationhelper.hh:81
unsigned int size() const
Definition: interpolationhelper.hh:63