5#ifndef GENERIC_INTERPOLATIONHELPER_HH
6#define GENERIC_INTERPOLATIONHELPER_HH
12#include <dune/localfunctions/utility/field.hh>
19 template<
class F,
unsigned int dimension >
20 struct InterpolationHelper
22 template <
class Func,
class Container,
bool type>
25 template <
class F,
unsigned int d>
26 template <
class Func,
class Vector>
27 struct InterpolationHelper<F,d>::Helper<Func,Vector,true>
30 typedef std::vector< Dune::FieldVector<F,d> > Result;
31 Helper(
const Func & func, Vector &vec)
36 const typename Vector::value_type &operator()(
unsigned int row,
unsigned int col)
41 void set(
unsigned int row,
unsigned int col,
45 assert(row<vec_.size());
49 void add(
unsigned int row,
unsigned int col,
53 assert(row<vec_.size());
54 vec_[row] += field_cast<typename Vector::value_type>(val);
56 template <
class DomainVector>
57 const Result &evaluate(
const DomainVector &x)
const
62 unsigned int size()
const
70 template <
class F,
unsigned int d>
71 template <
class Basis,
class Matrix>
72 struct InterpolationHelper<F,d>::Helper<Basis,Matrix,false>
75 typedef std::vector< Dune::FieldVector<F,d> > Result;
76 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();
Infrastructure for concepts.
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:159
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75