DNDSR 0.2.1
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
Prism18.hpp
Go to the documentation of this file.
1#pragma once
2// Auto-generated by tools/gen_shape_functions -- DO NOT EDIT
3// Element: Prism18
4// Regenerate: /usr/bin/python3 -m tools.gen_shape_functions.generate
5
6#include "DNDS/Defines.hpp"
7#include "Geom/Geometric.hpp"
8#include "Geom/ElemEnum.hpp"
10
11namespace DNDS::Geom::Elem
12{
13
14 // Forward declaration (primary template is in ElementTraitsBase.hpp)
15 template <ElemType>
16 struct ShapeFuncImpl;
17
18 // <GEN_SHAPE_FUNCS_BEGIN>
19 template <>
21 {
22 template <class TPoint, class TArray>
23 DNDS_DEVICE_CALLABLE static void Diff0(const TPoint &p, TArray &&v)
24 {
25 t_real xi = p[0];
26 t_real et = p[1];
27 t_real zt = p[2];
28 const t_real _t0 = zt - 1;
29 const t_real _t1 = ((0.5)) * zt;
30 const t_real _t2 = _t0 * _t1;
31 const t_real _t3 = et + xi - 1;
32 const t_real _t4 = 2 * et;
33 const t_real _t5 = 2 * xi;
34 const t_real _t6 = _t5 - 1;
35 const t_real _t7 = _t4 + _t6;
36 const t_real _t8 = _t3 * _t7;
37 const t_real _t9 = _t6 * xi;
38 const t_real _t10 = et * (_t4 - 1);
39 const t_real _t11 = zt + 1;
40 const t_real _t12 = _t1 * _t11;
41 const t_real _t13 = _t0 * zt;
42 const t_real _t14 = _t13 * _t3;
43 const t_real _t15 = _t4 * xi;
44 const t_real _t16 = _t11 * zt;
45 const t_real _t17 = _t16 * _t3;
46 const t_real _t18 = ((zt) * (zt)) - 1;
47 const t_real _t19 = _t18 * _t3;
48 const t_real _t20 = 4 * xi;
49 v(0, 0) = _t2 * _t8;
50 v(0, 1) = _t2 * _t9;
51 v(0, 2) = _t10 * _t2;
52 v(0, 3) = _t12 * _t8;
53 v(0, 4) = _t12 * _t9;
54 v(0, 5) = _t10 * _t12;
55 v(0, 6) = -_t14 * _t5;
56 v(0, 7) = _t13 * _t15;
57 v(0, 8) = -_t14 * _t4;
58 v(0, 9) = -_t17 * _t5;
59 v(0, 10) = _t15 * _t16;
60 v(0, 11) = -_t17 * _t4;
61 v(0, 12) = -_t19 * _t7;
62 v(0, 13) = -_t18 * _t9;
63 v(0, 14) = -_t10 * _t18;
64 v(0, 15) = _t19 * _t20;
65 v(0, 16) = -_t18 * _t20 * et;
66 v(0, 17) = 4 * _t19 * et;
67 }
68
69 template <class TPoint, class TArray>
70 DNDS_DEVICE_CALLABLE static void Diff1(const TPoint &p, TArray &&v)
71 {
72 t_real xi = p[0];
73 t_real et = p[1];
74 t_real zt = p[2];
75 const t_real _t0 = 4 * et;
76 const t_real _t1 = 4 * xi;
77 const t_real _t2 = _t0 + _t1 - 3;
78 const t_real _t3 = zt - 1;
79 const t_real _t4 = ((0.5)) * zt;
80 const t_real _t5 = _t3 * _t4;
81 const t_real _t6 = _t2 * _t5;
82 const t_real _t7 = _t1 - 1;
83 const t_real _t8 = zt + 1;
84 const t_real _t9 = _t4 * _t8;
85 const t_real _t10 = _t2 * _t9;
86 const t_real _t11 = 2 * xi;
87 const t_real _t12 = _t11 - 1;
88 const t_real _t13 = _t12 + et;
89 const t_real _t14 = 2 * zt;
90 const t_real _t15 = -_t13 * _t14;
91 const t_real _t16 = 2 * et;
92 const t_real _t17 = _t16 * zt;
93 const t_real _t18 = -_t3;
94 const t_real _t19 = _t17 * _t8;
95 const t_real _t20 = ((zt) * (zt)) - 1;
96 const t_real _t21 = -_t2 * _t20;
97 const t_real _t22 = 4 * _t20;
98 const t_real _t23 = -_t20;
99 const t_real _t24 = _t0 - 1;
100 const t_real _t25 = _t11 * zt;
101 const t_real _t26 = _t16 - 1;
102 const t_real _t27 = _t26 + xi;
103 const t_real _t28 = -_t14 * _t27;
104 const t_real _t29 = _t25 * _t8;
105 const t_real _t30 = _t14 - 1;
106 const t_real _t31 = ((0.5)) * _t30;
107 const t_real _t32 = et + xi - 1;
108 const t_real _t33 = _t32 * (_t12 + _t16);
109 const t_real _t34 = _t12 * xi;
110 const t_real _t35 = _t26 * et;
111 const t_real _t36 = _t14 + 1;
112 const t_real _t37 = ((0.5)) * _t36;
113 const t_real _t38 = -_t30 * _t32;
114 const t_real _t39 = _t11 * et;
115 const t_real _t40 = -_t32 * _t36;
116 const t_real _t41 = 8 * xi * zt;
117 v(0, 0) = _t6;
118 v(0, 1) = _t5 * _t7;
119 v(0, 3) = _t10;
120 v(0, 4) = _t7 * _t9;
121 v(0, 6) = _t15 * _t3;
122 v(0, 7) = _t17 * _t3;
123 v(0, 8) = _t17 * _t18;
124 v(0, 9) = _t15 * _t8;
125 v(0, 10) = _t19;
126 v(0, 11) = -_t19;
127 v(0, 12) = _t21;
128 v(0, 13) = -_t20 * _t7;
129 v(0, 15) = _t13 * _t22;
130 v(0, 16) = _t0 * _t23;
131 v(0, 17) = _t0 * _t20;
132 v(1, 0) = _t6;
133 v(1, 2) = _t24 * _t5;
134 v(1, 3) = _t10;
135 v(1, 5) = _t24 * _t9;
136 v(1, 6) = _t18 * _t25;
137 v(1, 7) = _t25 * _t3;
138 v(1, 8) = _t28 * _t3;
139 v(1, 9) = -_t29;
140 v(1, 10) = _t29;
141 v(1, 11) = _t28 * _t8;
142 v(1, 12) = _t21;
143 v(1, 14) = -_t20 * _t24;
144 v(1, 15) = _t1 * _t20;
145 v(1, 16) = _t1 * _t23;
146 v(1, 17) = _t22 * _t27;
147 v(2, 0) = _t31 * _t33;
148 v(2, 1) = _t31 * _t34;
149 v(2, 2) = _t31 * _t35;
150 v(2, 3) = _t33 * _t37;
151 v(2, 4) = _t34 * _t37;
152 v(2, 5) = _t35 * _t37;
153 v(2, 6) = _t11 * _t38;
154 v(2, 7) = _t30 * _t39;
155 v(2, 8) = _t16 * _t38;
156 v(2, 9) = _t11 * _t40;
157 v(2, 10) = _t36 * _t39;
158 v(2, 11) = _t16 * _t40;
159 v(2, 12) = -_t14 * _t33;
160 v(2, 13) = -_t12 * _t25;
161 v(2, 14) = -_t17 * _t26;
162 v(2, 15) = _t32 * _t41;
163 v(2, 16) = -_t41 * et;
164 v(2, 17) = 8 * _t32 * et * zt;
165 }
166
167 template <class TPoint, class TArray>
168 DNDS_DEVICE_CALLABLE static void Diff2(const TPoint &p, TArray &&v)
169 {
170 t_real xi = p[0];
171 t_real et = p[1];
172 t_real zt = p[2];
173 const t_real _t0 = zt - 1;
174 const t_real _t1 = 2 * zt;
175 const t_real _t2 = _t0 * _t1;
176 const t_real _t3 = zt + 1;
177 const t_real _t4 = _t1 * _t3;
178 const t_real _t5 = -_t0;
179 const t_real _t6 = 4 * zt;
180 const t_real _t7 = _t5 * _t6;
181 const t_real _t8 = -_t3 * _t6;
182 const t_real _t9 = ((zt) * (zt));
183 const t_real _t10 = 4 * _t9 - 4;
184 const t_real _t11 = -_t10;
185 const t_real _t12 = 8 * _t9 - 8;
186 const t_real _t13 = et + xi - 1;
187 const t_real _t14 = 2 * et;
188 const t_real _t15 = 2 * xi;
189 const t_real _t16 = _t15 - 1;
190 const t_real _t17 = _t13 * (_t14 + _t16);
191 const t_real _t18 = _t16 * xi;
192 const t_real _t19 = _t14 - 1;
193 const t_real _t20 = _t19 * et;
194 const t_real _t21 = -_t13;
195 const t_real _t22 = 4 * xi;
196 const t_real _t23 = _t21 * _t22;
197 const t_real _t24 = 4 * et;
198 const t_real _t25 = _t24 * xi;
199 const t_real _t26 = _t21 * _t24;
200 const t_real _t27 = 8 * xi;
201 const t_real _t28 = 8 * et;
202 const t_real _t29 = _t1 * _t5;
203 const t_real _t30 = -_t4;
204 const t_real _t31 = -3 * zt;
205 const t_real _t32 = -_t15;
206 const t_real _t33 = _t6 * xi;
207 const t_real _t34 = _t32 + _t33;
208 const t_real _t35 = -_t14;
209 const t_real _t36 = _t24 * zt;
210 const t_real _t37 = _t35 + _t36;
211 const t_real _t38 = _t31 + _t34 + _t37 + (1.5);
212 const t_real _t39 = -zt;
213 const t_real _t40 = _t36 + _t39;
214 const t_real _t41 = _t15 + _t33;
215 const t_real _t42 = _t14 + _t36;
216 const t_real _t43 = _t31 + _t41 + _t42 + (-1.5);
217 const t_real _t44 = _t1 - 1;
218 const t_real _t45 = -_t44;
219 const t_real _t46 = -4 * zt;
220 const t_real _t47 = _t28 * zt;
221 const t_real _t48 = _t46 + _t47;
222 const t_real _t49 = _t1 + 1;
223 const t_real _t50 = -_t49;
224 const t_real _t51 = _t1 * (-_t22 - _t24 + 3);
225 const t_real _t52 = _t27 * zt;
226 const t_real _t53 = 8 * zt;
227 const t_real _t54 = _t33 + _t39;
228 const t_real _t55 = _t46 + _t52;
229 v(0, 0) = _t2;
230 v(0, 1) = _t2;
231 v(0, 3) = _t4;
232 v(0, 4) = _t4;
233 v(0, 6) = _t7;
234 v(0, 9) = _t8;
235 v(0, 12) = _t11;
236 v(0, 13) = _t11;
237 v(0, 15) = _t12;
238 v(1, 0) = _t2;
239 v(1, 2) = _t2;
240 v(1, 3) = _t4;
241 v(1, 5) = _t4;
242 v(1, 8) = _t7;
243 v(1, 11) = _t8;
244 v(1, 12) = _t11;
245 v(1, 14) = _t11;
246 v(1, 17) = _t12;
247 v(2, 0) = _t17;
248 v(2, 1) = _t18;
249 v(2, 2) = _t20;
250 v(2, 3) = _t17;
251 v(2, 4) = _t18;
252 v(2, 5) = _t20;
253 v(2, 6) = _t23;
254 v(2, 7) = _t25;
255 v(2, 8) = _t26;
256 v(2, 9) = _t23;
257 v(2, 10) = _t25;
258 v(2, 11) = _t26;
259 v(2, 12) = -2 * _t17;
260 v(2, 13) = -_t15 * _t16;
261 v(2, 14) = -_t14 * _t19;
262 v(2, 15) = _t13 * _t27;
263 v(2, 16) = -_t27 * et;
264 v(2, 17) = _t13 * _t28;
265 v(3, 0) = _t2;
266 v(3, 3) = _t4;
267 v(3, 6) = _t29;
268 v(3, 7) = _t2;
269 v(3, 8) = _t29;
270 v(3, 9) = _t30;
271 v(3, 10) = _t4;
272 v(3, 11) = _t30;
273 v(3, 12) = _t11;
274 v(3, 15) = _t10;
275 v(3, 16) = _t11;
276 v(3, 17) = _t10;
277 v(4, 0) = _t38;
278 v(4, 2) = _t35 + _t40 + (0.5);
279 v(4, 3) = _t43;
280 v(4, 5) = _t14 + _t40 + (-0.5);
281 v(4, 6) = _t15 * _t45;
282 v(4, 7) = _t15 * _t44;
283 v(4, 8) = _t24 - _t34 - _t48 - 2;
284 v(4, 9) = _t15 * _t50;
285 v(4, 10) = _t15 * _t49;
286 v(4, 11) = -_t24 - _t41 - _t48 + 2;
287 v(4, 12) = _t51;
288 v(4, 14) = _t1 * (1 - _t24);
289 v(4, 15) = _t52;
290 v(4, 16) = -_t52;
291 v(4, 17) = _t53 * (_t19 + xi);
292 v(5, 0) = _t38;
293 v(5, 1) = _t32 + _t54 + (0.5);
294 v(5, 3) = _t43;
295 v(5, 4) = _t15 + _t54 + (-0.5);
296 v(5, 6) = _t22 - _t37 - _t55 - 2;
297 v(5, 7) = _t14 * _t44;
298 v(5, 8) = _t14 * _t45;
299 v(5, 9) = -_t22 - _t42 - _t55 + 2;
300 v(5, 10) = _t14 * _t49;
301 v(5, 11) = _t14 * _t50;
302 v(5, 12) = _t51;
303 v(5, 13) = _t1 * (1 - _t22);
304 v(5, 15) = _t53 * (_t16 + et);
305 v(5, 16) = -_t47;
306 v(5, 17) = _t47;
307 }
308
309 template <class TPoint, class TArray>
310 DNDS_DEVICE_CALLABLE static void Diff3(const TPoint &p, TArray &&v)
311 {
312 t_real xi = p[0];
313 t_real et = p[1];
314 t_real zt = p[2];
315 const t_real _t0 = 4 * zt;
316 const t_real _t1 = _t0 - 2;
317 const t_real _t2 = _t0 + 2;
318 const t_real _t3 = 8 * zt;
319 const t_real _t4 = 4 - _t3;
320 const t_real _t5 = -_t3 - 4;
321 const t_real _t6 = -_t3;
322 const t_real _t7 = 16 * zt;
323 const t_real _t8 = 4 * et;
324 const t_real _t9 = 4 * xi;
325 const t_real _t10 = _t8 + _t9 - 3;
326 const t_real _t11 = _t8 - 1;
327 const t_real _t12 = -_t9;
328 const t_real _t13 = 8 * et;
329 const t_real _t14 = -_t13 - _t9 + 4;
330 const t_real _t15 = 8 * xi;
331 const t_real _t16 = -_t13 - _t15 + 6;
332 const t_real _t17 = _t9 - 1;
333 const t_real _t18 = -_t15 - _t8 + 4;
334 const t_real _t19 = -_t8;
335 const t_real _t20 = -_t1;
336 const t_real _t21 = -_t2;
337 v(5, 0) = _t1;
338 v(5, 2) = _t1;
339 v(5, 3) = _t2;
340 v(5, 5) = _t2;
341 v(5, 8) = _t4;
342 v(5, 11) = _t5;
343 v(5, 12) = _t6;
344 v(5, 14) = _t6;
345 v(5, 17) = _t7;
346 v(6, 0) = _t10;
347 v(6, 2) = _t11;
348 v(6, 3) = _t10;
349 v(6, 5) = _t11;
350 v(6, 6) = _t12;
351 v(6, 7) = _t9;
352 v(6, 8) = _t14;
353 v(6, 9) = _t12;
354 v(6, 10) = _t9;
355 v(6, 11) = _t14;
356 v(6, 12) = _t16;
357 v(6, 14) = 2 - _t13;
358 v(6, 15) = _t15;
359 v(6, 16) = -_t15;
360 v(6, 17) = _t15 + 16 * et - 8;
361 v(7, 0) = _t10;
362 v(7, 1) = _t17;
363 v(7, 3) = _t10;
364 v(7, 4) = _t17;
365 v(7, 6) = _t18;
366 v(7, 7) = _t8;
367 v(7, 8) = _t19;
368 v(7, 9) = _t18;
369 v(7, 10) = _t8;
370 v(7, 11) = _t19;
371 v(7, 12) = _t16;
372 v(7, 13) = 2 - _t15;
373 v(7, 15) = _t13 + 16 * xi - 8;
374 v(7, 16) = -_t13;
375 v(7, 17) = _t13;
376 v(8, 0) = _t1;
377 v(8, 1) = _t1;
378 v(8, 3) = _t2;
379 v(8, 4) = _t2;
380 v(8, 6) = _t4;
381 v(8, 9) = _t5;
382 v(8, 12) = _t6;
383 v(8, 13) = _t6;
384 v(8, 15) = _t7;
385 v(9, 0) = _t1;
386 v(9, 3) = _t2;
387 v(9, 6) = _t20;
388 v(9, 7) = _t1;
389 v(9, 8) = _t20;
390 v(9, 9) = _t21;
391 v(9, 10) = _t2;
392 v(9, 11) = _t21;
393 v(9, 12) = _t6;
394 v(9, 15) = _t3;
395 v(9, 16) = _t6;
396 v(9, 17) = _t3;
397 }
398 };
399 // <GEN_SHAPE_FUNCS_END>
400
401 // <GEN_ELEM_TRAITS_BEGIN>
402
403 template <>
405 {
406 static constexpr ElemType elemType = Prism18;
407 static constexpr int dim = 3;
408 static constexpr int order = 2;
409 static constexpr int numVertices = 6;
410 static constexpr int numNodes = 18;
411 static constexpr int numFaces = 5;
412 static constexpr int numEdges = 9;
413 static constexpr ParamSpace paramSpace = PrismSpace;
414 static constexpr t_real paramSpaceVol = 1.0;
415 // 3 * NNodes is a compile-time constant; no overflow possible.
416 // NOLINTNEXTLINE(bugprone-implicit-widening-of-multiplication-result)
417 static constexpr std::array<t_real, 3 * 18> standardCoords = {
418 0, 0, -1, // Node 0: vertex
419 1, 0, -1, // Node 1: vertex
420 0, 1, -1, // Node 2: vertex
421 0, 0, 1, // Node 3: vertex
422 1, 0, 1, // Node 4: vertex
423 0, 1, 1, // Node 5: vertex
424 0.5, 0, -1, // Node 6
425 0.5, 0.5, -1, // Node 7
426 0, 0.5, -1, // Node 8
427 0.5, 0, 1, // Node 9
428 0.5, 0.5, 1, // Node 10
429 0, 0.5, 1, // Node 11
430 0, 0, 0, // Node 12
431 1, 0, 0, // Node 13
432 0, 1, 0, // Node 14
433 0.5, 0, 0, // Node 15
434 0.5, 0.5, 0, // Node 16
435 0, 0.5, 0}; // Node 17
436
437 static constexpr ElemType GetFaceType(t_index iFace)
438 {
439 if (iFace < 3)
440 return Quad9;
441 return Tri6;
442 }
443
444 static constexpr std::array<std::array<t_index, 10>, 5> faceNodes = {{{0, 1, 4, 3, 6, 13, 9, 12, 15},
445 {1, 2, 5, 4, 7, 14, 10, 13, 16},
446 {2, 0, 3, 5, 8, 12, 11, 14, 17},
447 {0, 2, 1, 8, 7, 6},
448 {3, 4, 5, 9, 10, 11}}};
449
450 static constexpr ElemType GetEdgeType(t_index /*iEdge*/) { return Line3; }
451
452 static constexpr std::array<std::array<t_index, 3>, 9> edgeNodes = {{{0, 1, 6},
453 {1, 2, 7},
454 {2, 0, 8},
455 {0, 3, 12},
456 {1, 4, 13},
457 {2, 5, 14},
458 {3, 4, 9},
459 {4, 5, 10},
460 {5, 3, 11}}};
461
462 static constexpr ElemType elevatedType = UnknownElem;
463 static constexpr int numElevNodes = 0;
464
465 static constexpr int numBisect = 8;
466 static constexpr int numBisectVariants = 1;
467
468 static constexpr ElemType GetBisectElemType(t_index /*i*/) { return Prism6; }
469
470 static constexpr std::array<tBisectSub, 8> bisectElements = {{{0, 6, 8, 12, 15, 17},
471 {6, 1, 7, 15, 13, 16},
472 {8, 6, 7, 17, 15, 16},
473 {8, 7, 2, 17, 16, 14},
474 {12, 15, 17, 3, 9, 11},
475 {15, 13, 16, 9, 4, 10},
476 {17, 15, 16, 11, 9, 10},
477 {17, 16, 14, 11, 10, 5}}};
478
479 static constexpr int vtkCellType = 26;
480
481 static constexpr std::array<int, 15> vtkNodeOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
482 };
483 // <GEN_ELEM_TRAITS_END>
484
485} // namespace DNDS::Geom::Elem
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_CALLABLE
Definition Defines.hpp:76
int32_t t_index
Definition Geometric.hpp:6
double t_real
Definition Geometric.hpp:8
static constexpr ElemType GetEdgeType(t_index)
Definition Prism18.hpp:450
static constexpr ElemType GetFaceType(t_index iFace)
Definition Prism18.hpp:437
static constexpr ElemType GetBisectElemType(t_index)
Definition Prism18.hpp:468
static DNDS_DEVICE_CALLABLE void Diff2(const TPoint &p, TArray &&v)
Definition Prism18.hpp:168
static DNDS_DEVICE_CALLABLE void Diff1(const TPoint &p, TArray &&v)
Definition Prism18.hpp:70
static DNDS_DEVICE_CALLABLE void Diff0(const TPoint &p, TArray &&v)
Definition Prism18.hpp:23
static DNDS_DEVICE_CALLABLE void Diff3(const TPoint &p, TArray &&v)
Definition Prism18.hpp:310
Eigen::Matrix< real, 5, 1 > v
double order
Definition test_ODE.cpp:257
const tPoint const tPoint const tPoint & p