Test_MEDmeshEntityInfo.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   int      _i=0;
00036   med_err  _ret=-1;
00037   med_idt  _fid=0;
00038   med_int  _ngeotype=0;
00039 
00040   const char         _meshname[MED_NAME_SIZE+1]="maa1";
00041   med_bool           _chgt=MED_FALSE,_trsf=MED_FALSE;
00042   
00043   char               _geotypename[MED_NAME_SIZE+1]="";
00044   med_geometry_type  _geotype=MED_NO_GEOTYPE;
00045  
00046   _fid = MEDfileOpen("Test_MEDmeshStructElementVarAttWr.med",MED_ACC_RDONLY);
00047   if (_fid < 0) {
00048     MESSAGE("Erreur a la creation du fichier current.med");
00049     return -1;
00050   }
00051 
00052   
00053   if ( (_ngeotype = MEDmeshnEntity(_fid,_meshname,MED_NO_DT,MED_NO_IT,
00054                                    MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_GLOBAL_PFLMODE,
00055                                    &_chgt,&_trsf) ) < 0 ) {
00056     MESSAGE ("Erreur à la lecture du nombre de type géométrique pour le type d'entités MED_STRUCT_ELEMENT");
00057     goto ERROR;
00058   }
00059 
00060   ISCRUTE(_ngeotype);
00061   for (_i=0; _i < _ngeotype; _i++) {
00062 
00063     if ( MEDmeshEntityInfo(_fid,
00064                            _meshname,
00065                            MED_NO_DT,MED_NO_IT,
00066                            MED_STRUCT_ELEMENT,
00067                            _i+1,
00068                            _geotypename,&_geotype
00069                            ) <0 ){
00070       MESSAGE ("Erreur à la demande d'informations pour le type d'entités MED_STRUCT_ELEMENT");
00071       ISCRUTE_int(_i);
00072       goto ERROR;
00073     }
00074     SSCRUTE(_geotypename);
00075     ISCRUTE(_geotype);
00076   }
00077 
00078   _ret = 0;
00079  ERROR:
00080   if (MEDfileClose(_fid) < 0) {
00081     MESSAGE("ERROR : file closing");
00082     return -1;
00083   }
00084 
00085   return _ret;
00086 
00087 }
00088