MED fichier
build.python3.15/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 - 2025 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.14.0"
33#define HDF_VERSION_MAJOR_REF 1
34#define HDF_VERSION_MINOR_REF 14
35#define HDF_VERSION_RELEASE_REF 0
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 6
58#define MED_MINOR_NUM 0
59#define MED_RELEASE_NUM 1
60
61#define MED_3_LATEST_MINOR 3
62#define MED_4_LATEST_MINOR 2
63#define MED_40_LATEST_RELEASE 1
64#define MED_41_LATEST_RELEASE 2
65#define MED_42_LATEST_RELEASE @MED_42_LATEST_RELEASE@
66#define MED_5_LATEST_MINOR 1
67#define MED_50_LATEST_RELEASE 2
68#define MED_51_LATEST_RELEASE 0
69#define MED_6_LATEST_MINOR 0
70#define MED_60_LATEST_RELEASE 1
71
72/*En franglais*/
73#define MED_NUM_MAJEUR 6
74#define MED_NUM_MINEUR 0
75#define MED_NUM_RELEASE 1
76
77#define STR(x) #x
78#define _MED_VERSION(x,y,z) STR(x) "." STR(y) "." STR(z)
79#define MED_VERSION_STR _MED_VERSION(MED_NUM_MAJEUR,MED_NUM_MINEUR,MED_NUM_RELEASE)
80
81#define MED_HAVE_MPI
82
83#define MED_NULL (void *) NULL
84#define MED_MAX_PARA 20
85
87#define MED_COMMENT_SIZE 200
88#define MED_IDENT_SIZE 8
89#define MED_NAME_SIZE 64
90#define MED_SNAME_SIZE 16
91#define MED_LNAME_SIZE 80
92
93#define MED_SNAME_BLANK " "
94#define MED_NAME_BLANK " "
95/* 0123456789012345678901234567890123456789012345678901234567890123*/
96#define MED_LNAME_BLANK MED_NAME_BLANK MED_SNAME_BLANK
97
98
99#define MED_PATHNAME_SIZE 255
100#define MED_MAX_CHFID_PATH MED_PATHNAME_SIZE
101
105/* 2.3v3.0 ok*/
106typedef enum {MED_FULL_INTERLACE,
112#define med_interlacing_mode med_switch_mode
113
117/* 2.3v3.0 ok*/
125
126
130typedef enum {MED_ACC_RDONLY,
136
140/*2.3v3.0 ok*/
142
146/* 2.3v3.0 ok*/
147typedef enum {MED_CARTESIAN_GRID,
151
152/* 2.3v3.0 ok*/
156#define MED_N_ENTITY_TYPES 6
157
158/* 2.3v3.0 ok*/
163
164/* 2.3v3.0 ok*/
172
173/*TODO: Réécrire les routines _MEDatt avec med_internal_type au lieu de med_field_type */
174
182
187
189
190#define MED_ATT_FLOAT64_ctype med_float
191#define MED_ATT_INT_ctype med_int
192#define MED_ATT_NAME_ctype char
193#define MED_ATT_UNDEF_ctype unknown_ctype
194
195#define MED_CTYPE(medatttype) medatttype##_ctype
196
197/* 2.3v3.0 ok : med_type_donnee*/
203
204
205typedef int med_geometry_type;
206
207/* Mailles dont la géométrie à une connectivité fixe*/
208
209#define MED_POINT1 001
210
211#define MED_SEG2 102
212#define MED_SEG3 103
213#define MED_SEG4 104
214#define MED_TRIA3 203
215#define MED_QUAD4 204
216#define MED_TRIA6 206
217#define MED_TRIA7 207
218#define MED_QUAD8 208
219#define MED_QUAD9 209
220
221#define MED_TETRA4 304
222#define MED_PYRA5 305
223#define MED_PENTA6 306
224#define MED_HEXA8 308
225#define MED_TETRA10 310
226#define MED_OCTA12 312
227#define MED_PYRA13 313
228#define MED_PENTA15 315
229#define MED_PENTA18 318
230#define MED_HEXA20 320
231#define MED_HEXA27 327
232
233/* Mailles dont la géométrie à une connectivité variable*/
234#define MED_POLYGON 400
235#define MED_POLYGON2 420
236#define MED_POLYHEDRON 500
237
238/* Mailles dont la géométrie est dynamique (découverte du modèle dans le fichier) */
239#define MED_STRUCT_GEO_INTERNAL 600
240#define MED_STRUCT_GEO_SUP_INTERNAL 700
241
242#define MED_NONE 0
243#define MED_NO_GEOTYPE MED_NONE
244#define MED_UNDEF_GEOTYPE MED_NONE
245#define MED_UNDEF_GEOMETRY_TYPE MED_NONE
246#define MED_ALL_GEOTYPE -1
247#define MED_GEO_ALL MED_ALL_GEOTYPE
248
249#define MED_N_CELL_GEO 25
250#define MED_N_CELL_FIXED_GEO 24
251#define MED_N_CELL_GEO_FIXED_CON 21
252
253#define MED_N_FACE_GEO 8
254#define MED_N_FACE_FIXED_GEO 8
255#define MED_N_FACE_GEO_FIXED_CON 6
256
257#define MED_N_EDGE_TYPES 3
258#define MED_N_EDGE_FIXED_GEO 3
259#define MED_N_EDGE_GEO_FIXED_CON 3
260
261#define MED_N_NODE_GEO 1
262#define MED_N_NODE_FIXED_GEO 1
263#define MED_N_NODE_GEO_FIXED_CON 1
264
265/*2.3v3.0 ok*/
267
268/*2.3v3.0 ok*/
270
271typedef enum {MED_FALSE, MED_TRUE} med_bool ;
272
273#define MED_GAUSS_ELNO "MED_GAUSS_ELNO"
276#define MED_IPOINT_ELNO MED_GAUSS_ELNO
278
279#define MED_NO_NAME ""
281#define MED_NO_MESHNAME ""
282#define MED_NO_MESH ""
283
284#define MED_NO_MESH_SUPPORT ""
285
286#define MED_NO_LOCALIZATION ""
287
288#define MED_NO_INTERPOLATION ""
289
290#define MED_NO_IPOINT_INTERNAL 1
291
292#define MED_NO_PROFILE ""
296
297#define MED_NO_GROUP ""
298
299#define MED_ALLENTITIES_PROFILE MED_NO_PROFILE
303#define MED_NO_PROFILE_INTERNAL "MED_NO_PROFILE_INTERNAL"
304#define MED_SAME_PROFILE_INTERNAL "MED_SAME_PROFILE_INTERNAL"
305
306#define MED_ALL_CONSTITUENT 0
310#define MED_UNDEF_CONSTITUENT -1
315#define MED_UNDEF_SIZE 0
316#define MED_NO_PROFILE_SIZE 0
317
327#define MED_ALL_DT -2
328#define MED_ALL_IT -2
329#define MED_NO_DT -1
330#define MED_NO_IT -1
331#define MED_UNDEF_DT 0
332
333#define MED_ATT_NOT_FILLED -1
334
335
336/* correspondance des types avec HDF 5 */
337
338typedef hsize_t med_size;
339typedef hssize_t med_ssize;
340typedef hid_t med_idt;
341typedef herr_t med_err;
342
343/* types elementaires */
344
345typedef double med_float;
346typedef double med_float64;
347typedef double med_double;
348typedef float med_float32;
349
350/*La ligne suivante est déterminée à l'étape de configuration*/
351typedef int med_int;
352typedef int32_t med_int32;
353typedef int64_t med_int64;
354
358#define MED_MAX_NAME_IN_PATH 5
359#define MED_MAX_DATAGROUPNAME_IN_PATH 2*MED_MAX_NAME_IN_PATH*MED_NAME_SIZE
360
361typedef struct {
362 /*PUBLIC IN attributes*/
363 med_class medclass;
364 med_int nname;
365 const char * name[MED_MAX_NAME_IN_PATH];
366 /*PRIVATE attributes*/
367 char _datagroupname[MED_MAX_DATAGROUPNAME_IN_PATH+1];
370#define INIT2X( x ) x, x,
371#define INIT4X( x ) x, x, x, x
372#define INIT10X( x ) x, x, x, x, x, x, x, x, x, x
373#define MED_MAX_FILTER_SPACES 4100
374#define MED_MAX_FILTER_SPACES_INIT {INIT4X(INIT10X(INIT10X(INIT10X(0)))), INIT10X(INIT10X(0)) }
376typedef enum {MED_FILTER_LIST = 1,
379
383typedef struct {
384 /*PRIVATE attributes*/
385 med_int nspaces;
388 med_filter_type filtertype;
389 /*PUBLIC IN attributes*/
390 med_int nentity;
391 med_int nvaluesperentity;
392 med_int nconstituentpervalue;
393 med_int constituentselect;
394 med_switch_mode switchmode;
395 med_switch_mode diskswitchmode;
396 /* Sélection par liste d'entités */
397 med_int filterarraysize;
398 const med_int * filterarray;
399 med_size* filterarray23v30;
400 med_int profilearraysize;/*PRIVATE attribute en IN et OUT positionnée dans MEDfilterCr*/
401 /* profil utilisé et mode de stockage en mémoire */
402 med_storage_mode storagemode;
403 char profilename[MED_NAME_SIZE+1];
404 /* Sélection par block d'entités */
405 med_size start ;
406 med_size stride ;
407 med_size count ;
408 med_size blocksize ;
409 med_size lastblocksize;
410} med_filter;
412
413#define MED_FILTER_INIT { 0, MED_MAX_FILTER_SPACES_INIT, MED_MAX_FILTER_SPACES_INIT, \
414 MED_FILTER_TYPE_UNDEF, 0, 0, 0, 0, \
415 MED_UNDEF_INTERLACE,MED_UNDEF_INTERLACE,MED_NO_FILTER_SIZE, \
416 NULL, NULL, MED_NO_PROFILE_SIZE,MED_UNDEF_PFLMODE,MED_NO_PROFILE,\
417 0, 0, 0, 0, 0 }
419#define MED_NO_FILTER NULL
420#define MED_NO_FILTER_SIZE 0
421#define MED_NO_PROFILE_F " "
422
426typedef struct {
427 med_int majeur; med_int mineur; med_int release;
429#define MED_FILE_VERSION_INIT {0, 0, 0};
430
434typedef struct {
435 void *app_image_ptr;
436 size_t app_image_size;
437 int ref_count;
438
439 void *fapl_image_ptr;
440 size_t fapl_image_size;
441 int fapl_ref_count;
442 void *vfd_image_ptr;
443 size_t vfd_image_size;
444 int vfd_ref_count;
445 med_access_mode flags;
447
448#define MED_MEMFILE_INIT {NULL, 0, 1, NULL, 0, 0, NULL, 0, 0, MED_ACC_RDONLY}
451#define AFF_MEMFILE \
452XSCRUTE(memfile->app_image_ptr);\
453ISCRUTE_long(memfile->app_image_size);\
454ISCRUTE_int(memfile->ref_count);\
455XSCRUTE(memfile->fapl_image_ptr);\
456ISCRUTE_long(memfile->fapl_image_size);\
457ISCRUTE_int(memfile->fapl_ref_count);\
458XSCRUTE(memfile->vfd_image_ptr);\
459ISCRUTE_long(memfile->vfd_image_size);\
460ISCRUTE_int(memfile->vfd_ref_count);\
461ISCRUTE_int(memfile->flags);
462
463
464#include "med_proto.h"
465
466/*En cas de modifications/ajouts de type d'entité/géométrique mettre à jour les itérateurs suivants : */
467
469extern MEDC_EXPORT const char * const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
479#define MED_GET_GEOMETRY_TYPE_IT_FROM_ENTITY_TYPE_IT MED_GET_CELL_GEOMETRY_TYPE_FROM_ENTITY_TYPE
481
482
483/* Itérateurs sur les types d'entité et types géométriques */
484/* TODO : Ajouter un module de documentation pour ces fonctions */
485extern MEDC_EXPORT int MEDgetEntityTypeIt (med_entity_type entitytype);
491/**/
492extern MEDC_EXPORT const char * const MEDgetGeometryTypeName (med_geometry_type geotype );
493extern MEDC_EXPORT const char * const MEDgetEntityTypeName (med_entity_type entitytype);
494extern MEDC_EXPORT const char * const MEDgetInterlacingModeName(med_interlacing_mode interlacing);
496/* Predefined names for struct elements */
497#define MED_PARTICLE_NAME "MED_PARTICLE"
498#define MED_BALL_NAME "MED_BALL"
499#define MED_BEAM_NAME "MED_BEAM"
501/* Predefined attributes names for struct elements */
502#define MED_PARTICLE_LABEL "MED_PARTICLE_LABEL"
503#define MED_BALL_DIAMETER "MED_BALL_DIAMETER"
504#define MED_BEAM_THICKNESS "MED_BEAM_THICKNESS"
505
506#ifdef __cplusplus
507}
508#endif
509
510#endif /* MED_H */
MEDC_EXPORT med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
#define MED_NAME_SIZE
#define MED_MAX_NAME_IN_PATH
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
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]
#define med_interlacing_mode
#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 med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]
#define MED_N_FACE_FIXED_GEO
#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 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]
#define MED_MAX_DATAGROUPNAME_IN_PATH
MEDC_EXPORT med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]
MEDC_EXPORT int MEDgetEntityTypeIt(med_entity_type entitytype)
MEDC_EXPORT int MEDgetNodeGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT int MEDgetEntityGeometryTypeIt(med_entity_type entitytype, med_geometry_type geotype)
MEDC_EXPORT int MEDgetFaceGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT int MEDgetEdgeGeometryTypeIt(med_geometry_type geotype)
MEDC_EXPORT const char *const MEDgetGeometryTypeName(med_geometry_type geotype)
MEDC_EXPORT const char *const MEDgetEntityTypeName(med_entity_type entitytype)
MEDC_EXPORT const char *const MEDgetInterlacingModeName(med_interlacing_mode interlacing)
MEDC_EXPORT int MEDgetCellGeometryTypeIt(med_geometry_type geotype)
#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.
Aggrégation de noms medfichier pour définir un chemin d'accès aux objets med de type class med_class.