# _MEDmeshEntityInfo236.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 <string.h>
    00022 #include <stdlib.h>
    00023 #include <med_outils.h>
    00024
    00025 #include <2.3.6/med23v30.h>
    00026 #include <2.3.6/med23v30_proto.h>
    00027 #include "2.3.6/med23v30_misc.h"
    00028
    00029 #include "med_versioned.h"
    00030
    00031 void
    00032 _MEDmeshEntityInfo236(int dummy, ...) {
    00033
    00034
    00035   med_access_mode       _MED_ACCESS_MODE;
    00036   med_int               _ret=-1;
    00037   med_idt               _meshid=0, _datagroup2=0,_datagroup3=0;
    00038   char                  _meshpath         [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]=MED_MAA;
    00039   char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
    00040   char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
    00041   int                   _num;
    00042
    00043
    00044   MED_VARGS_DECL(const, med_idt                   , , fid         );
    00045   MED_VARGS_DECL(const, char *              , const , meshname    );
    00046   MED_VARGS_DECL(const, med_int                   , , numdt       );
    00047   MED_VARGS_DECL(const, med_int                   , , numit       );
    00048   MED_VARGS_DECL(const, med_entity_type           , , entitype    );
    00049   MED_VARGS_DECL(const, int                       , , geotypeit   );
    00050   MED_VARGS_DECL(, char              *, const , geotypename       );
    00051   MED_VARGS_DECL(, med_geometry_type *, const , geotype           );
    00052   MED_VARGS_DECL(, med_err  *                ,, fret              );
    00053
    00054   va_list params;
    00055   va_start(params,dummy);
    00056
    00057   MED_VARGS_DEF(const, med_idt                   , , fid         );
    00058   MED_VARGS_DEF(const, char *              , const , meshname    );
    00059   MED_VARGS_DEF(const, med_int                   , , numdt       );
    00060   MED_VARGS_DEF(const, med_int                   , , numit       );
    00061   MED_VARGS_DEF(const, med_entity_type           , , entitype    );
    00062   MED_VARGS_DEF(const, int                       , , geotypeit   );
    00063   MED_VARGS_DEF(, char              *, const , geotypename       );
    00064   MED_VARGS_DEF(, med_geometry_type *, const , geotype           );
    00065   MED_VARGS_DEF(, med_err  *                ,, fret              );
    00066
    00067   _num        = geotypeit -1;
    00068
    00069   /*
    00070    * On inhibe le gestionnaire d'erreur HDF 5
    00071    */
    00072   _MEDmodeErreurVerrouiller();
    00073
    00074   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
    00075     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    00076     goto ERROR;
    00077   }
    00078
    00079   /*
    00080    * Ouverture du datagroup de niveau 1 <_meshpath>/<meshname>
    00081    */
    00082   NOFINALBLANK(meshname,ERROR);
    00083   strcat(_meshpath,meshname);
    00084   if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
    00085     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_meshpath);
    00086     ISCRUTE_id(_meshid);goto ERROR;
    00087   }
    00088
    00089   /*
    00090    *  Ouverture du datagroup de niveau 3 <entitype>
    00091    */
    00092   if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
    00093     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    00094     ISCRUTE_int(entitype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
    00095   }
    00096
    00097   if ((_datagroup2 = _MEDdatagroupOuvrir(_meshid,_datagroupname2)) < 0) {
    00098     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
    00099     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
    00100     goto ERROR;
    00101   }
    00102
    00103   if ( entitype == MED_NODE ) {
    00104     if ( _num ) {
    00105       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,"");
    00106       ISCRUTE_int(entitype);ISCRUTE_int(geotypeit);
    00107       goto ERROR;
    00108     } else {
    00109       *geotype = MED_UNDEF_GEOMETRY_TYPE;
    00110       *geotypename='\0';
    00111     }
    00112   } else {
    00113
    00114     /*
    00115      * On recupere le nom du type géométrique
    00116      */
    00117     if ( _MEDobjectGetName(_datagroup2, "." ,_num, _datagroupname3) < 0 ) {
    00118       MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_datagroupname3);
    00119       ISCRUTE_int(geotypeit);
    00120       goto ERROR;
    00121     }
    00122
    00123     strncpy(geotypename,_datagroupname3,MED_TAILLE_NOM_ENTITE+1);
    00124
    00125     *geotype =  MEDgetGeometryTypeFromName(geotypename);
    00126
    00127   }
    00128
    00129   _ret = 0;
    00130
    00131  ERROR:
    00132
    00133   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
    00134     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
    00135     ISCRUTE_id(_datagroup3);
    00136   }
    00137
    00138   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
    00139     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
    00140     ISCRUTE_id(_datagroup2);
    00141   }
    00142
    00143   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
    00144     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
    00145     ISCRUTE_id(_meshid);
    00146   }
    00147
    00148   *fret = _ret;
    00149   va_end(params);
    00150   return;
    00151 }
    00152