dune-localfunctions 2.12-git
Loading...
Searching...
No Matches
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 © 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>
10
12
13
14namespace Dune
15{
16
20 template<class LB>
22 {
23 public:
24 P0LocalInterpolation (const GeometryType& gt) : gt_(gt)
25 {}
26
28 template<typename F, typename C>
29 void interpolate (const F& f, std::vector<C>& out) const
30 {
31 typedef typename LB::Traits::DomainType DomainType;
32 typedef typename LB::Traits::DomainFieldType DF;
33 const int dim=LB::Traits::dimDomain;
34
35 DomainType x = Dune::ReferenceElements<DF,dim>::general(gt_).position(0,0);
36
37 out.resize(1);
38 out[0] = Impl::rangeCast(f(x));
39 }
40
41 private:
42 GeometryType gt_;
43 };
44
45}
46
47#endif
size_type dim() const
Definition p0localinterpolation.hh:22
P0LocalInterpolation(const GeometryType &gt)
Definition p0localinterpolation.hh:24
void interpolate(const F &f, std::vector< C > &out) const
determine coefficients interpolating a given function
Definition p0localinterpolation.hh:29
T resize(T... args)