dune-localfunctions  2.8.0
p0localinterpolation.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_P0LOCALINTERPOLATION_HH
4 #define DUNE_P0LOCALINTERPOLATION_HH
5 
6 #include <vector>
7 #include <dune/geometry/referenceelements.hh>
9 
10 
11 namespace Dune
12 {
13 
14  template<class LB>
16  {
17  public:
18  P0LocalInterpolation (const GeometryType& gt) : gt_(gt)
19  {}
20 
22  template<typename F, typename C>
23  void interpolate (const F& ff, std::vector<C>& out) const
24  {
25  typedef typename LB::Traits::DomainType DomainType;
26  typedef typename LB::Traits::DomainFieldType DF;
27  const int dim=LB::Traits::dimDomain;
28 
29  auto&& f = Impl::makeFunctionWithCallOperator<typename LB::Traits::DomainType>(ff);
30 
31  DomainType x = Dune::ReferenceElements<DF,dim>::general(gt_).position(0,0);
32 
33  out.resize(1);
34  out[0] = f(x);
35  }
36 
37  private:
38  GeometryType gt_;
39  };
40 
41 }
42 
43 #endif
Definition: bdfmcube.hh:16
Definition: p0localinterpolation.hh:16
P0LocalInterpolation(const GeometryType &gt)
Definition: p0localinterpolation.hh:18
void interpolate(const F &ff, std::vector< C > &out) const
determine coefficients interpolating a given function
Definition: p0localinterpolation.hh:23