MEDgaussInfo.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 
00020 #include <med.h>
00021 #include <med_config.h>
00022 #include <med_outils.h>
00023 
00024 #include <string.h>
00025 #include <stdlib.h>
00026 
00027 med_err
00028 MEDgaussInfo(med_idt fid, int indice, char * locname, med_geometrie_element * type_geo,
00029              med_int * ngauss )
00030 {
00031   int numero=0;
00032   med_idt locid=0;
00033   med_err ret=-1;
00034   char chemin[MED_TAILLE_GAUSS+MED_TAILLE_NOM+1]="";
00035   med_int typegeo;
00036 
00037   
00038 
00039 
00040   _MEDmodeErreurVerrouiller();
00041 if (MEDcheckVersion(fid) < 0) return -1;
00042 
00043 
00044   
00045 
00046  
00047   numero = indice-1;
00048   if ( _MEDobjetIdentifier(fid,MED_GAUSS,numero,locname) < 0)
00049     goto ERROR;
00050 
00051   
00052 
00053 
00054   strcpy(chemin,MED_GAUSS);
00055   strcat(chemin,locname);
00056   if ((locid = _MEDdatagroupOuvrir(fid,chemin)) < 0) {
00057     MESSAGE("Impossible d'ouvrir le datagroup : ");
00058     SSCRUTE(chemin); goto ERROR;
00059   }
00060 
00061   
00062   if (_MEDattrEntierLire(locid,MED_NOM_NBR,ngauss) < 0) {
00063     MESSAGE("Erreur à la lecture de l'attribut MED_NOM_NBR : ");
00064     ISCRUTE(*ngauss);goto ERROR;
00065   };
00066   
00067   
00068   if (_MEDattrEntierLire(locid,MED_NOM_GEO,&typegeo) < 0) {
00069     MESSAGE("Erreur à la lecture de l'attribut MED_NOM_GEO : ");
00070     ISCRUTE(*type_geo);goto ERROR;
00071   };
00072   *type_geo = ( med_geometrie_element ) typegeo;
00073 
00074   ret = 0;
00075 
00076  ERROR:
00077   if ( locid > 0 ) if (_MEDdatagroupFermer(locid) < 0)
00078     goto ERROR;
00079   
00080   return 0;
00081 }