dune-localfunctions 2.9.0
refinedp0localinterpolation.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 (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_REFINED_P0_LOCALINTERPOLATION_HH
6#define DUNE_REFINED_P0_LOCALINTERPOLATION_HH
7
10
11namespace Dune
12{
13 template<class LB>
15 {};
16
17 template<class D, class R>
19 {
21 typedef typename LB::Traits::DomainType DT;
22
23 public:
25 interpolationPoints_(2)
26 {
27 // Interpolation is done by evaluating at the halved segments centers
28 interpolationPoints_[0][0] = 1.0/4.0;
29
30 interpolationPoints_[1][0] = 3.0/4.0;
31 }
32
33
34 template<typename F, typename C>
35 void interpolate (const F& ff, std::vector<C>& out) const
36 {
37 auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
38
39 out.resize(interpolationPoints_.size());
40 for (size_t i = 0; i < out.size(); ++i)
41 {
42 out[i] = f(interpolationPoints_[i]);
43 }
44 }
45
46 private:
47 std::vector<DT> interpolationPoints_;
48 };
49
50 template<class D, class R>
52 {
54 typedef typename LB::Traits::DomainType DT;
55
56 public:
58 interpolationPoints_(4)
59 {
60 // Interpolation is done by evaluating at the subtriangle centers
61 interpolationPoints_[0][0] = 1.0/6;
62 interpolationPoints_[0][1] = 1.0/6;
63
64 interpolationPoints_[1][0] = 4.0/6;
65 interpolationPoints_[1][1] = 1.0/6;
66
67 interpolationPoints_[2][0] = 1.0/6;
68 interpolationPoints_[2][1] = 4.0/6;
69
70 interpolationPoints_[3][0] = 2.0/6;
71 interpolationPoints_[3][1] = 2.0/6;
72 }
73
74
75 template<typename F, typename C>
76 void interpolate (const F& ff, std::vector<C>& out) const
77 {
78 auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
79
80 out.resize(interpolationPoints_.size());
81 for (size_t i = 0; i < out.size(); ++i)
82 {
83 out[i] = f(interpolationPoints_[i]);
84 }
85 }
86
87 private:
88 std::vector<DT> interpolationPoints_;
89 };
90
91 template<class D, class R>
93 {
95 typedef typename LB::Traits::DomainType DT;
96
97 public:
99 interpolationPoints_(8)
100 {
101 // Interpolation is done by evaluating at the subtriangle centers
102 interpolationPoints_[0][0] = 1.0/8;
103 interpolationPoints_[0][1] = 1.0/8;
104 interpolationPoints_[0][2] = 1.0/8;
105
106 interpolationPoints_[1][0] = 5.0/8;
107 interpolationPoints_[1][1] = 1.0/8;
108 interpolationPoints_[1][2] = 1.0/8;
109
110 interpolationPoints_[2][0] = 1.0/8;
111 interpolationPoints_[2][1] = 5.0/8;
112 interpolationPoints_[2][2] = 1.0/8;
113
114 interpolationPoints_[3][0] = 1.0/8;
115 interpolationPoints_[3][1] = 1.0/8;
116 interpolationPoints_[3][2] = 5.0/8;
117
118 interpolationPoints_[4][0] = 1.0/4;
119 interpolationPoints_[4][1] = 1.0/8;
120 interpolationPoints_[4][2] = 1.0/4;
121
122 interpolationPoints_[5][0] = 3.0/8;
123 interpolationPoints_[5][1] = 1.0/4;
124 interpolationPoints_[5][2] = 1.0/8;
125
126 interpolationPoints_[6][0] = 1.0/8;
127 interpolationPoints_[6][1] = 1.0/4;
128 interpolationPoints_[6][2] = 3.0/8;
129
130 interpolationPoints_[7][0] = 1.0/4;
131 interpolationPoints_[7][1] = 3.0/8;
132 interpolationPoints_[7][2] = 1.0/4;
133 }
134
135
136 template<typename F, typename C>
137 void interpolate (const F& ff, std::vector<C>& out) const
138 {
139 auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
140
141 out.resize(interpolationPoints_.size());
142 for (size_t i = 0; i < out.size(); ++i)
143 {
144 out[i] = f(interpolationPoints_[i]);
145 }
146 }
147
148 private:
149 std::vector<DT> interpolationPoints_;
150 };
151}
152
153#endif
Definition: bdfmcube.hh:18
Uniformly refined constant shape functions on a unit simplex in R^dim.
Definition: refinedp0localbasis.hh:40
Definition: refinedp0localinterpolation.hh:15
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:24
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:35
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:57
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:76
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:137
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:98