# med.h

Aller à la documentation de ce fichier.

    00001 /* -*- mode:C; coding:utf-8 -*- */
    00002 /*  This file is part of MED.
    00003  *
    00004  *  COPYRIGHT (C) 1999 - 2012  EDF R&D, CEA/DEN
    00005  *  MED is free software: you can redistribute it and/or modify
    00006  *  it under the terms of the GNU Lesser General Public License as published by
    00007  *  the Free Software Foundation, either version 3 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  MED is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Lesser General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Lesser General Public License
    00016  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
    00017  */
    00018
    00019 #ifndef MED_H
    00020 #define MED_H
    00021
    00022 #include <hdf5.h>
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00028 #define HDF5_VERSION (H5_VERS_MAJOR * 10000 + H5_VERS_MINOR * 100  + H5_VERS_RELEASE )
    00029
    00030 #if HDF5_VERSION < 10607
    00031 /*TODO : A enlever après MAJ complète api hdf5-1.8 */
    00032 #define HDF5_SELECT_BUG (const hsize_t **)
    00033 #else
    00034 #define HDF5_SELECT_BUG
    00035 #endif
    00036
    00037 /*Le symbole H5F_LIBVER_18 n'existe pas dans hdf5-1.8.4 (uniquement à partir de la version 1.8.6)
    00038   Pour rester dans le modèle interne hdf introduit en 1.8 quelque soit les futurs modèles internes hdf
    00039   on impose le modèle 1.8 et non le LATEST.
    00040   La valeur utilisée est celle définie dans les  version >= 1.8.6 (cf H5Fpublic.h) */
    00041 #ifndef H5F_LIBVER_18
    00042
    00043 #define H5F_LIBVER_18 1
    00044 #endif
    00045
    00046 #define MED_MAJOR_NUM 3
    00047 #define MED_MINOR_NUM 0
    00048 #define MED_RELEASE_NUM 6
    00049
    00050 #define MED_NUM_MAJEUR 3
    00051 #define MED_NUM_MINEUR 0
    00052 #define MED_NUM_RELEASE 6
    00053
    00054 #define MED_HAVE_MPI
    00055
    00056 #define MED_NULL       (void *) NULL
    00057 #define MED_MAX_PARA        20
    00058
    00062 #define MED_COMMENT_SIZE 200
    00063 #define MED_IDENT_SIZE 8
    00064 #define MED_NAME_SIZE 64
    00065 #define MED_SNAME_SIZE 16
    00066 #define MED_LNAME_SIZE 80
    00067
    00068 #define MED_SNAME_BLANK "                "
    00069 #define MED_NAME_BLANK  "                                                                "
    00070 /*                       0123456789012345678901234567890123456789012345678901234567890123*/
    00071
    00075 /* 2.3v3.0 ok*/
    00076 typedef enum {MED_FULL_INTERLACE,
    00077               MED_NO_INTERLACE,
    00078               MED_UNDEF_INTERLACE=-1
    00079         }  med_switch_mode;
    00080
    00081
    00085 /* 2.3v3.0 ok*/
    00086 typedef enum { MED_UNDEF_STMODE,
    00087                MED_GLOBAL_STMODE,
    00088                MED_COMPACT_STMODE,
    00089                MED_GLOBAL_PFLMODE=MED_GLOBAL_STMODE,
    00090                MED_COMPACT_PFLMODE=MED_COMPACT_STMODE,
    00091                MED_UNDEF_PFLMODE=MED_UNDEF_STMODE
    00092              }  med_storage_mode;
    00093
    00094
    00098 typedef enum {MED_ACC_RDONLY,
    00099               MED_ACC_RDWR,
    00100               MED_ACC_RDEXT,
    00101               MED_ACC_CREAT,
    00102               MED_ACC_UNDEF
    00103              } med_access_mode;
    00104
    00108 /*2.3v3.0 ok*/
    00109 typedef enum {MED_UNSTRUCTURED_MESH, MED_STRUCTURED_MESH, MED_UNDEF_MESH_TYPE=-1} med_mesh_type;
    00110
    00114 /* 2.3v3.0 ok*/
    00115 typedef enum {MED_CARTESIAN_GRID,
    00116               MED_POLAR_GRID,
    00117               MED_CURVILINEAR_GRID,
    00118               MED_UNDEF_GRID_TYPE=-1} med_grid_type;
    00119
    00120 /* 2.3v3.0 ok*/
    00121 typedef enum {MED_CELL, MED_DESCENDING_FACE, MED_DESCENDING_EDGE, MED_NODE,
    00122               MED_NODE_ELEMENT, MED_STRUCT_ELEMENT, MED_ALL_ENTITY_TYPE,
    00123               MED_UNDEF_ENTITY_TYPE=-1 } med_entity_type;
    00124 #define MED_N_ENTITY_TYPES 6
    00125
    00126 /* 2.3v3.0 ok*/
    00127 typedef enum {MED_COORDINATE, MED_CONNECTIVITY, MED_NAME, MED_NUMBER,  MED_FAMILY_NUMBER,
    00128         MED_COORDINATE_AXIS1, MED_COORDINATE_AXIS2, MED_COORDINATE_AXIS3,
    00129         MED_INDEX_FACE, MED_INDEX_NODE, MED_GLOBAL_NUMBER,
    00130         MED_VARIABLE_ATTRIBUTE, MED_COORDINATE_TRSF,MED_UNDEF_DATATYPE=-1} med_data_type;
    00131
    00132 /* 2.3v3.0 ok*/
    00134 typedef enum {MED_INTERNAL_FLOAT64=6, MED_INTERNAL_INT32=24,MED_INTERNAL_INT64=26,
    00135          MED_INTERNAL_INT=28, MED_INTERNAL_NAME=30, MED_INTERNAL_SNAME=32,
    00136          MED_INTERNAL_LNAME=34, MED_INTERNAL_IDENT=38, MED_INTERNAL_CHAR=40, MED_INTERNAL_UNDEF=0 } med_internal_type;
    00138 /*TODO: Réécrire les routines _MEDatt avec med_internal_type au lieu de med_field_type */
    00139
    00140 typedef enum {MED_FLOAT64=MED_INTERNAL_FLOAT64, MED_INT32=MED_INTERNAL_INT32,
    00141               MED_INT64=MED_INTERNAL_INT64, MED_INT=MED_INTERNAL_INT }  med_field_type;
    00142
    00143 typedef enum {MED_ATT_FLOAT64=MED_INTERNAL_FLOAT64,
    00144               MED_ATT_INT=MED_INTERNAL_INT,
    00145               MED_ATT_NAME=MED_INTERNAL_NAME,
    00146               MED_ATT_UNDEF=MED_INTERNAL_UNDEF }  med_attribute_type;
    00147
    00148 typedef med_field_type med_parameter_type;
    00149
    00150 #define MED_ATT_FLOAT64_ctype   med_float
    00151 #define MED_ATT_INT_ctype       med_int
    00152 #define MED_ATT_NAME_ctype      char
    00153 #define MED_ATT_UNDEF_ctype     unknown_ctype
    00155 #define MED_CTYPE(medatttype) medatttype##_ctype
    00156
    00157 /* 2.3v3.0 ok : med_type_donnee*/
    00158 typedef enum {MED_MESH, MED_FIELD, MED_LIBRARY, MED_FILE,
    00159         MED_MESH_SUPPORT,MED_ELSTRUCT, MED_FAMILY,MED_EQUIVALENCE, MED_GROUP, MED_JOINT,
    00160         MED_LOCALIZATION, MED_PROFILE, MED_FILTER, MED_INTERPOLATION, MED_NUMERICAL_DATA,
    00161         MED_LINK, MED_CLASS_UNDEF=-1, MED_CLASS_ALL=-2 } med_class;
    00162
    00163
    00164 typedef int med_geometry_type;
    00165
    00166 #define MED_POINT1 001
    00167
    00168 #define MED_SEG2 102
    00169 #define MED_SEG3 103
    00170 #define MED_SEG4 104
    00171 #define MED_TRIA3 203
    00172 #define MED_QUAD4 204
    00173 #define MED_TRIA6 206
    00174 #define MED_TRIA7 207
    00175 #define MED_QUAD8 208
    00176 #define MED_QUAD9 209
    00177
    00178 #define MED_TETRA4 304
    00179 #define MED_PYRA5 305
    00180 #define MED_PENTA6 306
    00181 #define MED_HEXA8 308
    00182 #define MED_TETRA10 310
    00183 #define MED_OCTA12 312
    00184 #define MED_PYRA13 313
    00185 #define MED_PENTA15 315
    00186 #define MED_HEXA20 320
    00187 #define MED_HEXA27 327
    00188
    00189 #define MED_POLYGON 400
    00190 #define MED_POLYHEDRON 500
    00191
    00192 #define MED_STRUCT_GEO_INTERNAL 600
    00193 #define MED_STRUCT_GEO_SUP_INTERNAL 700
    00194
    00195 #define MED_NONE 0
    00196 #define MED_NO_GEOTYPE MED_NONE
    00197 #define MED_UNDEF_GEOTYPE MED_NONE
    00198 #define MED_UNDEF_GEOMETRY_TYPE MED_NONE
    00199 #define MED_ALL_GEOTYPE -1
    00200 #define MED_GEO_ALL MED_ALL_GEOTYPE
    00201
    00202 #define MED_N_CELL_GEO            23
    00203 #define MED_N_CELL_FIXED_GEO      22
    00204 #define MED_N_CELL_GEO_FIXED_CON  20
    00206 #define MED_N_FACE_GEO               7
    00207 #define MED_N_FACE_FIXED_GEO         7
    00208 #define MED_N_FACE_GEO_FIXED_CON     6
    00209
    00210 #define MED_N_EDGE_TYPES             3
    00211 #define MED_N_EDGE_FIXED_GEO         3
    00212 #define MED_N_EDGE_GEO_FIXED_CON     3
    00213
    00214 #define MED_N_NODE_GEO               1
    00215 #define MED_N_NODE_FIXED_GEO         1
    00216 #define MED_N_NODE_GEO_FIXED_CON     1
    00217
    00218 /*2.3v3.0 ok*/
    00219   typedef enum {MED_NODAL, MED_DESCENDING, MED_UNDEF_CONNECTIVITY_MODE=-1, MED_NO_CMODE=-1} med_connectivity_mode;
    00220
    00221 /*2.3v3.0 ok*/
    00222 typedef enum {MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL, MED_UNDEF_AXIS_TYPE=-1} med_axis_type;
    00223
    00224 typedef enum {MED_FALSE, MED_TRUE} med_bool ;
    00225
    00226 #define MED_GAUSS_ELNO "MED_GAUSS_ELNO"
    00229 #define MED_IPOINT_ELNO MED_GAUSS_ELNO
    00230
    00231
    00232 #define MED_NO_NAME ""
    00234 #define MED_NO_MESHNAME ""
    00235 #define MED_NO_MESH     ""
    00237 #define MED_NO_MESH_SUPPORT ""
    00239 #define MED_NO_LOCALIZATION ""
    00241 #define MED_NO_INTERPOLATION ""
    00243 #define MED_NO_IPOINT_INTERNAL 1
    00245 #define MED_NO_PROFILE ""
    00249 #define MED_NO_GROUP ""
    00251 #define MED_ALLENTITIES_PROFILE MED_NO_PROFILE
    00255 #define MED_NO_PROFILE_INTERNAL   "MED_NO_PROFILE_INTERNAL"
    00256 #define MED_SAME_PROFILE_INTERNAL "MED_SAME_PROFILE_INTERNAL"
    00258 #define MED_ALL_CONSTITUENT 0
    00261 #define MED_UNDEF_SIZE 0
    00262 #define MED_NO_PROFILE_SIZE 0
    00264 typedef enum {MED_SORT_DTIT,MED_SORT_ITDT,MED_SORT_UNDEF=-1 } med_sorting_type;
    00267 #define MED_NO_DT -1
    00268 #define MED_NO_IT -1
    00269 #define MED_UNDEF_DT 0
    00271 #define MED_ATT_NOT_FILLED -1
    00272
    00273
    00274 /* correspondance des types avec HDF 5 */
    00275
    00276 typedef hsize_t        med_size;
    00277 typedef hssize_t       med_ssize;
    00278 typedef hid_t          med_idt;
    00279 typedef herr_t         med_err;
    00281 /* types elementaires */
    00282
    00283 typedef double         med_float;
    00284 /*La ligne suivante est déterminée à l'étape de configuration*/
    00285 typedef int  med_int;
    00287 #define INIT4X( x ) x, x, x, x
    00288 #define INIT10X( x ) x, x, x, x, x, x, x, x, x, x
    00289 #define MED_MAX_FILTER_SPACES 4100
    00290 #define MED_MAX_FILTER_SPACES_INIT {INIT4X(INIT10X(INIT10X(INIT10X(0)))), INIT10X(INIT10X(0)) }
    00291
    00295 typedef struct {
    00296   /*PRIVATE attributes*/
    00297   med_int          nspaces;
    00298   med_idt          memspace[MED_MAX_FILTER_SPACES];
    00299   med_idt          diskspace[MED_MAX_FILTER_SPACES];
    00300   /*PUBLIC IN attributes*/
    00301   med_int          nentity;
    00302   med_int          nvaluesperentity;
    00303   med_int          nconstituentpervalue;
    00304   med_int          constituentselect;
    00305   med_switch_mode  switchmode;
    00306   med_int          filterarraysize;
    00307   med_size*        filterarray23v30;
    00308   med_int          profilearraysize;/*PRIVATE attribute en IN et OUT positionnée dans MEDfilterCr*/
    00309   med_storage_mode storagemode;
    00310   char             profilename[MED_NAME_SIZE+1];
    00311 } med_filter;
    00312
    00313
    00314 #define MED_FILTER_INIT { 0, MED_MAX_FILTER_SPACES_INIT, MED_MAX_FILTER_SPACES_INIT ,0,0,0,0,\
    00315                           MED_UNDEF_INTERLACE,MED_NO_FILTER_SIZE, NULL , \
    00316                           MED_NO_PROFILE_SIZE,MED_UNDEF_PFLMODE,MED_NO_PROFILE }
    00317
    00318 #define MED_NO_FILTER NULL
    00319 #define MED_NO_FILTER_SIZE 0
    00320 #define MED_NO_PROFILE_F "                                "
    00321
    00325 typedef struct {
    00326   med_int majeur; med_int mineur; med_int release;
    00327 } med_file_version;
    00328 #define MED_FILE_VERSION_INIT {0, 0, 0};
    00329
    00330
    00331 #include "med_proto.h"
    00332
    00333 extern MEDC_EXPORT med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2];
    00334 extern MEDC_EXPORT const char * const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
    00335 extern MEDC_EXPORT med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2];
    00336 extern MEDC_EXPORT const char * const MED_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2];
    00337 extern MEDC_EXPORT med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2];
    00338 extern MEDC_EXPORT const char * const MED_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2];
    00339 extern MEDC_EXPORT med_geometry_type MED_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2];
    00340 extern MEDC_EXPORT const char * MED_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2];
    00341 extern MEDC_EXPORT med_geometry_type MED_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2];
    00342 extern MEDC_EXPORT const char * MED_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2];
    00343
    00344 /*      Predefined names for struct elements            */
    00345 #define MED_PARTICLE_NAME   "MED_PARTICLE"
    00346 #define MED_BALL_NAME       "MED_BALL"
    00347 #define MED_BEAM_NAME       "MED_BEAM"
    00348
    00349 /*      Predefined attributes names for struct elements */
    00350 #define MED_PARTICLE_LABEL  "MED_PARTICLE_LABEL"
    00351 #define MED_BALL_DIAMETER   "MED_BALL_DIAMETER"
    00352 #define MED_BEAM_THICKNESS  "MED_BEAM_THICKNESS"
    00353
    00354 #ifdef __cplusplus
    00355 }
    00356 #endif
    00357
    00358 #endif  /* MED_H */