Dune Core Modules (2.6.0)

interpolation.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
5#define DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
6
7#include <cstddef>
8#include <vector>
9
10#include <dune/localfunctions/whitney/edges0.5/common.hh>
11
12namespace Dune {
13
15 //
16 // Interpolation
17 //
18
20
26 template<class Geometry, class Traits_>
28 private EdgeS0_5Common<Traits_::dimDomainLocal,
29 typename Traits_::DomainField>
30 {
31 public:
32 typedef Traits_ Traits;
33
34 private:
35 static const std::size_t dim = Traits::dimDomainLocal;
37 using Base::refelem;
38 using Base::s;
39
40 std::vector<typename Traits::DomainGlobal> edgev;
41
42 public:
44
50 template<typename VertexOrder>
52 const VertexOrder& vertexOrder) :
53 edgev(s)
54 {
55 for(std::size_t i = 0; i < s; ++i) {
56 const std::size_t i0 = refelem.subEntity(i,dim-1,0,dim);
57 const std::size_t i1 = refelem.subEntity(i,dim-1,1,dim);
58
59 edgev[i] = geo.corner(i1);
60 edgev[i] -= geo.corner(i0);
61 edgev[i] /= edgev[i].two_norm();
62
63 const typename VertexOrder::iterator& edgeVertexOrder =
64 vertexOrder.begin(dim-1, i);
65 if(edgeVertexOrder[0] > edgeVertexOrder[1])
66 edgev[i] *= -1;
67 }
68 }
69
71 template<typename F, typename C>
72 void interpolate(const F& f, std::vector<C>& out) const {
73 typename Traits::Range y;
74
75 out.resize(s);
76
77 for(std::size_t i = 0; i < s; ++i) {
78 f.evaluate(refelem.position(i,dim-1), y);
79
80 out[i] = y * edgev[i];
81 }
82 }
83 };
84
85} // namespace Dune
86
87#endif // DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_INTERPOLATION_HH
FieldTraits< value_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: densevector.hh:590
Interpolation for lowest order edge elements on simplices.
Definition: interpolation.hh:30
void interpolate(const F &f, std::vector< C > &out) const
Interpolation of a function.
Definition: interpolation.hh:72
EdgeS0_5Interpolation(const Geometry &geo, const VertexOrder &vertexOrder)
constructor
Definition: interpolation.hh:51
Wrapper class for geometries.
Definition: geometry.hh:67
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: geometry.hh:153
Dune namespace.
Definition: alignedallocator.hh:10
Common base class for edge elements.
Definition: common.hh:17
RefElem refelem
The reference element for this edge element.
Definition: common.hh:24
std::size_t s
The number of base functions.
Definition: common.hh:32
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)