# 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 - 2011  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 #if HDF5_VERSION < 10607
    00030
    00031
    00032 /*TODO : A enlever après MAJ complète api hdf5-1.8 */
    00033 #define HDF5_SELECT_BUG (const hsize_t **)
    00034 #else
    00035 #define HDF5_SELECT_BUG
    00036 #endif
    00037
    00038 #define MED_MAJOR_NUM 3
    00039 #define MED_MINOR_NUM 0
    00040 #define MED_RELEASE_NUM 4
    00041
    00042 #define MED_NUM_MAJEUR 3
    00043 #define MED_NUM_MINEUR 0
    00044 #define MED_NUM_RELEASE 4
    00045
    00046 #define MED_NULL       (void *) NULL
    00047 #define MED_MAX_PARA        20
    00048
    00052 #define MED_COMMENT_SIZE 200
    00053 #define MED_IDENT_SIZE 8
    00054 #define MED_NAME_SIZE 64
    00055 #define MED_SNAME_SIZE 16
    00056 #define MED_LNAME_SIZE 80
    00057
    00058 #define MED_SNAME_BLANK "                "
    00059 #define MED_NAME_BLANK  "                                                                "
    00060 /*                       0123456789012345678901234567890123456789012345678901234567890123*/
    00061
    00065 /* 2.3v3.0 ok*/
    00066 typedef enum {MED_FULL_INTERLACE,
    00067               MED_NO_INTERLACE,
    00068               MED_UNDEF_INTERLACE=-1
    00069         }  med_switch_mode;
    00070
    00071
    00075 /* 2.3v3.0 ok*/
    00076 typedef enum { MED_UNDEF_STMODE,
    00077                MED_GLOBAL_STMODE,
    00078                MED_COMPACT_STMODE,
    00079                MED_GLOBAL_PFLMODE=MED_GLOBAL_STMODE,
    00080                MED_COMPACT_PFLMODE=MED_COMPACT_STMODE,
    00081                MED_UNDEF_PFLMODE=MED_UNDEF_STMODE
    00082              }  med_storage_mode;
    00083
    00084
    00088 typedef enum {MED_ACC_RDONLY,
    00089               MED_ACC_RDWR,
    00090               MED_ACC_RDEXT,
    00091               MED_ACC_CREAT,
    00092               MED_ACC_UNDEF
    00093              } med_access_mode;
    00094
    00098 /*2.3v3.0 ok*/
    00099 typedef enum {MED_UNSTRUCTURED_MESH, MED_STRUCTURED_MESH, MED_UNDEF_MESH_TYPE=-1} med_mesh_type;
    00100
    00104 /* 2.3v3.0 ok*/
    00105 typedef enum {MED_CARTESIAN_GRID,
    00106               MED_POLAR_GRID,
    00107               MED_CURVILINEAR_GRID,
    00108               MED_UNDEF_GRID_TYPE=-1} med_grid_type;
    00109
    00110 /* 2.3v3.0 ok*/
    00111 typedef enum {MED_CELL, MED_DESCENDING_FACE, MED_DESCENDING_EDGE, MED_NODE,
    00112               MED_NODE_ELEMENT, MED_STRUCT_ELEMENT, MED_ALL_ENTITY_TYPE,
    00113               MED_UNDEF_ENTITY_TYPE=-1 } med_entity_type;
    00114 #define MED_N_ENTITY_TYPES 6
    00115
    00116 /* 2.3v3.0 ok*/
    00117 typedef enum {MED_COORDINATE, MED_CONNECTIVITY, MED_NAME, MED_NUMBER,  MED_FAMILY_NUMBER,
    00118         MED_COORDINATE_AXIS1, MED_COORDINATE_AXIS2, MED_COORDINATE_AXIS3,
    00119         MED_INDEX_FACE, MED_INDEX_NODE, MED_GLOBAL_NUMBER,
    00120         MED_VARIABLE_ATTRIBUTE, MED_COORDINATE_TRSF,MED_UNDEF_DATATYPE=-1} med_data_type;
    00121
    00123 /* 2.3v3.0 ok*/
    00124 typedef enum {MED_INTERNAL_FLOAT64=6, MED_INTERNAL_INT32=24,MED_INTERNAL_INT64=26,
    00125          MED_INTERNAL_INT=28, MED_INTERNAL_NAME=30, MED_INTERNAL_SNAME=32,
    00126          MED_INTERNAL_LNAME=34, MED_INTERNAL_IDENT=38, MED_INTERNAL_CHAR=40, MED_INTERNAL_UNDEF=0 } med_internal_type;
    00128 /*TODO: Réécrire les routines _MEDatt avec med_internal_type au lieu de med_field_type */
    00129
    00130 typedef enum {MED_FLOAT64=MED_INTERNAL_FLOAT64, MED_INT32=MED_INTERNAL_INT32,
    00131               MED_INT64=MED_INTERNAL_INT64, MED_INT=MED_INTERNAL_INT }  med_field_type;
    00132
    00133 typedef enum {MED_ATT_FLOAT64=MED_INTERNAL_FLOAT64,
    00134               MED_ATT_INT=MED_INTERNAL_INT,
    00135               MED_ATT_NAME=MED_INTERNAL_NAME,
    00136               MED_ATT_UNDEF=MED_INTERNAL_UNDEF }  med_attribute_type;
    00137
    00138 typedef med_field_type med_parameter_type;
    00139
    00140 #define MED_ATT_FLOAT64_ctype   med_float
    00141 #define MED_ATT_INT_ctype       med_int
    00142 #define MED_ATT_NAME_ctype      char
    00143 #define MED_ATT_UNDEF_ctype     unknown_ctype
    00145 #define MED_CTYPE(medatttype) medatttype##_ctype
    00146
    00147 /* 2.3v3.0 ok : med_type_donnee*/
    00148 typedef enum {MED_MESH, MED_FIELD, MED_LIBRARY, MED_FILE,
    00149         MED_MESH_SUPPORT,MED_ELSTRUCT, MED_FAMILY,MED_EQUIVALENCE, MED_GROUP, MED_JOINT,
    00150         MED_LOCALIZATION, MED_PROFILE, MED_FILTER, MED_INTERPOLATION, MED_NUMERICAL_DATA,
    00151         MED_LINK, MED_CLASS_UNDEF=-1, MED_CLASS_ALL=-2 } med_class;
    00152
    00153
    00154 typedef int med_geometry_type;
    00155
    00156 #define MED_POINT1 001
    00157
    00158 #define MED_SEG2 102
    00159 #define MED_SEG3 103
    00160 #define MED_SEG4 104
    00161 #define MED_TRIA3 203
    00162 #define MED_QUAD4 204
    00163 #define MED_TRIA6 206
    00164 #define MED_TRIA7 207
    00165 #define MED_QUAD8 208
    00166 #define MED_QUAD9 209
    00167
    00168 #define MED_TETRA4 304
    00169 #define MED_PYRA5 305
    00170 #define MED_PENTA6 306
    00171 #define MED_HEXA8 308
    00172 #define MED_TETRA10 310
    00173 #define MED_OCTA12 312
    00174 #define MED_PYRA13 313
    00175 #define MED_PENTA15 315
    00176 #define MED_HEXA20 320
    00177 #define MED_HEXA27 327
    00178
    00179 #define MED_POLYGON 400
    00180 #define MED_POLYHEDRON 500
    00181
    00182 #define MED_STRUCT_GEO_INTERNAL 600
    00183 #define MED_STRUCT_GEO_SUP_INTERNAL 700
    00184
    00185 #define MED_NONE 0
    00186 #define MED_NO_GEOTYPE MED_NONE
    00187 #define MED_UNDEF_GEOTYPE MED_NONE
    00188 #define MED_UNDEF_GEOMETRY_TYPE MED_NONE
    00189 #define MED_ALL_GEOTYPE -1
    00190 #define MED_GEO_ALL MED_ALL_GEOTYPE
    00191
    00192 #define MED_N_CELL_GEO            23
    00193 #define MED_N_CELL_FIXED_GEO      22
    00194 #define MED_N_CELL_GEO_FIXED_CON  20
    00196 #define MED_N_FACE_GEO               7
    00197 #define MED_N_FACE_FIXED_GEO         7
    00198 #define MED_N_FACE_GEO_FIXED_CON     6
    00199
    00200 #define MED_N_EDGE_TYPES             3
    00201 #define MED_N_EDGE_FIXED_GEO         3
    00202 #define MED_N_EDGE_GEO_FIXED_CON     3
    00203
    00204 #define MED_N_NODE_GEO               1
    00205 #define MED_N_NODE_FIXED_GEO         1
    00206 #define MED_N_NODE_GEO_FIXED_CON     1
    00207
    00208 /*2.3v3.0 ok*/
    00209   typedef enum {MED_NODAL, MED_DESCENDING, MED_UNDEF_CONNECTIVITY_MODE=-1, MED_NO_CMODE=-1} med_connectivity_mode;
    00210
    00211 /*2.3v3.0 ok*/
    00212 typedef enum {MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL, MED_UNDEF_AXIS_TYPE=-1} med_axis_type;
    00213
    00214 typedef enum {MED_FALSE, MED_TRUE} med_bool ;
    00215
    00216 #define MED_GAUSS_ELNO "MED_GAUSS_ELNO"
    00219 #define MED_IPOINT_ELNO MED_GAUSS_ELNO
    00220
    00221
    00222 #define MED_NO_NAME ""
    00224 #define MED_NO_MESHNAME ""
    00225 #define MED_NO_MESH     ""
    00227 #define MED_NO_MESH_SUPPORT ""
    00229 #define MED_NO_LOCALIZATION ""
    00231 #define MED_NO_INTERPOLATION ""
    00233 #define MED_NO_IPOINT_INTERNAL 1
    00235 #define MED_NO_PROFILE ""
    00239 #define MED_NO_GROUP ""
    00241 #define MED_ALLENTITIES_PROFILE MED_NO_PROFILE
    00245 #define MED_NO_PROFILE_INTERNAL   "MED_NO_PROFILE_INTERNAL"
    00246 #define MED_SAME_PROFILE_INTERNAL "MED_SAME_PROFILE_INTERNAL"
    00248 #define MED_ALL_CONSTITUENT 0
    00251 #define MED_UNDEF_SIZE 0
    00252 #define MED_NO_PROFILE_SIZE 0
    00254 typedef enum {MED_SORT_DTIT,MED_SORT_ITDT,MED_SORT_UNDEF=-1 } med_sorting_type;
    00257 #define MED_NO_DT -1
    00258 #define MED_NO_IT -1
    00259 #define MED_UNDEF_DT 0
    00261 #define MED_ATT_NOT_FILLED -1
    00262
    00263
    00264 /* correspondance des types avec HDF 5 */
    00265
    00266 typedef hsize_t        med_size;
    00267 typedef hssize_t       med_ssize;
    00268 typedef hid_t          med_idt;
    00269 typedef herr_t         med_err;
    00271 /* types elementaires */
    00272
    00273 typedef double         med_float;
    00274 /*La ligne suivante est déterminée à l'étape de configuration*/
    00275 typedef int  med_int;
    00277 #define MED_MAX_FILTER_SPACES 80
    00278
    00281 typedef struct {
    00282   /*PRIVATE attributes*/
    00283   med_int          nbofspaces;
    00284   med_idt          memspace[MED_MAX_FILTER_SPACES];
    00285   med_idt          diskspace[MED_MAX_FILTER_SPACES];
    00286   /*PUBLIC IN attributes*/
    00287   med_int          nbofentity;
    00288   med_int          nbofvaluesperentity;
    00289   med_int          nbofconstituentpervalue;
    00290   med_int          constituentselect;
    00291   med_switch_mode  switchmode;
    00292   med_int          filterarraysize;
    00293   med_size*        filterarray23v30;
    00294   med_int          profilearraysize;/*PRIVATE attribute en IN et OUT positionnée dans MEDfilterCr*/
    00295   med_storage_mode storagemode;
    00296   char             profilename[MED_NAME_SIZE+1];
    00297 } med_filter;
    00298
    00299 #define MED_MAX_FILTER_SPACES_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\
    00300                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\
    00301                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\
    00302                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    00303
    00304 #define MED_FILTER_INIT { 0, MED_MAX_FILTER_SPACES_INIT, MED_MAX_FILTER_SPACES_INIT ,0,0,0,0,\
    00305                           MED_UNDEF_INTERLACE,MED_NO_FILTER_SIZE, NULL , \
    00306                           MED_NO_PROFILE_SIZE,MED_UNDEF_PFLMODE,MED_NO_PROFILE }
    00307
    00308 #define MED_NO_FILTER NULL
    00309 #define MED_NO_FILTER_SIZE 0
    00310 #define MED_NO_PROFILE_F "                                "
    00311
    00312 #include "med_proto.h"
    00313
    00314 extern MEDC_EXPORT med_entity_type MED_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2];
    00315 extern MEDC_EXPORT const char * const MED_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
    00316 extern MEDC_EXPORT med_geometry_type MED_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2];
    00317 extern MEDC_EXPORT const char * const MED_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2];
    00318 extern MEDC_EXPORT med_geometry_type MED_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2];
    00319 extern MEDC_EXPORT const char * const MED_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2];
    00320 extern MEDC_EXPORT med_geometry_type MED_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2];
    00321 extern MEDC_EXPORT const char * MED_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2];
    00322 extern MEDC_EXPORT med_geometry_type MED_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2];
    00323 extern MEDC_EXPORT const char * MED_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2];
    00324
    00325 /*      Predefined names for struct elements            */
    00326 #define MED_PARTICLE_NAME   "MED_PARTICLE"
    00327 #define MED_BALL_NAME       "MED_BALL"
    00328 #define MED_BEAM_NAME       "MED_BEAM"
    00329
    00330 /*      Predefined attributes names for struct elements */
    00331 #define MED_PARTICLE_LABEL  "MED_PARTICLE_LABEL"
    00332 #define MED_BALL_DIAMETER   "MED_BALL_DIAMETER"
    00333 #define MED_BEAM_THICKNESS  "MED_BEAM_THICKNESS"
    00334
    00335 #ifdef __cplusplus
    00336 }
    00337 #endif
    00338
    00339 #endif  /* MED_H */