Dune Core Modules (2.6.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
9
10namespace Dune
11{
12
13 template<class LB>
14 class P0LocalInterpolation
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::ReferenceElements<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
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:147
Dune namespace.
Definition: alignedallocator.hh:10
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 28, 23:30, 2024)