# MEDgaussInfo.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2011  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
    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    * On inhibe le gestionnaire d'erreur
    00039    */
    00040   _MEDmodeErreurVerrouiller();
    00041 if (MEDcheckVersion(fid) < 0) return -1;
    00042
    00043
    00044   /*
    00045    * On recupere le nom du groupe de rang "indice"
    00046    */
    00047   numero = indice-1;
    00048   if ( _MEDobjetIdentifier(fid,MED_GAUSS,numero,locname) < 0)
    00049     goto ERROR;
    00050
    00051   /*
    00052    * On va chercher l'attribut ngauss
    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   /* Lecture de  <ngauss> */
    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   /* Lecture <type_geo> sous forme d'attribut */
    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 }