dune-localfunctions  2.2.1
p0localinterpolation.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_P0LOCALINTERPOLATION_HH
4 #define DUNE_P0LOCALINTERPOLATION_HH
5 
6 #include <vector>
7 #include <dune/geometry/referenceelements.hh>
8 
9 
10 namespace Dune
11 {
12 
13  template<class LB>
15  {
16  public:
17  P0LocalInterpolation (const GeometryType& gt) : gt_(gt)
18  {}
19 
21  template<typename F, typename C>
22  void interpolate (const F& f, std::vector<C>& out) const
23  {
24  typedef typename LB::Traits::DomainType DomainType;
25  typedef typename LB::Traits::RangeType RangeType;
26  typedef typename LB::Traits::DomainFieldType DF;
27  const int dim=LB::Traits::dimDomain;
28 
29  DomainType x = Dune::GenericReferenceElements<DF,dim>::general(gt_).position(0,0);
30  RangeType y;
31 
32  out.resize(1);
33  f.evaluate(x,y); out[0] = y;
34  }
35 
36  private:
37  GeometryType gt_;
38  };
39 
40 }
41 
42 #endif