dune-localfunctions  2.9.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 // SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_P0LOCALINTERPOLATION_HH
6 #define DUNE_P0LOCALINTERPOLATION_HH
7 
8 #include <vector>
9 #include <dune/geometry/referenceelements.hh>
11 
12 
13 namespace Dune
14 {
15 
16  template<class LB>
18  {
19  public:
20  P0LocalInterpolation (const GeometryType& gt) : gt_(gt)
21  {}
22 
24  template<typename F, typename C>
25  void interpolate (const F& ff, std::vector<C>& out) const
26  {
27  typedef typename LB::Traits::DomainType DomainType;
28  typedef typename LB::Traits::DomainFieldType DF;
29  const int dim=LB::Traits::dimDomain;
30 
31  auto&& f = Impl::makeFunctionWithCallOperator<typename LB::Traits::DomainType>(ff);
32 
33  DomainType x = Dune::ReferenceElements<DF,dim>::general(gt_).position(0,0);
34 
35  out.resize(1);
36  out[0] = f(x);
37  }
38 
39  private:
40  GeometryType gt_;
41  };
42 
43 }
44 
45 #endif
Definition: bdfmcube.hh:18
Definition: p0localinterpolation.hh:18
P0LocalInterpolation(const GeometryType &gt)
Definition: p0localinterpolation.hh:20
void interpolate(const F &ff, std::vector< C > &out) const
determine coefficients interpolating a given function
Definition: p0localinterpolation.hh:25