X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_W_SMESHDS_Mesh.cxx;h=63c69c992ee921e3a18351a076439b76abd0d968;hb=46c12766bce7d48c0c9ecc772b47ba12a18afb6b;hp=6ac446156c3ad6954eba9cfc716b069e57b54db8;hpb=b7a7d49664daa32e1befb558280e13ed0bde37c9;p=modules%2Fsmesh.git diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 6ac446156..63c69c992 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -35,6 +35,8 @@ #include "SMDS_SetIterator.hxx" #include "SMESHDS_Mesh.hxx" +#include + #include #include #include @@ -59,14 +61,45 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh(): myDoGroupOfBalls(false), myAutoDimension(false), myAddODOnVertices(false), - myDoAllInGroups(false) + myDoAllInGroups(false), + myVersion(-1) {} -void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName) +void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, int theVersion) { + myVersion = theVersion; Driver_SMESHDS_Mesh::SetFile(theFileName); } +/*! + * MED version is either the latest available, or with an inferior minor, + * to ensure backward compatibility on writing med files. + */ +string DriverMED_W_SMESHDS_Mesh::GetVersionString(int theMinor, int theNbDigits) +{ + TInt majeur, mineur, release; + majeur=MED_MAJOR_NUM; + mineur=MED_MINOR_NUM; + release=MED_RELEASE_NUM; + TInt imposedMineur = mineur; + + if (theMinor < 0) + imposedMineur = mineur; + else if (theMinor > MED_MINOR_NUM) + imposedMineur = mineur; + else + imposedMineur = theMinor; + + ostringstream name; + if ( theNbDigits > 0 ) + name << majeur; + if ( theNbDigits > 1 ) + name << "." << imposedMineur; + if ( theNbDigits > 2 ) + name << "." << release; + return name.str(); +} + void DriverMED_W_SMESHDS_Mesh::AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); @@ -425,7 +458,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() } } - MED::PWrapper myMed = CrWrapperW(myFile); + MED::PWrapper myMed = CrWrapperW(myFile, myVersion); PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName); //MESSAGE("Add - aMeshName : "<GetName()); myMed->SetMeshInfo(aMeshInfo);