From: ageay Date: Wed, 8 Feb 2012 11:04:38 +0000 (+0000) Subject: Correction of bug. X-Git-Tag: V6_main_FINAL~882 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ed5df0f291f92ef8a628d19cda04aa818d824ea;p=tools%2Fmedcoupling.git Correction of bug. --- diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index cd1944075..662b5d8bf 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -1044,7 +1044,8 @@ void MEDLoaderNS::readFieldDoubleDataInMedFile(const char *fileName, const char double& time, std::vector& infos) { time=0.; - med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::CheckFileForRead(fileName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -1055,6 +1056,7 @@ void MEDLoaderNS::readFieldDoubleDataInMedFile(const char *fileName, const char std::map tabType; std::map tabTypeLgth; med_bool localmesh; + bool found=false; tabEnt[ON_CELLS]=MED_CELL; tabType[ON_CELLS]=typmai; tabTypeLgth[ON_CELLS]=MED_N_CELL_FIXED_GEO; @@ -1068,7 +1070,7 @@ void MEDLoaderNS::readFieldDoubleDataInMedFile(const char *fileName, const char tabType[ON_GAUSS_NE]=typmai; tabTypeLgth[ON_GAUSS_NE]=MED_N_CELL_FIXED_GEO; // - for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; @@ -1078,18 +1080,13 @@ void MEDLoaderNS::readFieldDoubleDataInMedFile(const char *fileName, const char med_int nbPdt; MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt); std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); - if(curMeshName!=meshName) - { - MEDfileClose(fid); - throw INTERP_KERNEL::Exception("Invalid meshname on field !"); - } std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); - if(curFieldName==fieldName) + found=(curFieldName==fieldName) && (curMeshName==meshName); + if(found) { infos.resize(ncomp); for(int i=0;i MEDLoaderNS::getIdsFromFamilies(const char *fileName, const char *meshName, const std::vector& fams)