DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
Prism6.hpp
Go to the documentation of this file.
1#pragma once
2// Auto-generated by tools/gen_shape_functions -- DO NOT EDIT
3// Element: Prism6
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> struct ShapeFuncImpl;
16
17 // <GEN_SHAPE_FUNCS_BEGIN>
18 template <>
20 {
21 template <class TPoint, class TArray>
22 DNDS_DEVICE_CALLABLE static inline void Diff0(const TPoint &p, TArray &&v)
23 {
24 t_real xi = p[0];
25 t_real et = p[1];
26 t_real zt = p[2];
27 const t_real _t0 = zt - 1;
28 const t_real _t1 = ((0.5))*et + ((0.5))*xi + (-0.5);
29 const t_real _t2 = -(0.5)*_t0;
30 const t_real _t3 = zt + 1;
31 const t_real _t4 = ((0.5))*_t3;
32 v(0, 0) = _t0*_t1;
33 v(0, 1) = _t2*xi;
34 v(0, 2) = _t2*et;
35 v(0, 3) = -_t1*_t3;
36 v(0, 4) = _t4*xi;
37 v(0, 5) = _t4*et;
38 }
39
40 template <class TPoint, class TArray>
41 DNDS_DEVICE_CALLABLE static inline void Diff1(const TPoint &p, TArray &&v)
42 {
43 t_real xi = p[0];
44 t_real et = p[1];
45 t_real zt = p[2];
46 const t_real _t0 = ((0.5))*zt;
47 const t_real _t1 = _t0 + (-0.5);
48 const t_real _t2 = -_t1;
49 const t_real _t3 = _t0 + (0.5);
50 const t_real _t4 = -_t3;
51 const t_real _t5 = ((0.5))*et;
52 const t_real _t6 = ((0.5))*xi;
53 const t_real _t7 = _t5 + _t6 + (-0.5);
54 v(0, 0) = _t1;
55 v(0, 1) = _t2;
56 v(0, 3) = _t4;
57 v(0, 4) = _t3;
58 v(1, 0) = _t1;
59 v(1, 2) = _t2;
60 v(1, 3) = _t4;
61 v(1, 5) = _t3;
62 v(2, 0) = _t7;
63 v(2, 1) = -_t6;
64 v(2, 2) = -_t5;
65 v(2, 3) = -_t7;
66 v(2, 4) = _t6;
67 v(2, 5) = _t5;
68 }
69
70 template <class TPoint, class TArray>
71 DNDS_DEVICE_CALLABLE static inline void Diff2(const TPoint &p, TArray &&v)
72 {
73 t_real xi = p[0];
74 t_real et = p[1];
75 t_real zt = p[2];
76 v(4, 0) = (0.5);
77 v(4, 2) = (-0.5);
78 v(4, 3) = (-0.5);
79 v(4, 5) = (0.5);
80 v(5, 0) = (0.5);
81 v(5, 1) = (-0.5);
82 v(5, 3) = (-0.5);
83 v(5, 4) = (0.5);
84 }
85
86 template <class TPoint, class TArray>
87 DNDS_DEVICE_CALLABLE static inline void Diff3(const TPoint &p, TArray &&v)
88 {
89 t_real xi = p[0];
90 t_real et = p[1];
91 t_real zt = p[2];
92 // all zero
93 }
94 };
95 // <GEN_SHAPE_FUNCS_END>
96
97
98 /**
99 * @brief Element traits for 6-node linear prism (Prism6)
100 *
101 * Prism6 is a 3D prismatic element combining triangular and quadrilateral faces.
102 * Commonly used for:
103 * - Boundary layer meshes
104 * - Extruded 2D meshes
105 * - Regions with strong anisotropy
106 *
107 * Geometry:
108 * - Reference prism: triangle base extruded along z-axis from -1 to +1
109 * - 6 nodes at the vertices (3 on bottom, 3 on top)
110 * - Parametric space volume = 1.0
111 *
112 * Faces:
113 * - 2 triangular faces (top and bottom)
114 * - 3 quadrilateral faces (sides)
115 */
116 template <>
118 {
119 // ============================================================
120 // Core Element Identification
121 // ============================================================
122
123 static constexpr ElemType elemType = Prism6;
124 static constexpr int dim = 3;
125 static constexpr int order = 1;
126 static constexpr int numVertices = 6;
127 static constexpr int numNodes = 6;
128 static constexpr int numFaces = 5;
129 static constexpr ParamSpace paramSpace = PrismSpace;
130 static constexpr t_real paramSpaceVol = 1.0;
131
132 // ============================================================
133 // Geometry Definition
134 // ============================================================
135
136 /**
137 * @brief Standard coordinates of nodes in parametric space
138 *
139 * Reference prism: triangular base (xi, eta) with zeta in [-1, 1]
140 * Nodes 0-2: bottom triangle (zeta = -1)
141 * Nodes 3-5: top triangle (zeta = +1)
142 */
143 static constexpr std::array<t_real, 3 * 6> standardCoords = {
144 0, 0, -1, // Node 0: bottom corner
145 1, 0, -1, // Node 1: bottom corner
146 0, 1, -1, // Node 2: bottom corner
147 0, 0, 1, // Node 3: top corner
148 1, 0, 1, // Node 4: top corner
149 0, 1, 1}; // Node 5: top corner
150
151 // ============================================================
152 // Face/Edge Definitions
153 // ============================================================
154
155 /**
156 * @brief Get the element type of a face
157 * @param iFace Face index (0-2 are quads, 3-4 are triangles)
158 * @return Quad4 for side faces, Tri3 for cap faces
159 */
160 static constexpr ElemType GetFaceType(t_index iFace)
161 {
162 return iFace < 3 ? Quad4 : Tri3;
163 }
164
165 /**
166 * @brief Node indices for each face
167 *
168 * Face 0: nodes 0-1-4-3 (side, quadrilateral)
169 * Face 1: nodes 1-2-5-4 (side, quadrilateral)
170 * Face 2: nodes 2-0-3-5 (side, quadrilateral)
171 * Face 3: nodes 0-2-1 (bottom, triangle)
172 * Face 4: nodes 3-4-5 (top, triangle)
173 */
174 static constexpr std::array<std::array<t_index, 10>, 5> faceNodes = {{
175 {0, 1, 4, 3}, // Face 0: side quad
176 {1, 2, 5, 4}, // Face 1: side quad
177 {2, 0, 3, 5}, // Face 2: side quad
178 {0, 2, 1}, // Face 3: bottom triangle
179 {3, 4, 5}}}; // Face 4: top triangle
180
181 // ============================================================
182 // Order Elevation (P-Refinement)
183 // ============================================================
184
185 /**
186 * @brief Element type after order elevation (O1 -> O2)
187 * Prism6 elevates to Prism18 (18-node quadratic prism)
188 */
189 static constexpr ElemType elevatedType = Prism18;
190
191 /// @brief Number of additional nodes created during elevation
192 static constexpr int numElevNodes = 12;
193
194 /**
195 * @brief Elevation spans define new node connections
196 *
197 * Elevation creates 12 new nodes:
198 * Spans 0-2: bottom triangle edge midpoints
199 * Spans 3-5: vertical edge midpoints
200 * Spans 6-8: top triangle edge midpoints
201 * Spans 9-11: side face centers
202 */
203 static constexpr std::array<tElevSpan, 12> elevSpans = {{
204 {0, 1}, {1, 2}, {2, 0}, // Bottom triangle edges
205 {0, 3}, {1, 4}, {2, 5}, // Vertical edges
206 {3, 4}, {4, 5}, {5, 3}, // Top triangle edges
207 {0, 1, 4, 3}, {1, 2, 5, 4}, {2, 0, 3, 5}}}; // Side face centers
208
209 /// @brief Element type of each elevation span
210 static constexpr std::array<ElemType, 12> elevNodeSpanTypes = {
211 Line2, Line2, Line2, // Bottom edges
212 Line2, Line2, Line2, // Vertical edges
213 Line2, Line2, Line2, // Top edges
214 Quad4, Quad4, Quad4}; // Side face centers
215
216 // ============================================================
217 // VTK/Visualization Support
218 // ============================================================
219
220 /// @brief VTK cell type identifier (13 = VTK_WEDGE)
221 static constexpr int vtkCellType = 13;
222
223 /**
224 * @brief VTK node ordering map
225 *
226 * VTK uses the same ordering as DNDS for Prism6:
227 * VTK nodes 0-5 = nodes 0-5
228 */
229 static constexpr std::array<int, 6> vtkNodeOrder = {0, 1, 2, 3, 4, 5};
230 };
231
232} // 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 GetFaceType(t_index iFace)
Get the element type of a face.
Definition Prism6.hpp:160
static DNDS_DEVICE_CALLABLE void Diff1(const TPoint &p, TArray &&v)
Definition Prism6.hpp:41
static DNDS_DEVICE_CALLABLE void Diff2(const TPoint &p, TArray &&v)
Definition Prism6.hpp:71
static DNDS_DEVICE_CALLABLE void Diff3(const TPoint &p, TArray &&v)
Definition Prism6.hpp:87
static DNDS_DEVICE_CALLABLE void Diff0(const TPoint &p, TArray &&v)
Definition Prism6.hpp:22
Eigen::Matrix< real, 5, 1 > v
double order
Definition test_ODE.cpp:257