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