_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   va_list params;
00029   va_start(params,dummy);
00030 
00031   const med_idt                   fid         = va_arg(params,const med_idt                    );
00032   const char *              const meshname    = va_arg(params,const char *              const  );
00033   const med_int                   numdt       = va_arg(params,const med_int                    );
00034   const med_int                   numit       = va_arg(params,const med_int                    );
00035   const med_entity_type           entitype    = va_arg(params,const med_entity_type            );
00036   const int                       geotypeit   = va_arg(params,const int                        );
00037         char              * const geotypename = va_arg(params,      char              * const  );
00038         med_geometry_type * const geotype     = va_arg(params,      med_geometry_type * const  );
00039         med_err  *                fret        = va_arg(params, med_err *);
00040 
00041   med_access_mode       _MED_ACCESS_MODE;
00042   med_int               _ret=-1;
00043   med_idt               _meshid=0, _datagroup=0,_datagroup1=0,_datagroup2=0,_datagroup3=0;
00044   char                  _meshpath         [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]="";
00045   char                  _datagroupname1   [2*MED_MAX_PARA+1]="";
00046   char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
00047   char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
00048 
00049   med_sorting_type      _sortingtype=0;
00050   med_int               _intsortingtype=0;
00051 
00052   int                   _intgeotype = 0;
00053   int                   _num        = geotypeit -1;
00054   med_bool              _isasupportmesh = MED_FALSE;
00055   /*
00056    * On inhibe le gestionnaire d'erreur HDF 5
00057    */
00058   _MEDmodeErreurVerrouiller();
00059 
00060   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
00061     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00062     goto ERROR;
00063   }
00064 
00065 
00066   /*
00067    * Ouverture du datagroup de niveau 1 <_meshpath>/<meshname>
00068    */
00069   NOFINALBLANK(meshname,ERROR);
00070 
00071   if ((_meshid=_MEDmeshDatagroupOpen(fid,meshname,_meshpath,&_isasupportmesh)) < 0) {
00072     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00073     SSCRUTE(_meshpath); goto ERROR;
00074   }
00075 
00076   /*
00077    * Ouverture du datagroup de niveau 2 <numdt>.<numit>
00078    */
00079   if ( _MEDattrEntierLire(_meshid,MED_NOM_SRT,&_intsortingtype) < 0) {
00080     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00081     SSCRUTE(meshname);SSCRUTE(MED_NOM_SRT);ISCRUTE(_intsortingtype);goto ERROR;
00082   }
00083   _sortingtype = (med_sorting_type) (_intsortingtype);
00084 
00085   _MEDgetComputationStepName(_sortingtype,numdt,numit,_datagroupname1);
00086   if ( (_datagroup1 = _MEDdatagroupOuvrir(_meshid,_datagroupname1)) < 0 ) {
00087     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00088     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
00089     SSCRUTE(_datagroupname1);ISCRUTE_id(_datagroup1);goto ERROR;
00090   }
00091 
00092   /*
00093    *  Ouverture du datagroup de niveau 3 <entitype>
00094    */
00095   if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
00096     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00097     ISCRUTE_int(entitype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
00098   }
00099 
00100   if ((_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,_datagroupname2)) < 0) {
00101     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00102     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
00103     goto ERROR;
00104   }
00105 
00106   if ( entitype == MED_NODE ) {
00107     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,"");
00108     ISCRUTE_int(entitype);
00109     goto ERROR;
00110 
00111   } else {
00112 
00113     /*
00114      * On recupere le nom du type géométrique
00115      */
00116     if ( _MEDobjectGetName(_datagroup2, "." ,_num, _datagroupname3) < 0 ) {
00117       MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_datagroupname3);
00118       ISCRUTE_int(geotypeit);
00119       goto ERROR;
00120     }
00121 
00122     if ((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_datagroupname3)) < 0) {
00123       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00124       SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname1);
00125       SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);
00126       goto ERROR;
00127     }
00128 
00129     if ( _MEDattrEntierLire(_datagroup3,MED_NOM_GEO,&_intgeotype) < 0) {
00130       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00131       SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname1);
00132       SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_GEO);goto ERROR;
00133     }
00134 
00135     strncpy(geotypename,_datagroupname3,MED_TAILLE_NOM_ENTITE+1);
00136     *geotype = (med_geometry_type) _intgeotype;
00137 
00138   }
00139 
00140   _ret = 0;
00141 
00142  ERROR:
00143 
00144   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
00145     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
00146     ISCRUTE_id(_datagroup3);
00147   }
00148 
00149   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
00150     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00151     ISCRUTE_id(_datagroup2);
00152   }
00153 
00154   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
00155     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
00156     ISCRUTE_id(_datagroup1);
00157   }
00158 
00159   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00160     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00161     ISCRUTE_id(_meshid);
00162   }
00163 
00164   *fret = _ret;
00165   va_end(params);
00166   return;
00167 }
00168 

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1