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:
217 template<typename FunctionSpace>
218 static auto collPts(enum collPts collPts, const FunctionSpace& space) {
219 if constexpr (FunctionSpace::nspaces() == 1)
220
221 switch (collPts) {
222
224 return type{
225 space.space().greville(/* interior */ false),
226 space.boundary().greville()};
227
229 return type{space.space().greville(/* interior */ true),
230 space.boundary().greville()};
231
233 return type{
234 space.space().clone().uniform_refine().greville(
235 /* interior */ false),
236 space
237 .boundary()
238 .clone()
239 .uniform_refine()
240 .greville()};
241
243 return type{
244 space.space().clone().uniform_refine().greville(
245 /* interior */ true),
246 space
247 .boundary()
248 .clone()
249 .uniform_refine()
250 .greville()};
251
253 return type{space
254 .space()
255 .clone()
256 .uniform_refine(2, -1)
257 .greville(
258 /* interior */ false),
259 space
260 .boundary()
261 .clone()
262 .uniform_refine(2, -1)
263 .greville()};
264
266 return type{space
267 .space()
268 .clone()
269 .uniform_refine(2, -1)
270 .greville(
271 /* interior */ true),
272 space
273 .boundary()
274 .clone()
275 .uniform_refine(2, -1)
276 .greville()};
277
279 return type{space
280 .space()
281 .clone()
282 .uniform_refine(3, -1)
283 .greville(
284 /* interior */ false),
285 space
286 .boundary()
287 .clone()
288 .uniform_refine(3, -1)
289 .greville()};
290
292 return type{space
293 .space()
294 .clone()
295 .uniform_refine(3, -1)
296 .greville(
297 /* interior */ true),
298 space
299 .boundary()
300 .clone()
301 .uniform_refine(3, -1)
302 .greville()};
303
304 default:
305 throw std::runtime_error("Invalid collocation point specifier");
306 }
307
308 else
309 return collPts(collPts, space, std::make_index_sequence<type::nspaces()>{});
310 }
311};
313
314} // 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:218
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:73
collPts
Enumerator for the collocation point specifier.
Definition collocation.hpp:21
detail::FunctionSpace_trait< Args... >::type FunctionSpace
Function space alias.
Definition functionspace.hpp:3650
short int short_t
Signed short integer type used by IgANet's compact enumerations.
Definition core.hpp:76
Collocation points helper
Definition collocation.hpp:35