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