dune-localfunctions 2.12-git
Loading...
Searching...
No Matches
hierarchicalprismp2localinterpolation.hh
Go to the documentation of this file.
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_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
6#define DUNE_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
7
8#include <vector>
9
11
12namespace Dune
13{
17 template<class LB>
19 {
20 public:
21
22 template<typename F, typename C>
23 void interpolate (const F& f, std::vector<C>& out) const
24 {
25 typename LB::Traits::DomainType x;
26 typename LB::Traits::RangeFieldType y;
27 out.resize(18);
28
29 //First the vertex dofs
30 x[0] = 0.0; x[1] = 0.0; x[2] = 0.0; out[0] = Impl::rangeCast(f(x));
31 x[0] = 1.0; x[1] = 0.0; x[2] = 0.0; out[1] = Impl::rangeCast(f(x));
32 x[0] = 0.0; x[1] = 1.0; x[2] = 0.0; out[2] = Impl::rangeCast(f(x));
33 x[0] = 0.0; x[1] = 0.0; x[2] = 1.0; out[3] = Impl::rangeCast(f(x));
34 x[0] = 1.0; x[1] = 0.0; x[2] = 1.0; out[4] = Impl::rangeCast(f(x));
35 x[0] = 0.0; x[1] = 1.0; x[2] = 1.0; out[5] = Impl::rangeCast(f(x));
36
37
38 // Then: the 9 edge dofs and the 3 face dofs
39 x[0] = 0.0; x[1] = 0.0; x[2] = 0.5; y = Impl::rangeCast(f(x));
40 out[6] = y - 0.5*(out[0] + out[3]);
41
42 x[0] = 1.0; x[1] = 0.0; x[2] = 0.5; y = Impl::rangeCast(f(x));
43 out[7] = y - 0.5*(out[1] + out[4]);
44
45 x[0] = 0.0; x[1] = 1.0; x[2] = 0.5; y = Impl::rangeCast(f(x));
46 out[8] = y - 0.5*(out[2] + out[5]);
47
48 x[0] = 0.5; x[1] = 0.0; x[2] = 0.0; y = Impl::rangeCast(f(x));
49 out[9] = y - 0.5*(out[0] + out[1]);
50
51 x[0] = 0.0; x[1] = 0.5; x[2] = 0.0; y = Impl::rangeCast(f(x));
52 out[10] = y - 0.5*(out[2] + out[0]);
53
54 x[0] = 0.5; x[1] = 0.5; x[2] = 0.0; y = Impl::rangeCast(f(x));
55 out[11] = y - 0.5*(out[2] + out[1]);
56
57 x[0] = 0.5; x[1] = 0.0; x[2] = 1.0; y = Impl::rangeCast(f(x));
58 out[12] = y - 0.5*(out[3] + out[4]);
59
60 x[0] = 0.0; x[1] = 0.5; x[2] = 1.0; y = Impl::rangeCast(f(x));
61 out[13] = y - 0.5*(out[3] + out[5]);
62
63 x[0] = 0.5; x[1] = 0.5; x[2] = 1.0; y = Impl::rangeCast(f(x));
64 out[14] = y - 0.5*(out[4] + out[5]);
65
66
67 //faces
68 x[0] = 0.5; x[1] = 0.0; x[2] = 0.5; y = Impl::rangeCast(f(x));
69 out[15] = y - 0.25*(out[4] + out[1] + out[0] + out[3] );
70
71 x[0] = 0.0; x[1] = 0.5; x[2] = 0.5; y = Impl::rangeCast(f(x));
72 out[16] = y - 0.25*(out[2] + out[0] + out[3] + out[5] );
73
74 x[0] = 0.5; x[1] = 0.5; x[2] = 0.5; y = Impl::rangeCast(f(x));
75 out[17] = y - 0.25*(out[2] + out[1] + out[4] + out[5] );
76
77 }
78 };
79}
80
81#endif
Definition hierarchicalprismp2localinterpolation.hh:19
void interpolate(const F &f, std::vector< C > &out) const
Definition hierarchicalprismp2localinterpolation.hh:23
T resize(T... args)