Dune Core Modules (2.8.0)

p0localinterpolation.hh
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>
8#include <dune/localfunctions/common/localinterpolation.hh>
9
10
11namespace Dune
12{
13
14 template<class LB>
15 class P0LocalInterpolation
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
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156
Dune namespace.
Definition: alignedallocator.hh:11
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:196
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)