MED fichier
build.python3.12/include/med.h
Aller à la documentation de ce fichier.
1/* -*- mode:C; coding:utf-8 -*- */
2/* This file is part of MED.
3 *
4 * COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
5 * MED is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * MED is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with MED. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef MED_H
20#define MED_H
21
22#include <hdf5.h>
23#ifdef HAVE_STDINT_H
24#include <stdint.h> // Use the C99 official header
25#endif
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* This is the minimum hdf version med must have */
32#define HDF_VERSION_REF "5-1.10.2"
33#define HDF_VERSION_MAJOR_REF 1
34#define HDF_VERSION_MINOR_REF 10
35#define HDF_VERSION_RELEASE_REF 2
36#define HDF_VERSION_NUM_REF (HDF_VERSION_MAJOR_REF * 10000 + HDF_VERSION_MINOR_REF * 100 + HDF_VERSION_RELEASE_REF )
37
38#define HDF5_VERSION (H5_VERS_MAJOR * 10000 + H5_VERS_MINOR * 100 + H5_VERS_RELEASE )
39
40#if HDF5_VERSION < 10607
41/*TODO : A enlever après MAJ complète api hdf5-1.8 */
42#define HDF5_SELECT_BUG (const hsize_t **)
43#else
44#define HDF5_SELECT_BUG
45#endif
46
47/*Le symbole H5F_LIBVER_18 n'existe pas dans hdf5-1.8.4 (uniquement à partir de la version 1.8.6)
48 Pour rester dans le modèle interne hdf introduit en 1.8 quelque soit les futurs modèles internes hdf
49 on impose le modèle 1.8 et non le LATEST (cf _MEDfileCreate).
50 La valeur utilisée est celle définie dans les version >= 1.8.6 (cf H5Fpublic.h) */
51#ifndef H5F_LIBVER_18
53#define H5F_LIBVER_18 1
54#endif
55
56/*En anglais*/
57#define MED_MAJOR_NUM 4
58#define MED_MINOR_NUM 1
59#define MED_RELEASE_NUM 0
60#define MED_3_LATEST_MINOR 3
61#define MED_4_LATEST_MINOR 1
62#define MED_40_LATEST_RELEASE 1
63
64/*En franglais*/
65#define MED_NUM_MAJEUR 4
66#define MED_NUM_MINEUR 1
67#define MED_NUM_RELEASE 0
68
69#define STR(x) #x
70#define _MED_VERSION(x,y,z) STR(x) "." STR(y) "." STR(z)
71#define MED_VERSION_STR _MED_VERSION(MED_NUM_MAJEUR,MED_NUM_MINEUR,MED_NUM_RELEASE)
72
73#define MED_HAVE_MPI
74
75#define MED_NULL (void *) NULL
76#define MED_MAX_PARA 20
77
79#define MED_COMMENT_SIZE 200
80#define MED_IDENT_SIZE 8
81#define MED_NAME_SIZE 64
82#define MED_SNAME_SIZE 16
83#define MED_LNAME_SIZE 80
84
85#define MED_SNAME_BLANK " "
86#define MED_NAME_BLANK " "
87/* 0123456789012345678901234567890123456789012345678901234567890123*/
88
89#define MED_PATHNAME_SIZE 255
90#define MED_MAX_CHFID_PATH MED_PATHNAME_SIZE
95/* 2.3v3.0 ok*/
102
103
107/* 2.3v3.0 ok*/
115
116
120typedef enum {MED_ACC_RDONLY,
126
130/*2.3v3.0 ok*/
132
136/* 2.3v3.0 ok*/
137typedef enum {MED_CARTESIAN_GRID,
141
142/* 2.3v3.0 ok*/
146#define MED_N_ENTITY_TYPES 6
147
148/* 2.3v3.0 ok*/
153
154/* 2.3v3.0 ok*/
163/*TODO: Réécrire les routines _MEDatt avec med_internal_type au lieu de med_field_type */
164
172
177
179
180#define MED_ATT_FLOAT64_ctype med_float
181#define MED_ATT_INT_ctype med_int
182#define MED_ATT_NAME_ctype char
183#define MED_ATT_UNDEF_ctype unknown_ctype
185#define MED_CTYPE(medatttype) medatttype##_ctype
186
187/* 2.3v3.0 ok : med_type_donnee*/
192
193
195
196/* Mailles dont la géométrie à une connectivité fixe*/
197
198#define MED_POINT1 001
199
200#define MED_SEG2 102
201#define MED_SEG3 103
202#define MED_SEG4 104
203#define MED_TRIA3 203
204#define MED_QUAD4 204
205#define MED_TRIA6 206
206#define MED_TRIA7 207
207#define MED_QUAD8 208
208#define MED_QUAD9 209
209
210#define MED_TETRA4 304
211#define MED_PYRA5 305
212#define MED_PENTA6 306
213#define MED_HEXA8 308
214#define MED_TETRA10 310
215#define MED_OCTA12 312
216#define MED_PYRA13 313
217#define MED_PENTA15 315
218#define MED_PENTA18 318
219#define MED_HEXA20 320
220#define MED_HEXA27 327
221
222/* Mailles dont la géométrie à une connectivité variable*/
223#define MED_POLYGON 400
224#define MED_POLYGON2 420
225#define MED_POLYHEDRON 500
226
227/* Mailles dont la géométrie est dynamique (découverte du modèle dans le fichier) */
228#define MED_STRUCT_GEO_INTERNAL 600
229#define MED_STRUCT_GEO_SUP_INTERNAL 700
230
231#define MED_NONE 0
232#define MED_NO_GEOTYPE MED_NONE
233#define MED_UNDEF_GEOTYPE MED_NONE
234#define MED_UNDEF_GEOMETRY_TYPE MED_NONE
235#define MED_ALL_GEOTYPE -1
236#define MED_GEO_ALL MED_ALL_GEOTYPE
237
238#define MED_N_CELL_GEO 25
239#define MED_N_CELL_FIXED_GEO 24
240#define MED_N_CELL_GEO_FIXED_CON 21
242#define MED_N_FACE_GEO 8
243#define MED_N_FACE_FIXED_GEO 8
244#define MED_N_FACE_GEO_FIXED_CON 6
245
246#define MED_N_EDGE_TYPES 3
247#define MED_N_EDGE_FIXED_GEO 3
248#define MED_N_EDGE_GEO_FIXED_CON 3
249
250#define MED_N_NODE_GEO 1
251#define MED_N_NODE_FIXED_GEO 1
252#define MED_N_NODE_GEO_FIXED_CON 1
253
254/*2.3v3.0 ok*/
256
257/*2.3v3.0 ok*/
259
260typedef enum {MED_FALSE, MED_TRUE} med_bool ;
261
262#define MED_GAUSS_ELNO "MED_GAUSS_ELNO"
265#define MED_IPOINT_ELNO MED_GAUSS_ELNO
267
268#define MED_NO_NAME ""
270#define MED_NO_MESHNAME ""
271#define MED_NO_MESH ""
273#define MED_NO_MESH_SUPPORT ""
275#define MED_NO_LOCALIZATION ""
277#define MED_NO_INTERPOLATION ""
279#define MED_NO_IPOINT_INTERNAL 1
281#define MED_NO_PROFILE ""
286#define MED_NO_GROUP ""
288#define MED_ALLENTITIES_PROFILE MED_NO_PROFILE
292#define MED_NO_PROFILE_INTERNAL "MED_NO_PROFILE_INTERNAL"
293#define MED_SAME_PROFILE_INTERNAL "MED_SAME_PROFILE_INTERNAL"
295#define MED_ALL_CONSTITUENT 0
299#define MED_UNDEF_SIZE 0
300#define MED_NO_PROFILE_SIZE 0
311#define MED_ALL_DT -2
312#define MED_ALL_IT -2
313#define MED_NO_DT -1
314#define MED_NO_IT -1
315#define MED_UNDEF_DT 0
317#define MED_ATT_NOT_FILLED -1
318
319
320/* correspondance des types avec HDF 5 */
323typedef hssize_t med_ssize;
324typedef hid_t med_idt;
325typedef herr_t med_err;
327/* types elementaires */
329typedef double med_float;
330typedef double med_float64;
331typedef double med_double;
332typedef float med_float32;
334/*La ligne suivante est déterminée à l'étape de configuration*/
335typedef int med_int;
336typedef int32_t med_int32;
337typedef int64_t med_int64;
339#define INIT2X( x ) x, x,
340#define INIT4X( x ) x, x, x, x
341#define INIT10X( x ) x, x, x, x, x, x, x, x, x, x
342#define MED_MAX_FILTER_SPACES 4100
343#define MED_MAX_FILTER_SPACES_INIT {INIT4X(INIT10X(INIT10X(INIT10X(0)))), INIT10X(INIT10X(0)) }
344
348typedef struct {
349 /*PRIVATE attributes*/
350 med_int nspaces;
353 /*PUBLIC IN attributes*/
354 med_int nentity;
355 med_int nvaluesperentity;
356 med_int nconstituentpervalue;
357 med_int constituentselect;
358 med_switch_mode switchmode;
359 med_int filterarraysize;
360 med_size* filterarray23v30;
361 med_int profilearraysize;/*PRIVATE attribute en IN et OUT positionnée dans MEDfilterCr*/
362 med_storage_mode storagemode;
363 char profilename[MED_NAME_SIZE+1];
364} med_filter;
366
367#define MED_FILTER_INIT { 0, MED_MAX_FILTER_SPACES_INIT, MED_MAX_FILTER_SPACES_INIT ,0,0,0,0,\
368 MED_UNDEF_INTERLACE,MED_NO_FILTER_SIZE, NULL , \
369 MED_NO_PROFILE_SIZE,MED_UNDEF_PFLMODE,MED_NO_PROFILE }
371#define MED_NO_FILTER NULL
372#define MED_NO_FILTER_SIZE 0
373#define MED_NO_PROFILE_F " "
374
378typedef struct {
379 med_int majeur; med_int mineur; med_int release;
381#define MED_FILE_VERSION_INIT {0, 0, 0};
382
386typedef struct {
387 void *app_image_ptr;
388 size_t app_image_size;
389 int ref_count;
391 void *fapl_image_ptr;
392 size_t fapl_image_size;
393 int fapl_ref_count;
394 void *vfd_image_ptr;
395 size_t vfd_image_size;
396 int vfd_ref_count;
397 med_access_mode flags;
399
400#define MED_MEMFILE_INIT {NULL, 0, 1, NULL, 0, 0, NULL, 0, 0, MED_ACC_RDONLY}
403#define AFF_MEMFILE \
404XSCRUTE(memfile->app_image_ptr);\
405ISCRUTE_long(memfile->app_image_size);\
406ISCRUTE_int(memfile->ref_count);\
407XSCRUTE(memfile->fapl_image_ptr);\
408ISCRUTE_long(memfile->fapl_image_size);\
409ISCRUTE_int(memfile->fapl_ref_count);\
410XSCRUTE(memfile->vfd_image_ptr);\
411ISCRUTE_long(memfile->vfd_image_size);\
412ISCRUTE_int(memfile->vfd_ref_count);\
413ISCRUTE_int(memfile->flags);
414
415
416#include "med_proto.h"
417
418/*En cas de modifications/ajouts de type d'entité/géométrique mettre à jour les itérateurs suivants : */
419
421extern MEDC_EXPORT const char * const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
431#define MED_GET_GEOMETRY_TYPE_IT_FROM_ENTITY_TYPE_IT MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE
433
434
435/* Itérateurs sur les types d'entité et types géométriques */
436extern MEDC_EXPORT int MEDgetEntityTypeIt (med_entity_type entitytype);
442
443extern MEDC_EXPORT const char * const MEDgetGeometryTypeName (med_geometry_type geotype );
444extern MEDC_EXPORT const char * const MEDgetEntityTypeName (med_entity_type entitytype);
446/* Predefined names for struct elements */
447#define MED_PARTICLE_NAME "MED_PARTICLE"
448#define MED_BALL_NAME "MED_BALL"
449#define MED_BEAM_NAME "MED_BEAM"
451/* Predefined attributes names for struct elements */
452#define MED_PARTICLE_LABEL "MED_PARTICLE_LABEL"
453#define MED_BALL_DIAMETER "MED_BALL_DIAMETER"
454#define MED_BEAM_THICKNESS "MED_BEAM_THICKNESS"
455
456#ifdef __cplusplus
457}
458#endif
459
460#endif /* MED_H */
unsigned long long hsize_t
MEDC_EXPORT med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
#define MED_NAME_SIZE
MEDC_EXPORT int MEDgetEntityTypeIt(med_entity_type entitytype)
MEDC_EXPORT med_geometry_type MED_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2]
MEDC_EXPORT const char *const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2]
#define MED_MAX_FILTER_SPACES
MEDC_EXPORT int MEDgetNodeGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT int MEDgetEntityGeometryTypeIt(med_entity_type entitytype, med_geometry_type geotype)
med_field_type med_parameter_type
MEDC_EXPORT const char *const MED_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]
MEDC_EXPORT const char *const MED_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]
MEDC_EXPORT const char * MED_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2]
MEDC_EXPORT int MEDgetFaceGeometryTypeIt(med_geometry_type geotype)
#define MED_N_NODE_FIXED_GEO
hssize_t med_ssize
#define MED_N_ENTITY_TYPES
MEDC_EXPORT med_geometry_type MED_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]
MEDC_EXPORT int MEDgetEdgeGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]
#define MED_N_FACE_FIXED_GEO
MEDC_EXPORT const char *const MEDgetGeometryTypeName(med_geometry_type geotype)
#define MED_N_EDGE_FIXED_GEO
MEDC_EXPORT const med_geometry_type *const MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
#define MED_N_CELL_FIXED_GEO
MEDC_EXPORT const char *const MEDgetEntityTypeName(med_entity_type entitytype)
MEDC_EXPORT const int MED_GET_N_FIXED_GEO_FOR_ENTITY_TYPE_IT[MED_N_ENTITY_TYPES+2]
MEDC_EXPORT const char * MED_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]
MEDC_EXPORT int MEDgetCellGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]
#define MEDC_EXPORT
Structure d'acceuil du numéro de version MED d'un fichier.
Filtre de sélection.
Structure d'acceuil du buffer d'un fichier MED en mémoire.