Test_MEDstructElementInfoByName.c
Aller à la documentation de ce fichier.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #define MESGERR 1
00021 #include <med_utils.h>
00022 #include <string.h>
00023
00024 #ifdef DEF_LECT_ECR
00025 #define MODE_ACCES MED_ACC_RDWR
00026 #elif DEF_LECT_AJOUT
00027 #define MODE_ACCES MED_ACC_RDEXT
00028 #else
00029 #define MODE_ACCES MED_ACC_CREAT
00030 #endif
00031
00032 int main (int argc, char **argv)
00033
00034 {
00035 med_err _ret=0;
00036 med_idt _fid=0;
00037 med_geometry_type _geotype=MED_NONE;
00038
00039 char _elementname1[MED_NAME_SIZE+1]="MED_PARTICULE";
00040 med_int _elementdim1=3;
00041 char _supportmeshname1[MED_NAME_SIZE+1]="";
00042 med_entity_type _entitytype1=MED_UNDEF_ENTITY_TYPE;
00043 med_int _nnode1=0;
00044 med_int _ncell1=0;
00045 med_int _geocelltype1=MED_NONE;
00046 med_int _nconstantatribute1=0;
00047 med_bool _anyprofile1=0;
00048 med_int _nvariableattribute1=0;
00049
00050
00051
00052 _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
00053 if (_fid < 0) {
00054 MESSAGE("Erreur à la lecture du fichier current.med");
00055 return -1;
00056 }
00057
00058 if (
00059 MEDstructElementInfoByName(_fid,
00060 _elementname1,
00061 &_geotype,
00062 &_elementdim1,
00063 _supportmeshname1,
00064 &_entitytype1,
00065 &_nnode1,
00066 &_ncell1,
00067 &_geocelltype1,
00068 &_nconstantatribute1,
00069 &_anyprofile1,
00070 &_nvariableattribute1
00071 )
00072 ) return -1;
00073
00074 fprintf(stdout,"Elément de structure |%s| de type géométrique n° %d et de dimension %d\n",_elementname1,_geotype,_elementdim1);
00075 if ( strlen(_supportmeshname1) ) {
00076 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname1);
00077 if (_ncell1)
00078 fprintf(stdout," avec %d mailles de type %d et ",_ncell1,_geocelltype1);
00079 if (_nnode1)
00080 fprintf(stdout," avec %d noeuds\n",_nnode1);
00081 else {
00082 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
00083 }
00084 } else
00085 fprintf(stdout," avec support implicite sur noeud\n");
00086
00087
00088
00089 if (MEDfileClose(_fid) < 0) {
00090 MESSAGE("ERROR : file closing");
00091 return -1;
00092 }
00093
00094 return _ret;
00095
00096
00097 }
00098