DUNE-FEM (unstable)

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 © 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
11
12namespace Dune
13{
14
18 template<class LB>
19 class P0LocalInterpolation
20 {
21 public:
22 P0LocalInterpolation (const GeometryType& gt) : gt_(gt)
23 {}
24
26 template<typename F, typename C>
27 void interpolate (const F& f, std::vector<C>& out) const
28 {
29 typedef typename LB::Traits::DomainType DomainType;
30 typedef typename LB::Traits::DomainFieldType DF;
31 const int dim=LB::Traits::dimDomain;
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
static void interpolate(const GridFunction &u, DiscreteFunction &v)
perform native interpolation of a discrete function space
Definition: interpolate.hh:54
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:156
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)