mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
#17775 [CEA] SALOME 9.4.0a1: export a mesh with fields using Python API- SMESH::ExportMED crash
Add the version of MED_FILE with which SALOME is built into a list returned by MED::GetMEDVersionsAppendCompatible()
This commit is contained in:
parent
831c6999e8
commit
e64a06483c
@ -253,7 +253,11 @@ Driver_Mesh::Status DriverMED_W_Field::Perform()
|
||||
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 )
|
||||
{
|
||||
@ -276,7 +280,7 @@ Driver_Mesh::Status DriverMED_W_Field::Perform()
|
||||
( !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
|
||||
|
@ -57,7 +57,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_Field: public Driver_SMESHDS_Mesh
|
||||
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();
|
||||
|
||||
|
@ -130,6 +130,9 @@ namespace MED
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -142,7 +145,7 @@ namespace MED
|
||||
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
|
||||
@ -161,7 +164,7 @@ namespace MED
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user