_MEDfield23ComputingStepMeshInfo30.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 _MEDfield23ComputingStepMeshInfo30(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_int * const     nmesh     = va_arg(params,med_int * const     );
00038   char * const        meshname  = va_arg(params,char * const        );
00039   med_bool * const    localmesh = va_arg(params,med_bool * const    );
00040   med_int * const     meshnumdt = va_arg(params,med_int * const     );
00041   med_int * const     meshnumit = va_arg(params,med_int * const     );
00042   med_err *           fret      = va_arg(params,        med_err*    );
00043 
00044   med_err _ret=-1;
00045   med_idt _gid=0,_datagroup1=0,_meshgid=0,_linkgid=0;
00046   int     _num=csit-1;
00047   char    _datagroupname1[2*MED_MAX_PARA+1]="";
00048   char    _path          [(MED_TAILLE_CHA+MED_NAME_SIZE+1)+2*MED_MAX_PARA+1]=MED_CHA;
00049   char    _meshpath [MED_TAILLE_MAA+MED_NAME_SIZE+1]=MED_MAA;
00050   char    _linkpath [MED_TAILLE_LIENS+MED_NAME_SIZE+1]=MED_LIENS;
00051   char    _cstpname[2*MED_MAX_PARA+1]="";
00052 
00053 
00054   /*
00055    * On inhibe le gestionnaire d'erreur HDF 5
00056    */
00057   _MEDmodeErreurVerrouiller();
00058 
00059   /*
00060    * On construit le nom du datagroup
00061    */
00062   strcat(_path,fieldname);
00063 
00064   /* Lecture de l'attribut MED_NOM_MAI */
00065   if ( _MEDattributeStringRdByName(fid,_path,MED_NOM_MAI,MED_NAME_SIZE,meshname) < 0) {
00066     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00067     SSCRUTE(_path);SSCRUTE(MED_NOM_MAI);SSCRUTE(meshname);
00068     goto ERROR;
00069   }
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    * Lecture des attributs
00089    */
00090 
00091   if (_MEDattrEntierLire(_gid,MED_NOM_NDT,(med_int*) numdt) < 0) {
00092     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
00093     SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
00094   }
00095 
00096   if (_MEDattrFloatLire(_gid,MED_NOM_PDT,(med_float*) dt) < 0) {
00097     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
00098     SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
00099   }
00100 
00101   if (_MEDattrEntierLire(_gid,MED_NOM_NOR,(med_int*) numit) < 0) {
00102     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
00103     SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
00104   }
00105 
00106   if (_MEDattrEntierLire(_gid,MED_NOM_RDT,(med_int*) meshnumdt) < 0) {
00107     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_RDT);
00108     SSCRUTE(_path);ISCRUTE(*meshnumdt);goto ERROR;
00109   }
00110 
00111   if (_MEDattrEntierLire(_gid,MED_NOM_ROR,(med_int*) meshnumit) < 0) {
00112     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_ROR);
00113     SSCRUTE(_path);ISCRUTE(*meshnumit);goto ERROR;
00114   }
00115 
00116 
00117  /* Maillage local ou distant */
00118   strcat(_meshpath,meshname);
00119 
00120   /* Le maillage est il distant */
00121   if ( (_meshgid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0)  {
00122 
00123     /* Verifie que le maillage est bien référencé comme distant */
00124     strcat(_linkpath,meshname);
00125     if ((_linkgid = _MEDdatagroupOuvrir(fid,_linkpath)) < 0) {
00126 /*       MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_MESH,MED_ERR_FIELD_MSG); */
00127 /*       SSCRUTE(fieldname);SSCRUTE(_meshpath);SSCRUTE(_linkpath); */
00128 /*       goto ERROR; */
00129       *localmesh = MED_FALSE;
00130     }
00131     *localmesh = MED_FALSE;
00132   } else
00133     *localmesh = MED_TRUE;
00134 
00135   *nmesh = 1;
00136 
00137   _ret = 0;
00138 
00139  ERROR:
00140 
00141 
00142   if (_gid>0)            if (_MEDdatagroupFermer(_gid) < 0) {
00143     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00144     ISCRUTE_id(_gid);
00145   }
00146   if (_meshgid>0)            if (_MEDdatagroupFermer(_meshgid) < 0) {
00147     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00148     ISCRUTE_id(_meshgid);
00149   }
00150 
00151   if (_linkgid>0)            if (_MEDdatagroupFermer(_linkgid) < 0) {
00152     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_linkpath);
00153     ISCRUTE_id(_linkgid);
00154   }
00155 
00156   va_end(params);
00157   *fret = _ret;
00158   return;
00159 }

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