Dune Core Modules (2.9.1)

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