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>
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>
108 basis_.template evaluate<0>(x,tmp_);
113 return basis_.size();
Definition brezzidouglasmarini1cube2d.hh:14
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition field.hh:157
Definition interpolationhelper.hh:18
Definition interpolationhelper.hh:20
void add(unsigned int row, unsigned int col, const Fy &val)
Definition interpolationhelper.hh:46
const Func & func_
Definition interpolationhelper.hh:67
Helper(const Func &func, Vector &vec)
Definition interpolationhelper.hh:28
const Result & evaluate(const DomainVector &x) const
Definition interpolationhelper.hh:54
std::vector< Dune::FieldVector< F, d > > Result
Definition interpolationhelper.hh:27
unsigned int size() const
Definition interpolationhelper.hh:63
Vector & vec_
Definition interpolationhelper.hh:68
void set(unsigned int row, unsigned int col, const Fy &val)
Definition interpolationhelper.hh:38
Result tmp_
Definition interpolationhelper.hh:69
const Vector::value_type & operator()(unsigned int row, unsigned int col)
Definition interpolationhelper.hh:33
const Basis & basis_
Definition interpolationhelper.hh:116
const Result & evaluate(const DomainVector &x) const
Definition interpolationhelper.hh:106
F & operator()(unsigned int row, unsigned int col)
Definition interpolationhelper.hh:85
void set(unsigned int row, unsigned int col, const Fy &val)
Definition interpolationhelper.hh:90
Helper(const Basis &basis, Matrix &matrix)
Definition interpolationhelper.hh:77
unsigned int size() const
Definition interpolationhelper.hh:111
Result tmp_
Definition interpolationhelper.hh:118
void add(unsigned int row, unsigned int col, const Fy &val)
Definition interpolationhelper.hh:98
std::vector< Dune::FieldVector< F, d > > Result
Definition interpolationhelper.hh:76
Matrix & matrix_
Definition interpolationhelper.hh:117
const F & operator()(unsigned int row, unsigned int col) const
Definition interpolationhelper.hh:81