Dune Core Modules (2.7.0)

hierarchicalprismp2localinterpolation.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_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
4#define DUNE_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
5
6#include <vector>
7#include <dune/localfunctions/common/localinterpolation.hh>
8
9namespace Dune
10{
14 template<class LB>
16 {
17 public:
18
19 template<typename F, typename C>
20 void interpolate (const F& ff, std::vector<C>& out) const
21 {
22 typename LB::Traits::DomainType x;
23 typename LB::Traits::RangeType y;
24 out.resize(18);
25
26 auto&& f = Impl::makeFunctionWithCallOperator<decltype(x)>(ff);
27
28 //First the vertex dofs
29 x[0] = 0.0; x[1] = 0.0; x[2] = 0.0; out[0] = f(x);
30 x[0] = 1.0; x[1] = 0.0; x[2] = 0.0; out[1] = f(x);
31 x[0] = 0.0; x[1] = 1.0; x[2] = 0.0; out[2] = f(x);
32 x[0] = 0.0; x[1] = 0.0; x[2] = 1.0; out[3] = f(x);
33 x[0] = 1.0; x[1] = 0.0; x[2] = 1.0; out[4] = f(x);
34 x[0] = 0.0; x[1] = 1.0; x[2] = 1.0; out[5] = f(x);
35
36
37 // Then: the 9 edge dofs and the 3 face dofs
38 x[0] = 0.0; x[1] = 0.0; x[2] = 0.5; y = f(x);
39 out[6] = y - 0.5*(out[0] + out[3]);
40
41 x[0] = 1.0; x[1] = 0.0; x[2] = 0.5; y = f(x);
42 out[7] = y - 0.5*(out[1] + out[4]);
43
44 x[0] = 0.0; x[1] = 1.0; x[2] = 0.5; y = f(x);
45 out[8] = y - 0.5*(out[2] + out[5]);
46
47 x[0] = 0.5; x[1] = 0.0; x[2] = 0.0; y = f(x);
48 out[9] = y - 0.5*(out[0] + out[1]);
49
50 x[0] = 0.0; x[1] = 0.5; x[2] = 0.0; y = f(x);
51 out[10] = y - 0.5*(out[2] + out[0]);
52
53 x[0] = 0.5; x[1] = 0.5; x[2] = 0.0; y = f(x);
54 out[11] = y - 0.5*(out[2] + out[1]);
55
56 x[0] = 0.5; x[1] = 0.0; x[2] = 1.0; y = f(x);
57 out[12] = y - 0.5*(out[3] + out[4]);
58
59 x[0] = 0.0; x[1] = 0.5; x[2] = 1.0; y = f(x);
60 out[13] = y - 0.5*(out[3] + out[5]);
61
62 x[0] = 0.5; x[1] = 0.5; x[2] = 1.0; y = f(x);
63 out[14] = y - 0.5*(out[4] + out[5]);
64
65
66 //faces
67 x[0] = 0.5; x[1] = 0.0; x[2] = 0.5; y = f(x);
68 out[15] = y - 0.25*(out[4] + out[1] + out[0] + out[3] );
69
70 x[0] = 0.0; x[1] = 0.5; x[2] = 0.5; y = f(x);
71 out[16] = y - 0.25*(out[2] + out[0] + out[3] + out[5] );
72
73 x[0] = 0.5; x[1] = 0.5; x[2] = 0.5; y = f(x);
74 out[17] = y - 0.25*(out[2] + out[1] + out[4] + out[5] );
75
76 }
77 };
78}
79
80#endif
Definition: hierarchicalprismp2localinterpolation.hh:16
Dune namespace.
Definition: alignedallocator.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)