# MEDequivLire.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 #include <med.h>
    00020 #include <med_config.h>
    00021 #include <med_outils.h>
    00022
    00023 #include <string.h>
    00024 #include <stdlib.h>
    00025
    00026 extern int mode_interlace;
    00027
    00028 med_err
    00029 MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
    00030             med_entite_maillage type_ent,med_geometrie_element typ_geo)
    00031 {
    00032   med_idt eqid, datagroup;
    00033   med_err ret;
    00034   char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
    00035   char nomdatagroup[MED_TAILLE_NOM+1];
    00036   char tmp[MED_TAILLE_NOM_ENTITE+1];
    00037   med_entite_maillage _type_ent=type_ent;
    00038
    00039   if ( type_ent == MED_NOEUD_MAILLE ) _type_ent=MED_NOEUD ;
    00040
    00041   if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
    00042       typ_geo == MED_HEXA8  || typ_geo == MED_HEXA20  ||
    00043       typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
    00044       typ_geo == MED_PYRA5  || typ_geo == MED_PYRA13)
    00045     return -1;
    00046
    00047   /*
    00048    * On inhibe le gestionnaire d'erreur HDF 5
    00049    */
    00050   _MEDmodeErreurVerrouiller();
    00051 if (MEDcheckVersion(fid) < 0) return -1;
    00052
    00053
    00054   /*
    00055    * Si le Data Group de "eq" n'existe pas => erreur
    00056    */
    00057   strcpy(chemin,MED_MAA);
    00058   strcat(chemin,maa);
    00059   strcat(chemin,MED_EQS);
    00060   strcat(chemin,eq);
    00061   if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
    00062     return -1;
    00063
    00064   /*
    00065    * Lecture de l'equivalence
    00066    */
    00067   if ((ret = _MEDnomEntite(nomdatagroup,_type_ent)) < 0)
    00068     return -1;
    00069   if ((_type_ent != MED_NOEUD))
    00070     {
    00071       if ((ret = _MEDnomGeometrie30(tmp,typ_geo)) < 0)
    00072         return -1;
    00073       strcat(nomdatagroup,".");
    00074       strcat(nomdatagroup,tmp);
    00075     }
    00076   if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
    00077     return -1;
    00078 #if defined(HAVE_F77INT64)
    00079   if ((ret =  _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT64,
    00080                                  MED_NO_INTERLACE,1,MED_ALL,
    00081                                  MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
    00082                                  (unsigned char *) corr)) < 0)
    00083     return -1;
    00084 #else
    00085   if ((ret =  _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT32,
    00086                                  MED_NO_INTERLACE,1,MED_ALL,
    00087                                  MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
    00088                                  (unsigned char *) corr)) < 0)
    00089     return -1;
    00090 #endif
    00091
    00092   /*
    00093    * On ferme tout
    00094    */
    00095   if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
    00096     return -1;
    00097   if ((ret = _MEDdatagroupFermer(eqid)) < 0)
    00098     return -1;
    00099
    00100   return 0;
    00101 }
    00102
    00103
    00104
    00105