MED fichier: Fichier source de MEDiterators.c

MED fichier

MEDiterators.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #include <med.h>
20 #include <med_config.h>
21 #include <string.h>
22
23 /*L'itération sur les */
24
25 med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]={
26 MED_UNDEF_ENTITY_TYPE,
27 MED_CELL,
28 MED_DESCENDING_FACE,
29 MED_DESCENDING_EDGE,
30 MED_NODE,
31 MED_NODE_ELEMENT,
32 MED_STRUCT_ELEMENT,
33 MED_UNDEF_ENTITY_TYPE
34 };
35
36 const char * const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2]={
37 "MED_UNDEF_ENTITY_TYPE",
38 "MED_CELL",
39 "MED_DESCENDING_FACE",
40 "MED_DESCENDING_EDGE",
41 "MED_NODE",
42 "MED_NODE_ELEMENT",
43 "MED_STRUCT_ELEMENT",
44 "MED_UNDEF_ENTITY_TYPE"
45 };
46
47
48 /* MED_N_CELL_FIXED_GEO ne prend pas en compte (MED_NODE,MED_NO_GEOTYPE)
49 sinon il faudrait ajouter un MED_NO_GEOTYPE supplémentaire avant POINT1
50 mais les NOEUDS ne sont pas des mailles et le MED_N_NODE_FIXED_GEO ==1 n'est
51 pas comptabilisé dans MED_N_CELL_FIXED_GEO.
52 Pour le codage interne Nbits itératif des types géométrique de MED_ALL_ENTITY_TYPE ,
53 il faut commencer à _it==0 contrairement aux autres type d'entités.
54 */
55 med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]={
56 MED_NO_GEOTYPE,
57 MED_POINT1,
58 MED_SEG2,
59 MED_SEG3,
60 MED_SEG4,
61 MED_TRIA3,
62 MED_QUAD4,
63 MED_TRIA6,
64 MED_TRIA7,
65 MED_QUAD8,
66 MED_QUAD9,
67 MED_TETRA4,
68 MED_PYRA5,
69 MED_PENTA6,
70 MED_HEXA8,
71 MED_TETRA10,
72 MED_OCTA12,
73 MED_PYRA13,
74 MED_PENTA15,
75 MED_PENTA18,
76 MED_HEXA20,
77 MED_HEXA27,
78 MED_POLYGON,
79 MED_POLYGON2,
80 MED_POLYHEDRON,
81 MED_NO_GEOTYPE
82 };
83
84 const char * const MED_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]={
85 "MED_NO_GEOTYPE",
86 "MED_POINT1",
87 "MED_SEG2",
88 "MED_SEG3",
89 "MED_SEG4",
90 "MED_TRIA3",
91 "MED_QUAD4",
92 "MED_TRIA6",
93 "MED_TRIA7",
94 "MED_QUAD8",
95 "MED_QUAD9",
96 "MED_TETRA4",
97 "MED_PYRA5",
98 "MED_PENTA6",
99 "MED_HEXA8",
100 "MED_TETRA10",
101 "MED_OCTA12",
102 "MED_PYRA13",
103 "MED_PENTA15",
104 "MED_PENTA18",
105 "MED_HEXA20",
106 "MED_HEXA27",
107 "MED_POLYGON",
108 "MED_POLYGON2",
109 "MED_POLYHEDRON",
110 "MED_NO_GEOTYPE"
111 };
112
113
114 med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]={
115 MED_NO_GEOTYPE,
116 MED_TRIA3,
117 MED_QUAD4,
118 MED_TRIA6,
119 MED_TRIA7,
120 MED_QUAD8,
121 MED_QUAD9,
122 MED_POLYGON,
123 MED_POLYGON2,
124 MED_NO_GEOTYPE
125 };
126
127 const char * const MED_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]={
128 "MED_NO_GEOTYPE",
129 "MED_TRIA3",
130 "MED_QUAD4",
131 "MED_TRIA6",
132 "MED_TRIA7",
133 "MED_QUAD8",
134 "MED_QUAD9",
135 "MED_POLYGON",
136 "MED_POLYGON2",
137 "MED_NO_GEOTYPE"
138 };
139
140 med_geometry_type MED_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2]={
141 MED_NO_GEOTYPE,
142 MED_SEG2,
143 MED_SEG3,
144 MED_SEG4,
145 MED_NO_GEOTYPE
146 };
147
148 const char * MED_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]={
149 "MED_NO_GEOTYPE",
150 "MED_SEG2",
151 "MED_SEG3",
152 "MED_SEG4",
153 "MED_NO_GEOTYPE"
154 };
155
156 med_geometry_type MED_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]={
157 MED_NO_GEOTYPE,
158 MED_NO_GEOTYPE,
159 MED_NO_GEOTYPE
160 };
161
162 const char * MED_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2]={
163 "MED_NO_GEOTYPE",
164 "MED_NO_GEOTYPE",
165 "MED_NO_GEOTYPE"
166 };
167
168
169 /* A renommer en MED_GET_GEOMETRY_TYPE_FROM_ENTITY_TYPE */
170 /* cf. define dans med.h.in */
171 const med_geometry_type * const MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]={
172 MED_NULL,
173 MED_GET_CELL_GEOMETRY_TYPE,
174 MED_GET_FACE_GEOMETRY_TYPE,
175 MED_GET_EDGE_GEOMETRY_TYPE,
176 MED_GET_NODE_GEOMETRY_TYPE,
177 MED_GET_CELL_GEOMETRY_TYPE, /*Les éléments aux noeuds ont les mêmes types géométriques que les CELL*/
178 MED_NULL, /*pas de type géométrique prédéfini (statique) pour les éléments de structure */
179 MED_NULL
180 };
181
182 const int MED_GET_N_FIXED_GEO_FOR_ENTITY_TYPE_IT[MED_N_ENTITY_TYPES+2]={
183 0,
184 MED_N_CELL_FIXED_GEO,
185 MED_N_FACE_FIXED_GEO,
186 MED_N_EDGE_FIXED_GEO,
187 MED_N_NODE_FIXED_GEO,
188 MED_N_CELL_FIXED_GEO, /*Les éléments aux noeuds ont les mêmes types géométriques que les CELL*/
189 0, /*pas de type géométrique prédéfini (statique) pour les éléments de structure */
190 0
191 };
192
193
194
195
196 int MEDgetEntityTypeIt(med_entity_type entitytype) {
197 switch( entitytype ) {
198 case MED_UNDEF_ENTITY_TYPE : return 0; break;
199 case MED_CELL : return 1; break;
200 case MED_DESCENDING_FACE : return 2; break;
201 case MED_DESCENDING_EDGE : return 3; break;
202 case MED_NODE : return 4; break;
203 case MED_NODE_ELEMENT : return 5; break;
204 case MED_STRUCT_ELEMENT : return 6; break;
205 /* case MED_UNDEF_ENTITY_TYPE : return 7; break; */
206 }
207 };
208
209
210 int MEDgetCellGeometryTypeIt(med_geometry_type geotype) {
211 switch( geotype ) {
212 case MED_NO_GEOTYPE : return 0; break;
213 case MED_POINT1 : return 1; break;
214 case MED_SEG2 : return 2; break;
215 case MED_SEG3 : return 3; break;
216 case MED_SEG4 : return 4; break;
217 case MED_TRIA3 : return 5; break;
218 case MED_QUAD4 : return 6; break;
219 case MED_TRIA6 : return 7; break;
220 case MED_TRIA7 : return 8; break;
221 case MED_QUAD8 : return 9; break;
222 case MED_QUAD9 : return 10; break;
223 case MED_TETRA4 : return 11; break;
224 case MED_PYRA5 : return 12; break;
225 case MED_PENTA6 : return 13; break;
226 case MED_HEXA8 : return 14; break;
227 case MED_TETRA10 : return 15; break;
228 case MED_OCTA12 : return 16; break;
229 case MED_PYRA13 : return 17; break;
230 case MED_PENTA15 : return 18; break;
231 case MED_PENTA18 : return 19; break;
232 case MED_HEXA20 : return 20; break;
233 case MED_HEXA27 : return 21; break;
234 case MED_POLYGON : return 22; break;
235 case MED_POLYGON2 : return 23; break;
236 case MED_POLYHEDRON : return 24; break;
237 /* case MED_NO_GEOTYPE : return 25; break; */
238 }
239 };
240
241
242 int MEDgetFaceGeometryTypeIt(med_geometry_type geotype) {
243 switch( geotype ) {
244 case MED_NO_GEOTYPE : return 0; break;
245 case MED_TRIA3 : return 1; break;
246 case MED_QUAD4 : return 2; break;
247 case MED_TRIA6 : return 3; break;
248 case MED_TRIA7 : return 4; break;
249 case MED_QUAD8 : return 5; break;
250 case MED_QUAD9 : return 6; break;
251 case MED_POLYGON : return 7; break;
252 case MED_POLYGON2 : return 8; break;
253 /* case MED_NO_GEOTYPE : return 9; break; */
254 }
255 };
256
257 int MEDgetEdgeGeometryTypeIt(med_geometry_type geotype) {
258 switch( geotype ) {
259 case MED_NO_GEOTYPE : return 0; break;
260 case MED_SEG2 : return 1; break;
261 case MED_SEG3 : return 2; break;
262 case MED_SEG4 : return 3; break;
263 }
264 };
265
266 int MEDgetNodeGeometryTypeIt(med_geometry_type geotype) {
267 switch( geotype ) {
268 case MED_NO_GEOTYPE : return 1; break;
269 }
270 };
271
272 int MEDgetEntityGeometryTypeIt(med_entity_type entitytype, med_geometry_type geotype) {
273 switch( entitytype ) {
274 case MED_UNDEF_ENTITY_TYPE : return 0; break;
275 case MED_CELL : return MEDgetCellGeometryTypeIt(geotype); break;
276 case MED_DESCENDING_FACE : return MEDgetFaceGeometryTypeIt(geotype); break;
277 case MED_DESCENDING_EDGE : return MEDgetEdgeGeometryTypeIt(geotype); break;
278 case MED_NODE : return MEDgetNodeGeometryTypeIt(geotype); break;
279 case MED_NODE_ELEMENT : return MEDgetCellGeometryTypeIt(geotype); break;
280 case MED_STRUCT_ELEMENT : return geotype%MED_STRUCT_GEO_INTERNAL ; break;
281 }
282 };
283
284 const char * const MEDgetEntityTypeName(med_entity_type entitytype) {
285 switch( entitytype ) {
286 case MED_UNDEF_ENTITY_TYPE : return "MED_UNDEF_ENTITY_TYPE"; break;
287 case MED_CELL : return "MED_CELL" ; break;
288 case MED_DESCENDING_FACE : return "MED_DESCENDING_FACE" ; break;
289 case MED_DESCENDING_EDGE : return "MED_DESCENDING_EDGE" ; break;
290 case MED_NODE : return "MED_NODE" ; break;
291 case MED_NODE_ELEMENT : return "MED_NODE_ELEMENT" ; break;
292 case MED_STRUCT_ELEMENT : return "MED_STRUCT_ELEMENT" ; break;
293 }
294 }
295
296 const char * const MEDgetGeometryTypeName(med_geometry_type geotype) {
297 switch( geotype ) {
298 case MED_NO_GEOTYPE : return "MED_NO_GEOTYPE"; break;
299 case MED_POINT1 : return "MED_POINT1" ; break;
300 case MED_SEG2 : return "MED_SEG2" ; break;
301 case MED_SEG3 : return "MED_SEG3" ; break;
302 case MED_SEG4 : return "MED_SEG4" ; break;
303 case MED_TRIA3 : return "MED_TRIA3" ; break;
304 case MED_QUAD4 : return "MED_QUAD4" ; break;
305 case MED_TRIA6 : return "MED_TRIA6" ; break;
306 case MED_TRIA7 : return "MED_TRIA7" ; break;
307 case MED_QUAD8 : return "MED_QUAD8" ; break;
308 case MED_QUAD9 : return "MED_QUAD9" ; break;
309 case MED_TETRA4 : return "MED_TETRA4" ; break;
310 case MED_PYRA5 : return "MED_PYRA5" ; break;
311 case MED_PENTA6 : return "MED_PENTA6" ; break;
312 case MED_HEXA8 : return "MED_HEXA8" ; break;
313 case MED_TETRA10 : return "MED_TETRA10" ; break;
314 case MED_OCTA12 : return "MED_OCTA12" ; break;
315 case MED_PYRA13 : return "MED_PYRA13" ; break;
316 case MED_PENTA15 : return "MED_PENTA15" ; break;
317 case MED_PENTA18 : return "MED_PENTA18" ; break;
318 case MED_HEXA20 : return "MED_HEXA20" ; break;
319 case MED_HEXA27 : return "MED_HEXA27" ; break;
320 case MED_POLYGON : return "MED_POLYGON" ; break;
321 case MED_POLYGON2 : return "MED_POLYGON2" ; break;
322 case MED_POLYHEDRON : return "MED_POLYHEDRON"; break;
323 default :
324 return "MED_UNKNOWN_GEOTYPE";
325 break;
326 }
327 };
MED_GET_EDGE_GEOMETRY_TYPENAME
const char * MED_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]
Definition: MEDiterators.c:148
MED_TRIA3
#define MED_TRIA3
Definition: med.h:203
MED_STRUCT_GEO_INTERNAL
#define MED_STRUCT_GEO_INTERNAL
Definition: med.h:228
MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE
const med_geometry_type *const MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
Definition: MEDiterators.c:171
MED_GET_ENTITY_TYPE
med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
Definition: MEDiterators.c:25
med_geometry_type
int med_geometry_type
Definition: med.h:194
MED_PYRA13
#define MED_PYRA13
Definition: med.h:216
MED_OCTA12
#define MED_OCTA12
Definition: med.h:215
MED_QUAD8
#define MED_QUAD8
Definition: med.h:207
MED_NO_GEOTYPE
#define MED_NO_GEOTYPE
Definition: med.h:232
MED_DESCENDING_FACE
Definition: med.h:143
MEDgetNodeGeometryTypeIt
int MEDgetNodeGeometryTypeIt(med_geometry_type geotype)
Definition: MEDiterators.c:266
MED_PENTA6
#define MED_PENTA6
Definition: med.h:212
MED_SEG2
#define MED_SEG2
Definition: med.h:200
MED_TETRA10
#define MED_TETRA10
Definition: med.h:214
MED_STRUCT_ELEMENT
Definition: med.h:144
MED_N_NODE_FIXED_GEO
#define MED_N_NODE_FIXED_GEO
Definition: med.h:251
MED_GET_FACE_GEOMETRY_TYPE
med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]
Definition: MEDiterators.c:114
med_entity_type
med_entity_type
Definition: med.h:143
MED_SEG4
#define MED_SEG4
Definition: med.h:202
MEDgetFaceGeometryTypeIt
int MEDgetFaceGeometryTypeIt(med_geometry_type geotype)
Definition: MEDiterators.c:242
MEDgetGeometryTypeName
const char *const MEDgetGeometryTypeName(med_geometry_type geotype)
Definition: MEDiterators.c:296
MED_CELL
Definition: med.h:143
MEDgetCellGeometryTypeIt
int MEDgetCellGeometryTypeIt(med_geometry_type geotype)
Definition: MEDiterators.c:210
MED_PENTA15
#define MED_PENTA15
Definition: med.h:217
MED_TRIA7
#define MED_TRIA7
Definition: med.h:206
MED_GET_CELL_GEOMETRY_TYPE
med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]
Definition: MEDiterators.c:55
med.h
MED_POLYGON2
#define MED_POLYGON2
Definition: med.h:224
MED_HEXA8
#define MED_HEXA8
Definition: med.h:213
MED_PYRA5
#define MED_PYRA5
Definition: med.h:211
MEDgetEdgeGeometryTypeIt
int MEDgetEdgeGeometryTypeIt(med_geometry_type geotype)
Definition: MEDiterators.c:257
MED_GET_NODE_GEOMETRY_TYPENAME
const char * MED_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2]
Definition: MEDiterators.c:162
MED_POINT1
#define MED_POINT1
Definition: med.h:198
MEDgetEntityGeometryTypeIt
int MEDgetEntityGeometryTypeIt(med_entity_type entitytype, med_geometry_type geotype)
Definition: MEDiterators.c:272
MED_QUAD9
#define MED_QUAD9
Definition: med.h:208
MED_NODE
Definition: med.h:143
MED_GET_CELL_GEOMETRY_TYPENAME
const char *const MED_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]
Definition: MEDiterators.c:84
MED_GET_N_FIXED_GEO_FOR_ENTITY_TYPE_IT
const int MED_GET_N_FIXED_GEO_FOR_ENTITY_TYPE_IT[MED_N_ENTITY_TYPES+2]
Definition: MEDiterators.c:182
MED_N_FACE_FIXED_GEO
#define MED_N_FACE_FIXED_GEO
Definition: med.h:243
MED_N_CELL_FIXED_GEO
#define MED_N_CELL_FIXED_GEO
Definition: med.h:239
MED_GET_ENTITY_TYPENAME
const char *const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2]
Definition: MEDiterators.c:36
MED_TETRA4
#define MED_TETRA4
Definition: med.h:210
MED_HEXA27
#define MED_HEXA27
Definition: med.h:220
MED_N_ENTITY_TYPES
#define MED_N_ENTITY_TYPES
Definition: med.h:146
MED_GET_NODE_GEOMETRY_TYPE
med_geometry_type MED_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]
Definition: MEDiterators.c:156
MED_PENTA18
#define MED_PENTA18
Definition: med.h:218
MED_UNDEF_ENTITY_TYPE
Definition: med.h:145
MED_N_EDGE_FIXED_GEO
#define MED_N_EDGE_FIXED_GEO
Definition: med.h:247
med_config.h
MED_NULL
#define MED_NULL
Definition: med.h:75
MED_GET_FACE_GEOMETRY_TYPENAME
const char *const MED_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]
Definition: MEDiterators.c:127
MED_SEG3
#define MED_SEG3
Definition: med.h:201
MED_GET_EDGE_GEOMETRY_TYPE
med_geometry_type MED_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2]
Definition: MEDiterators.c:140
MED_HEXA20
#define MED_HEXA20
Definition: med.h:219
MED_POLYHEDRON
#define MED_POLYHEDRON
Definition: med.h:225
MEDgetEntityTypeIt
int MEDgetEntityTypeIt(med_entity_type entitytype)
Definition: MEDiterators.c:196
MED_QUAD4
#define MED_QUAD4
Definition: med.h:204
MED_TRIA6
#define MED_TRIA6
Definition: med.h:205
MED_POLYGON
#define MED_POLYGON
Definition: med.h:223
MEDgetEntityTypeName
const char *const MEDgetEntityTypeName(med_entity_type entitytype)
Definition: MEDiterators.c:284
MED_NODE_ELEMENT
Definition: med.h:144
MED_DESCENDING_EDGE
Definition: med.h:143