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

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