IgANet
IGAnets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
collocation.hpp
Go to the documentation of this file.
1
15#pragma once
16
17namespace iganet {
18
19// clang-format off
31// clang-format on
32
35template<typename> class CollPtsHelper;
36
37template <detail::HasAsTensor CollPts>
38class CollPtsHelper<CollPts> {
39
40public:
42 using type = std::pair<typename CollPts::eval_type,
43 typename CollPts::boundary_eval_type>;
44
45private:
52 template <typename FunctionSpace, std::size_t... Is>
53 static auto collPts(enum collPts collPts, const FunctionSpace& space, std::index_sequence<Is...>) {
54
55 type collPts_;
56
57 switch (collPts) {
58
60 // Get Greville abscissae inside the domain and at the boundary
61 ((std::get<Is>(collPts_.first) =
62 space.template space<Is>().greville(
63 /* interior */ false)),
64 ...);
65
66 // Get Greville abscissae at the domain
67 ((std::get<Is>(collPts_.second) =
68 space.template boundary<Is>().greville()),
69 ...);
70 break;
71
73 // Get Greville abscissae inside the domain
74 ((std::get<Is>(collPts_.first) =
75 space.template space<Is>().greville(
76 /* interior */ true)),
77 ...);
78
79 // Get Greville abscissae at the domain
80 ((std::get<Is>(collPts_.second) =
81 space.template boundary<Is>().greville()),
82 ...);
83 break;
84
86 // Get Greville abscissae inside the domain and at the boundary
87 ((std::get<Is>(collPts_.first) = space
88 .template space<Is>()
89 .clone()
90 .uniform_refine()
91 .greville(
92 /* interior */ false)),
93 ...);
94
95 // Get Greville abscissae at the domain
96 ((std::get<Is>(collPts_.second) = space
97 .template boundary<Is>()
98 .clone()
99 .uniform_refine()
100 .greville()),
101 ...);
102 break;
103
105 // Get Greville abscissae inside the domain
106 ((std::get<Is>(collPts_.first) = space
107 .template space<Is>()
108 .clone()
109 .uniform_refine()
110 .greville(
111 /* interior */ true)),
112 ...);
113
114 // Get Greville abscissae at the domain
115 ((std::get<Is>(collPts_.second) = space
116 .template boundary<Is>()
117 .clone()
118 .uniform_refine()
119 .greville()),
120 ...);
121 break;
122
124 // Get Greville abscissae inside the domain and at the boundary
125 ((std::get<Is>(collPts_.first) = space
126 .template space<Is>()
127 .clone()
128 .uniform_refine(2, -1)
129 .greville(
130 /* interior */ false)),
131 ...);
132
133 // Get Greville abscissae at the domain
134 ((std::get<Is>(collPts_.second) = space
135 .template boundary<Is>()
136 .clone()
137 .uniform_refine(2, -1)
138 .greville()),
139 ...);
140 break;
141
143 // Get Greville abscissae inside the domain
144 ((std::get<Is>(collPts_.first) = space
145 .template space<Is>()
146 .clone()
147 .uniform_refine(2, -1)
148 .greville(
149 /* interior */ true)),
150 ...);
151
152 // Get Greville abscissae at the domain
153 ((std::get<Is>(collPts_.second) = space
154 .template boundary<Is>()
155 .clone()
156 .uniform_refine(2, -1)
157 .greville()),
158 ...);
159 break;
160
162 // Get Greville abscissae inside the domain and at the boundary
163 ((std::get<Is>(collPts_.first) = space
164 .template space<Is>()
165 .clone()
166 .uniform_refine(3, -1)
167 .greville(
168 /* interior */ false)),
169 ...);
170
171 // Get Greville abscissae at the domain
172 ((std::get<Is>(collPts_.second) = space
173 .template boundary<Is>()
174 .clone()
175 .uniform_refine(3, -1)
176 .greville()),
177 ...);
178 break;
179
181 // Get Greville abscissae inside the domain
182 ((std::get<Is>(collPts_.first) = space
183 .template space<Is>()
184 .clone()
185 .uniform_refine(3, -1)
186 .greville(
187 /* interior */ true)),
188 ...);
189
190 // Get Greville abscissae at the domain
191 ((std::get<Is>(collPts_.second) = space
192 .template boundary<Is>()
193 .clone()
194 .uniform_refine(3, -1)
195 .greville()),
196 ...);
197 break;
198
199 default:
200 throw std::runtime_error("Invalid collocation point specifier");
201 }
202
203 return collPts_;
204 }
205
206public:
213 template<typename FunctionSpace>
214 static auto collPts(enum collPts collPts, const FunctionSpace& space) {
215 if constexpr (FunctionSpace::nspaces() == 1)
216
217 switch (collPts) {
218
220 return type{
221 space.space().greville(/* interior */ false),
222 space.boundary().greville()};
223
225 return type{space.space().greville(/* interior */ true),
226 space.boundary().greville()};
227
229 return type{
230 space.space().clone().uniform_refine().greville(
231 /* interior */ false),
232 space
233 .boundary()
234 .clone()
235 .uniform_refine()
236 .greville()};
237
239 return type{
240 space.space().clone().uniform_refine().greville(
241 /* interior */ true),
242 space
243 .boundary()
244 .clone()
245 .uniform_refine()
246 .greville()};
247
249 return type{space
250 .space()
251 .clone()
252 .uniform_refine(2, -1)
253 .greville(
254 /* interior */ false),
255 space
256 .boundary()
257 .clone()
258 .uniform_refine(2, -1)
259 .greville()};
260
262 return type{space
263 .space()
264 .clone()
265 .uniform_refine(2, -1)
266 .greville(
267 /* interior */ true),
268 space
269 .boundary()
270 .clone()
271 .uniform_refine(2, -1)
272 .greville()};
273
275 return type{space
276 .space()
277 .clone()
278 .uniform_refine(3, -1)
279 .greville(
280 /* interior */ false),
281 space
282 .boundary()
283 .clone()
284 .uniform_refine(3, -1)
285 .greville()};
286
288 return type{space
289 .space()
290 .clone()
291 .uniform_refine(3, -1)
292 .greville(
293 /* interior */ true),
294 space
295 .boundary()
296 .clone()
297 .uniform_refine(3, -1)
298 .greville()};
299
300 default:
301 throw std::runtime_error("Invalid collocation point specifier");
302 }
303
304 else
305 return collPts(collPts, space, std::make_index_sequence<type::nspaces()>{});
306 }
307};
309
310} // namespace iganet
std::pair< typename CollPts::eval_type, typename CollPts::boundary_eval_type > type
Type of the collocation points.
Definition collocation.hpp:43
static auto collPts(enum collPts collPts, const FunctionSpace &space)
Returns the collocation points of the index-th function spaces.
Definition collocation.hpp:214
static auto collPts(enum collPts collPts, const FunctionSpace &space, std::index_sequence< Is... >)
Returns the collocation points of the index-th function space.
Definition collocation.hpp:53
Definition core.hpp:72
collPts
Enumerator for the collocation point specifier.
Definition collocation.hpp:21
detail::FunctionSpace_trait< Args... >::type FunctionSpace
Function space alias.
Definition functionspace.hpp:3259
short int short_t
Definition core.hpp:74
Collocation points helper
Definition collocation.hpp:35