_MEDsubdomainComputingStepInfo30.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 #include <stdlib.h>
00024 
00025 /*TODO : Test unitaire */
00026 void _MEDsubdomainComputingStepInfo30(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 char * const jointname       = va_arg(params,const char * const  );
00034   const int          csit            = va_arg(params,const int           );
00035   med_int * const    numdt           = va_arg(params,med_int * const     );
00036   med_int * const    numit           = va_arg(params,med_int * const     );
00037   med_int * const    ncorrespondence = va_arg(params,med_int * const     );
00038   med_err *          fret            = va_arg(params,med_err *);
00039 
00040   med_err  _ret=-1,_err=-1;
00041   med_idt  _eqid=0,_datagroup1=0;
00042   int      _num = csit -1;
00043   char     _cstppath[MED_TAILLE_JNT+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1]=MED_JNT;
00044   char     _cstpname[2*MED_MAX_PARA+1]="";
00045   med_size _ncorrespondence=0;
00046   /*
00047    * On inhibe le gestionnaire d'erreur
00048    */
00049   _MEDmodeErreurVerrouiller();
00050 
00051   strcat( _cstppath, meshname);
00052   strcat( _cstppath, "/");
00053   strcat( _cstppath, jointname);
00054 
00055   if ((_eqid = _MEDdatagroupOuvrir(fid,_cstppath)) < 0) {
00056     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_cstppath);
00057     ISCRUTE_id(_eqid);goto ERROR;
00058   }
00059 
00060   strcat( _cstppath, "/");
00061   /*
00062    * On recupere le nom de l'~tape de calcul
00063    */
00064   if ( _MEDobjectGetName(fid, _cstppath ,_num, &_cstppath[strlen(_cstppath)]) < 0 ) {
00065     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_cstppath);ISCRUTE_int(csit);
00066     goto ERROR;
00067   }
00068 
00069   if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_cstppath)) < 0 ) {
00070     MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_COMPUTINGSTEP,_cstppath);
00071     SSCRUTE(_cstppath);goto ERROR;
00072   }
00073 
00074   /*Cree ou ouvre l'attribut MED_NOM_NDT pour lecture */
00075   if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NDT,numdt) < 0 ) {
00076     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00077     SSCRUTE(jointname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NDT);
00078     ISCRUTE(*numdt);goto ERROR;
00079   }
00080 
00081 
00082   /*Cree ou ouvre l'attribut MED_NOM_PDT pour lecture */
00083 /*   if ( _MEDattrFloatLire(_datagroup1,MED_NOM_PDT,dt) < 0) { */
00084 /*     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); */
00085 /*     SSCRUTE(jointname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_PDT); */
00086 /*     RSCRUTE(*dt);goto ERROR; */
00087 /*   } */
00088 
00089   /*Cree ou ouvre l'attribut MED_NOM_NOR pour lecture */
00090   if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NOR,numit) < 0) {
00091     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00092     SSCRUTE(jointname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NOR);
00093     ISCRUTE(*numit); goto ERROR;
00094   }
00095 
00096   /*
00097    * Nombre de tableau d'~quivalence
00098    */
00099   if ((_err=_MEDnObjects(_datagroup1,".",&_ncorrespondence)) <0)
00100     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00101       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_cstppath);
00102       goto ERROR;
00103     }
00104 
00105   *ncorrespondence = (med_int) _ncorrespondence;
00106 
00107   _ret = 0;
00108  ERROR:
00109 
00110   if (_eqid>0)     if (_MEDdatagroupFermer(_eqid) < 0) {
00111     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
00112     ISCRUTE_id(_eqid);
00113   }
00114 
00115   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
00116     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_cstppath);
00117     ISCRUTE_id(_datagroup1);
00118   }
00119 
00120   va_end(params);
00121   *fret = _ret;
00122   return;
00123 }

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