dune-localfunctions  2.2.1
pk1dlocalinterpolation.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set ts=4 sw=2 et sts=2:
3 #ifndef DUNE_Pk1DLOCALINTERPOLATION_HH
4 #define DUNE_Pk1DLOCALINTERPOLATION_HH
5 
6 #include <vector>
7 
8 namespace Dune
9 {
10  template<class LB>
12  {
14  enum {N = LB::N};
15 
17  enum {k = LB::O};
18 
19  private:
20  static const int kdiv = (k == 0 ? 1 : k);
21 
22  public:
23 
24  template<typename F, typename C>
25  void interpolate (const F& f, std::vector<C>& out) const
26  {
27  typename LB::Traits::DomainType x;
28  typename LB::Traits::RangeType y;
29  typedef typename LB::Traits::DomainFieldType D;
30  out.resize(N);
31 #if DUNE_COMMON_FIELDVECTOR_SIZE_IS_METHOD
32  assert(x.size()==1);
33 #endif
34  for (int i=0; i<N; i++)
35  {
36  x[0] = ((D)i)/((D)kdiv);
37  f.evaluate(x,y);
38  out[i] = y;
39  }
40  }
41 
42  };
43 }
44 
45 #endif