_MEDfieldComputingStepMeshInfo30.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 #include <string.h>
00023 
00024 void
00025 _MEDfieldComputingStepMeshInfo30(int dummy,...)
00026 {
00027 
00028 
00029   med_err _ret=-1;
00030   med_idt _gid=0,_datagroup1=0;
00031   int     _num;
00032   char    _datagroupname1[2*MED_MAX_PARA+1]="";
00033   char    _path          [(MED_TAILLE_CHA+MED_NAME_SIZE+1)+2*MED_MAX_PARA+1]=MED_CHA;
00034   char    _cstpname[2*MED_MAX_PARA+1]="";
00035 
00036   MED_VARGS_DECL(const, med_idt       , , fid       );
00037   MED_VARGS_DECL(const, char * , const  , fieldname );
00038   MED_VARGS_DECL(const, int           , , csit      );
00039   MED_VARGS_DECL(, med_int *, const     , numdt     );
00040   MED_VARGS_DECL(, med_int *, const     , numit     );
00041   MED_VARGS_DECL(, med_float *, const   , dt        );
00042   MED_VARGS_DECL(, med_int *, const     , meshnumdt );
00043   MED_VARGS_DECL(, med_int *, const     , meshnumit );
00044   MED_VARGS_DECL(, med_err *           ,, fret      );
00045 
00046   va_list params;
00047   va_start(params,dummy);
00048 
00049   MED_VARGS_DEF(const, med_idt       , , fid       );
00050   MED_VARGS_DEF(const, char * , const  , fieldname );
00051   MED_VARGS_DEF(const, int           , , csit      );
00052   MED_VARGS_DEF(, med_int *, const     , numdt     );
00053   MED_VARGS_DEF(, med_int *, const     , numit     );
00054   MED_VARGS_DEF(, med_float *, const   , dt        );
00055   MED_VARGS_DEF(, med_int *, const     , meshnumdt );
00056   MED_VARGS_DEF(, med_int *, const     , meshnumit );
00057   MED_VARGS_DEF(, med_err *           ,, fret      );
00058 
00059   _num=csit-1;
00060 
00061   /*
00062    * On inhibe le gestionnaire d'erreur HDF 5
00063    */
00064   _MEDmodeErreurVerrouiller();
00065 
00066   /*
00067    * On construit le nom du datagroup
00068    */
00069   strcat(_path,fieldname);
00070 
00071   /*
00072    * On recupere le nom du champ
00073    */
00074   if ( _MEDobjectGetName(fid, _path ,_num, _cstpname) < 0 ) {
00075     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(_num);
00076     goto ERROR;
00077   }
00078 
00079   strcat(_path,"/");
00080   strcat(_path,_cstpname);
00081 
00082   if ((_gid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00083     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00084     goto ERROR;
00085   }
00086 
00087 
00088   /*
00089    * Lecture des attributs
00090    */
00091 
00092   if (_MEDattrEntierLire(_gid,MED_NOM_NDT,(med_int*) numdt) < 0) {
00093     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
00094     SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
00095   }
00096 
00097   if (_MEDattrFloatLire(_gid,MED_NOM_PDT,(med_float*) dt) < 0) {
00098     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
00099     SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
00100   }
00101 
00102   if (_MEDattrEntierLire(_gid,MED_NOM_NOR,(med_int*) numit) < 0) {
00103     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
00104     SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
00105   }
00106 
00107   if (_MEDattrEntierLire(_gid,MED_NOM_RDT,(med_int*) meshnumdt) < 0) {
00108     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_RDT);
00109     SSCRUTE(_path);ISCRUTE(*meshnumdt);goto ERROR;
00110   }
00111 
00112   if (_MEDattrEntierLire(_gid,MED_NOM_ROR,(med_int*) meshnumit) < 0) {
00113     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_ROR);
00114     SSCRUTE(_path);ISCRUTE(*meshnumit);goto ERROR;
00115   }
00116 
00117 
00118   _ret = 0;
00119 
00120  ERROR:
00121 
00122 
00123   if (_gid>0)            if (_MEDdatagroupFermer(_gid) < 0) {
00124     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00125     ISCRUTE_id(_gid);
00126   }
00127 
00128   va_end(params);
00129   *fret = _ret;
00130   return;
00131 }

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