Test_MEDmeshEntityInfo.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
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   /*TODO : Traduire   MED_TAILLE_NOM_ENTITE */
00043   char               _geotypename[MED_NAME_SIZE+1]="";
00044   med_geometry_type  _geotype=MED_NO_GEOTYPE;
00045  /* Ouverture en mode creation du fichier med */
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   /* TODO : Créer un itérateur sur les types d'entités*/
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 

Généré le Thu Oct 8 14:26:17 2015 pour MED fichier par  doxygen 1.6.1