X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDWrapper%2FMED_Wrapper.cxx;h=85a8d9f35d1214b01962c4f13f3c2735f404f654;hb=7c8ea81b2987d272cefc43713949884edea63d32;hp=117ab89f6da8532fff99c42bb6aa5e74e437abf7;hpb=eb9d56943a8cd1608862e4e87953ebca0815e0f1;p=modules%2Fsmesh.git diff --git a/src/MEDWrapper/MED_Wrapper.cxx b/src/MEDWrapper/MED_Wrapper.cxx index 117ab89f6..85a8d9f35 100644 --- a/src/MEDWrapper/MED_Wrapper.cxx +++ b/src/MEDWrapper/MED_Wrapper.cxx @@ -187,23 +187,20 @@ namespace MED //--------------------------------------------------------------- TWrapper - ::TWrapper(const std::string& theFileName, TInt theMinor): + ::TWrapper(const std::string& theFileName, bool write, TInt theMinor): myFile(new TFile(theFileName, theMinor)), myMinor(theMinor) { TErr aRet; - myFile->Open(eLECTURE_ECRITURE, &aRet); - // if (aRet < 0) - // myFile->Close(); - // myFile->Open(eLECTURE_AJOUT, &aRet); - // } - if (aRet < 0) { - myFile->Close(); - myFile->Open(eLECTURE, &aRet); + if ( write ) { + myFile->Open(eLECTURE_ECRITURE, &aRet); + if (aRet < 0) { + myFile->Close(); + myFile->Open(eCREATION, &aRet); + } } - if (aRet < 0) { - myFile->Close(); - myFile->Open(eCREATION, &aRet); + else { + myFile->Open(eLECTURE, &aRet); } } @@ -2061,6 +2058,24 @@ namespace MED TValueHolder aConnMode (theInfo.myConnMode); TErr aRet; + med_bool dummy; + aRet = MEDmeshnEntity(myFile->Id(), + &aMeshName, + MED_NO_DT, + MED_NO_IT, + anEntity, + aGeom, + MED_NAME, + aConnMode, + &dummy, &dummy); + if ( aRet > 0 ) + { + // names are present in the file, they will be read in spite of theInfo.myIsElemNames + theInfo.myIsElemNames = eVRAI; + theInfo.myElemNames.reset( new TString( theInfo.myNbElem * GetPNOMLength() + 1 )); + anElemNames.myRepresentation = & ((TString&) theInfo.myElemNames )[0]; + } + aRet = MEDmeshElementRd(myFile->Id(), &aMeshName, MED_NO_DT, @@ -2083,11 +2098,11 @@ namespace MED EXCEPTION(std::runtime_error, "GetCellInfo - MEDmeshElementRd(...)"); if (anIsFamNum == MED_FALSE) - { - int mySize = (int) theInfo.myFamNum->size(); - theInfo.myFamNum->clear(); - theInfo.myFamNum->resize(mySize, 0); - } + { + int mySize = (int) theInfo.myFamNum->size(); + theInfo.myFamNum->clear(); + theInfo.myFamNum->resize(mySize, 0); + } }