Documentation 6b54b78464
Loading...
Searching...
No Matches
CCGNSElementType.hpp
Go to the documentation of this file.
1/*!
2 * \file CCGNSElementType.hpp
3 * \brief Header file for the class CCGNSElementType.
4 * The implementations are in the <i>CCGNSElementType.cpp</i> file.
5 * \author E. van der Weide
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include <vector>
32
33#ifdef HAVE_CGNS
34#include "cgnslib.h"
35#endif
36
37#ifdef HAVE_CGNS
38
39using namespace std;
40
41/*!
42 * \class CCGNSElementType
43 * \brief Class used to convert the CGNS format to SU2 format for high order elements.
44 * \author: E. van der Weide
45 */
46class CCGNSElementType {
47 private:
48 vector<ElementType_t> CGNSTypeStored; /*!< \brief CGNS element types for which the data is stored. */
49 vector<unsigned short> VTKTypeStored; /*!< \brief VTK type of the element. */
50 vector<unsigned short> nPolyStored; /*!< \brief Polynomial degree of the element. */
51 vector<unsigned short> nDOFsStored; /*!< \brief Number of DOFs of the element. */
52 vector<vector<unsigned short> > SU2ToCGNSStored; /*!< \brief Double vector, which stores the conversion
53 from SU2 to CGNS for the type in local numbering. */
54 public:
55 /*--- Standard constructor, nothing to be done. ---*/
56 CCGNSElementType() = default;
57
58 /*--- Destructor, nothing to be done. ---*/
59 ~CCGNSElementType() = default;
60
61 /*!
62 * \brief Converts the connectivity information from CGNS to SU2 format.
63 * \param[in] val_elemType - CGNS elements type to be converted.
64 * \param[in] val_globalID - Global ID of this element.
65 * \param[in] connCGNS - Array with the connectivity of the element in CGNS format.
66 * \param[out] connSU2 - Vector with the connectivity and meta data in SU2 format.
67 */
68 void CGNSToSU2(const ElementType_t val_elemType, const unsigned long val_globalID, const cgsize_t* connCGNS,
69 std::vector<unsigned long>& connSU2);
70
71 private:
72 /*!
73 * \brief Converts the connectivity from CGNS to SU2 for a node.
74 * \param[out] VTK_Type - Corresponding VTK type
75 * \param[out] nPoly - Polynomial degree
76 * \param[out] nDOFs - Number of DOFs of the element.
77 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
78 */
79 void CreateDataNODE(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
80 vector<unsigned short>& SU2ToCGNS);
81
82 /*!
83 * \brief Converts the connectivity from CGNS to SU2 for a Bar2 element.
84 * \param[out] VTK_Type - Corresponding VTK type
85 * \param[out] nPoly - Polynomial degree
86 * \param[out] nDOFs - Number of DOFs of the element.
87 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
88 */
89 void CreateDataBAR_2(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
90 vector<unsigned short>& SU2ToCGNS);
91
92 /*!
93 * \brief Converts the connectivity from CGNS to SU2 for a Bar3 element.
94 * \param[out] VTK_Type - Corresponding VTK type
95 * \param[out] nPoly - Polynomial degree
96 * \param[out] nDOFs - Number of DOFs of the element.
97 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
98 */
99 void CreateDataBAR_3(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
100 vector<unsigned short>& SU2ToCGNS);
101
102 /*!
103 * \brief Converts the connectivity from CGNS to SU2 for a Bar4 element.
104 * \param[out] VTK_Type - Corresponding VTK type
105 * \param[out] nPoly - Polynomial degree
106 * \param[out] nDOFs - Number of DOFs of the element.
107 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
108 */
109 void CreateDataBAR_4(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
110 vector<unsigned short>& SU2ToCGNS);
111
112 /*!
113 * \brief Converts the connectivity from CGNS to SU2 for a Bar5 element.
114 * \param[out] VTK_Type - Corresponding VTK type
115 * \param[out] nPoly - Polynomial degree
116 * \param[out] nDOFs - Number of DOFs of the element.
117 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
118 */
119 void CreateDataBAR_5(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
120 vector<unsigned short>& SU2ToCGNS);
121
122 /*!
123 * \brief Converts the connectivity from CGNS to SU2 for a Tri3 element.
124 * \param[out] VTK_Type - Corresponding VTK type
125 * \param[out] nPoly - Polynomial degree
126 * \param[out] nDOFs - Number of DOFs of the element.
127 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
128 */
129 void CreateDataTRI_3(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
130 vector<unsigned short>& SU2ToCGNS);
131
132 /*!
133 * \brief Converts the connectivity from CGNS to SU2 for a Tri6 element.
134 * \param[out] VTK_Type - Corresponding VTK type
135 * \param[out] nPoly - Polynomial degree
136 * \param[out] nDOFs - Number of DOFs of the element.
137 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
138 */
139 void CreateDataTRI_6(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
140 vector<unsigned short>& SU2ToCGNS);
141
142 /*!
143 * \brief Converts the connectivity from CGNS to SU2 for a Tri10 element.
144 * \param[out] VTK_Type - Corresponding VTK type
145 * \param[out] nPoly - Polynomial degree
146 * \param[out] nDOFs - Number of DOFs of the element.
147 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
148 */
149 void CreateDataTRI_10(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
150 vector<unsigned short>& SU2ToCGNS);
151
152 /*!
153 * \brief Converts the connectivity from CGNS to SU2 for a Tri15 element.
154 * \param[out] VTK_Type - Corresponding VTK type
155 * \param[out] nPoly - Polynomial degree
156 * \param[out] nDOFs - Number of DOFs of the element.
157 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
158 */
159 void CreateDataTRI_15(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
160 vector<unsigned short>& SU2ToCGNS);
161
162 /*!
163 * \brief Converts the connectivity from CGNS to SU2 for a Quad4 element.
164 * \param[out] VTK_Type - Corresponding VTK type
165 * \param[out] nPoly - Polynomial degree
166 * \param[out] nDOFs - Number of DOFs of the element.
167 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
168 */
169 void CreateDataQUAD_4(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
170 vector<unsigned short>& SU2ToCGNS);
171
172 /*!
173 * \brief Converts the connectivity from CGNS to SU2 for a Quad9 element.
174 * \param[out] VTK_Type - Corresponding VTK type
175 * \param[out] nPoly - Polynomial degree
176 * \param[out] nDOFs - Number of DOFs of the element.
177 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
178 */
179 void CreateDataQUAD_9(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
180 vector<unsigned short>& SU2ToCGNS);
181
182 /*!
183 * \brief Converts the connectivity from CGNS to SU2 for a Quad16 element.
184 * \param[out] VTK_Type - Corresponding VTK type
185 * \param[out] nPoly - Polynomial degree
186 * \param[out] nDOFs - Number of DOFs of the element.
187 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
188 */
189 void CreateDataQUAD_16(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
190 vector<unsigned short>& SU2ToCGNS);
191
192 /*!
193 * \brief Converts the connectivity from CGNS to SU2 for a Quad25 element.
194 * \param[out] VTK_Type - Corresponding VTK type
195 * \param[out] nPoly - Polynomial degree
196 * \param[out] nDOFs - Number of DOFs of the element.
197 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
198 */
199 void CreateDataQUAD_25(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
200 vector<unsigned short>& SU2ToCGNS);
201
202 /*!
203 * \brief Converts the connectivity from CGNS to SU2 for a Tetra4 element.
204 * \param[out] VTK_Type - Corresponding VTK type
205 * \param[out] nPoly - Polynomial degree
206 * \param[out] nDOFs - Number of DOFs of the element.
207 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
208 */
209 void CreateDataTETRA_4(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
210 vector<unsigned short>& SU2ToCGNS);
211
212 /*!
213 * \brief Converts the connectivity from CGNS to SU2 for a Tetra10 element.
214 * \param[out] VTK_Type - Corresponding VTK type
215 * \param[out] nPoly - Polynomial degree
216 * \param[out] nDOFs - Number of DOFs of the element.
217 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
218 */
219 void CreateDataTETRA_10(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
220 vector<unsigned short>& SU2ToCGNS);
221
222 /*!
223 * \brief Converts the connectivity from CGNS to SU2 for a Tetra20 element.
224 * \param[out] VTK_Type - Corresponding VTK type
225 * \param[out] nPoly - Polynomial degree
226 * \param[out] nDOFs - Number of DOFs of the element.
227 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
228 */
229 void CreateDataTETRA_20(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
230 vector<unsigned short>& SU2ToCGNS);
231
232 /*!
233 * \brief Converts the connectivity from CGNS to SU2 for a Tetra35 element.
234 * \param[out] VTK_Type - Corresponding VTK type
235 * \param[out] nPoly - Polynomial degree
236 * \param[out] nDOFs - Number of DOFs of the element.
237 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
238 */
239 void CreateDataTETRA_35(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
240 vector<unsigned short>& SU2ToCGNS);
241
242 /*!
243 * \brief Converts the connectivity from CGNS to SU2 for a Pyra5 element.
244 * \param[out] VTK_Type - Corresponding VTK type
245 * \param[out] nPoly - Polynomial degree
246 * \param[out] nDOFs - Number of DOFs of the element.
247 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
248 */
249 void CreateDataPYRA_5(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
250 vector<unsigned short>& SU2ToCGNS);
251
252 /*!
253 * \brief Converts the connectivity from CGNS to SU2 for a Pyra14 element.
254 * \param[out] VTK_Type - Corresponding VTK type
255 * \param[out] nPoly - Polynomial degree
256 * \param[out] nDOFs - Number of DOFs of the element.
257 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
258 */
259 void CreateDataPYRA_14(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
260 vector<unsigned short>& SU2ToCGNS);
261
262 /*!
263 * \brief Converts the connectivity from CGNS to SU2 for a Pyra30 element.
264 * \param[out] VTK_Type - Corresponding VTK type
265 * \param[out] nPoly - Polynomial degree
266 * \param[out] nDOFs - Number of DOFs of the element.
267 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
268 */
269 void CreateDataPYRA_30(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
270 vector<unsigned short>& SU2ToCGNS);
271
272 /*!
273 * \brief Converts the connectivity from CGNS to SU2 for a Pyra55 element.
274 * \param[out] VTK_Type - Corresponding VTK type
275 * \param[out] nPoly - Polynomial degree
276 * \param[out] nDOFs - Number of DOFs of the element.
277 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
278 */
279 void CreateDataPYRA_55(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
280 vector<unsigned short>& SU2ToCGNS);
281
282 /*!
283 * \brief Converts the connectivity from CGNS to SU2 for a Penta6 element.
284 * \param[out] VTK_Type - Corresponding VTK type
285 * \param[out] nPoly - Polynomial degree
286 * \param[out] nDOFs - Number of DOFs of the element.
287 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
288 */
289 void CreateDataPENTA_6(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
290 vector<unsigned short>& SU2ToCGNS);
291
292 /*!
293 * \brief Converts the connectivity from CGNS to SU2 for a Penta18 element.
294 * \param[out] VTK_Type - Corresponding VTK type
295 * \param[out] nPoly - Polynomial degree
296 * \param[out] nDOFs - Number of DOFs of the element.
297 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
298 */
299 void CreateDataPENTA_18(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
300 vector<unsigned short>& SU2ToCGNS);
301
302 /*!
303 * \brief Converts the connectivity from CGNS to SU2 for a Penta40 element.
304 * \param[out] VTK_Type - Corresponding VTK type
305 * \param[out] nPoly - Polynomial degree
306 * \param[out] nDOFs - Number of DOFs of the element.
307 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
308 */
309 void CreateDataPENTA_40(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
310 vector<unsigned short>& SU2ToCGNS);
311
312 /*!
313 * \brief Converts the connectivity from CGNS to SU2 for a Penta75 element.
314 * \param[out] VTK_Type - Corresponding VTK type
315 * \param[out] nPoly - Polynomial degree
316 * \param[out] nDOFs - Number of DOFs of the element.
317 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
318 */
319 void CreateDataPENTA_75(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
320 vector<unsigned short>& SU2ToCGNS);
321
322 /*!
323 * \brief Converts the connectivity from CGNS to SU2 for a Hexa8 element.
324 * \param[out] VTK_Type - Corresponding VTK type
325 * \param[out] nPoly - Polynomial degree
326 * \param[out] nDOFs - Number of DOFs of the element.
327 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
328 */
329 void CreateDataHEXA_8(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
330 vector<unsigned short>& SU2ToCGNS);
331
332 /*!
333 * \brief Converts the connectivity from CGNS to SU2 for a Hexa27 element.
334 * \param[out] VTK_Type - Corresponding VTK type
335 * \param[out] nPoly - Polynomial degree
336 * \param[out] nDOFs - Number of DOFs of the element.
337 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
338 */
339 void CreateDataHEXA_27(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
340 vector<unsigned short>& SU2ToCGNS);
341
342 /*!
343 * \brief Converts the connectivity from CGNS to SU2 for a Hexa64 element.
344 * \param[out] VTK_Type - Corresponding VTK type
345 * \param[out] nPoly - Polynomial degree
346 * \param[out] nDOFs - Number of DOFs of the element.
347 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
348 */
349 void CreateDataHEXA_64(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
350 vector<unsigned short>& SU2ToCGNS);
351
352 /*!
353 * \brief Converts the connectivity from CGNS to SU2 for a Hexa125 element.
354 * \param[out] VTK_Type - Corresponding VTK type
355 * \param[out] nPoly - Polynomial degree
356 * \param[out] nDOFs - Number of DOFs of the element.
357 * \param[out] SU2ToCGNS - Vector containing the mapping from SU2 to CGNS.
358 */
359 void CreateDataHEXA_125(unsigned short& VTK_Type, unsigned short& nPoly, unsigned short& nDOFs,
360 vector<unsigned short>& SU2ToCGNS);
361};
362#endif