_MEDmeshEntityInfo30.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 void
00026 _MEDmeshEntityInfo30(int dummy, ...) {
00027 
00028 
00029   med_access_mode       _MED_ACCESS_MODE;
00030   med_int               _ret=-1;
00031   med_idt               _meshid=0, _datagroup=0,_datagroup1=0,_datagroup2=0,_datagroup3=0;
00032   char                  _meshpath         [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]="";
00033   char                  _datagroupname1   [2*MED_MAX_PARA+1]="";
00034   char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
00035   char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
00036 
00037   med_sorting_type      _sortingtype=0;
00038   med_int               _intsortingtype=0;
00039 
00040   int                   _intgeotype = 0;
00041   int                   _num;
00042   med_bool              _isasupportmesh = MED_FALSE;
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   /*
00081    * Ouverture du datagroup de niveau 1 <_meshpath>/<meshname>
00082    */
00083   NOFINALBLANK(meshname,ERROR);
00084 
00085   if ((_meshid=_MEDmeshDatagroupOpen(fid,meshname,_meshpath,&_isasupportmesh)) < 0) {
00086     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00087     SSCRUTE(_meshpath); goto ERROR;
00088   }
00089 
00090   /*
00091    * Ouverture du datagroup de niveau 2 <numdt>.<numit>
00092    */
00093   if ( _MEDattrEntierLire(_meshid,MED_NOM_SRT,&_intsortingtype) < 0) {
00094     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00095     SSCRUTE(meshname);SSCRUTE(MED_NOM_SRT);ISCRUTE(_intsortingtype);goto ERROR;
00096   }
00097   _sortingtype = (med_sorting_type) (_intsortingtype);
00098 
00099   _MEDgetComputationStepName(_sortingtype,numdt,numit,_datagroupname1);
00100   if ( (_datagroup1 = _MEDdatagroupOuvrir(_meshid,_datagroupname1)) < 0 ) {
00101     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00102     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
00103     SSCRUTE(_datagroupname1);ISCRUTE_id(_datagroup1);goto ERROR;
00104   }
00105 
00106   /*
00107    *  Ouverture du datagroup de niveau 3 <entitype>
00108    */
00109   if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
00110     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00111     ISCRUTE_int(entitype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
00112   }
00113 
00114   if ((_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,_datagroupname2)) < 0) {
00115     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00116     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
00117     goto ERROR;
00118   }
00119 
00120   if ( entitype == MED_NODE ) {
00121     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,"");
00122     ISCRUTE_int(entitype);
00123     goto ERROR;
00124 
00125   } else {
00126 
00127     /*
00128      * On recupere le nom du type géométrique
00129      */
00130     if ( _MEDobjectGetName(_datagroup2, "." ,_num, _datagroupname3) < 0 ) {
00131       MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_datagroupname3);
00132       ISCRUTE_int(geotypeit);
00133       goto ERROR;
00134     }
00135 
00136     if ((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_datagroupname3)) < 0) {
00137       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00138       SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname1);
00139       SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);
00140       goto ERROR;
00141     }
00142 
00143     if ( _MEDattrEntierLire(_datagroup3,MED_NOM_GEO,&_intgeotype) < 0) {
00144       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00145       SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname1);
00146       SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_GEO);goto ERROR;
00147     }
00148 
00149     strncpy(geotypename,_datagroupname3,MED_TAILLE_NOM_ENTITE+1);
00150     *geotype = (med_geometry_type) _intgeotype;
00151 
00152   }
00153 
00154   _ret = 0;
00155 
00156  ERROR:
00157 
00158   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
00159     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
00160     ISCRUTE_id(_datagroup3);
00161   }
00162 
00163   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
00164     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00165     ISCRUTE_id(_datagroup2);
00166   }
00167 
00168   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
00169     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
00170     ISCRUTE_id(_datagroup1);
00171   }
00172 
00173   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00174     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00175     ISCRUTE_id(_meshid);
00176   }
00177 
00178   *fret = _ret;
00179   va_end(params);
00180   return;
00181 }
00182 

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1