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