if ( !myMesh )
return addMessage("Supporting mesh not set", /*isFatal=*/true );
- MED::PWrapper medFile = MED::CrWrapperW( myFile );
+ int version = -1, major, minor, release;
+ if ( MED::GetMEDVersion( myFile, major, minor, release ))
+ version = major * 10 + minor;
+
+ MED::PWrapper medFile = MED::CrWrapperW( myFile, version );
MED::PMeshInfo meshInfo;
if ( myMeshId > 0 )
{
( !myMeshName.empty() && meshInfo->GetName() != myMeshName ))
{
myMeshId = -1;
- return addMessage("Specified mesh not found in the file", /*isFatal=*/true );
+ return addMessage("DriverMED_W_Field: Specified mesh not found in the file", /*isFatal=*/true );
}
// create a field
void AddValue( int val );
/*
- * Returns elements in the order they are written in MED file. Result can be NULL!
+ * Return elements in the order they are written in MED file. Result can be NULL!
*/
SMDS_ElemIteratorPtr GetOrderedElems();
{
int mvok[] = MED_VERSIONS_APPEND_COMPATIBLE;
std::vector<int> MEDVersionsOK(mvok, mvok + sizeof(mvok)/sizeof(int));
+ int curVersion = MED_MAJOR_NUM * 10 + MED_MINOR_NUM;
+ if ( MEDVersionsOK[0] != curVersion )
+ MEDVersionsOK.insert( MEDVersionsOK.begin(), curVersion );
return MEDVersionsOK;
}
bool CheckCompatibility(const std::string& fileName, bool isForAppend)
{
bool ok = false;
- int medVersionsOK[] = MED_VERSIONS_APPEND_COMPATIBLE;
+ std::vector<int> medVersionsOK = GetMEDVersionsAppendCompatible();
// check that file is accessible
if ( exists(fileName) ) {
// check HDF5 && MED compatibility
ok = true;
else {
int medVersion = 10*major + minor;
- for (size_t ii=0; ii < sizeof(medVersionsOK)/sizeof(int); ii++)
+ for (size_t ii=0; ii < medVersionsOK.size(); ii++)
if (medVersionsOK[ii] == medVersion) {
ok =true;
break;