mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00: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 )
|
if ( !myMesh )
|
||||||
return addMessage("Supporting mesh not set", /*isFatal=*/true );
|
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;
|
MED::PMeshInfo meshInfo;
|
||||||
if ( myMeshId > 0 )
|
if ( myMeshId > 0 )
|
||||||
{
|
{
|
||||||
@ -276,7 +280,7 @@ Driver_Mesh::Status DriverMED_W_Field::Perform()
|
|||||||
( !myMeshName.empty() && meshInfo->GetName() != myMeshName ))
|
( !myMeshName.empty() && meshInfo->GetName() != myMeshName ))
|
||||||
{
|
{
|
||||||
myMeshId = -1;
|
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
|
// create a field
|
||||||
|
@ -57,7 +57,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_Field: public Driver_SMESHDS_Mesh
|
|||||||
void AddValue( int val );
|
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();
|
SMDS_ElemIteratorPtr GetOrderedElems();
|
||||||
|
|
||||||
|
@ -130,6 +130,9 @@ namespace MED
|
|||||||
{
|
{
|
||||||
int mvok[] = MED_VERSIONS_APPEND_COMPATIBLE;
|
int mvok[] = MED_VERSIONS_APPEND_COMPATIBLE;
|
||||||
std::vector<int> MEDVersionsOK(mvok, mvok + sizeof(mvok)/sizeof(int));
|
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;
|
return MEDVersionsOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +145,7 @@ namespace MED
|
|||||||
bool CheckCompatibility(const std::string& fileName, bool isForAppend)
|
bool CheckCompatibility(const std::string& fileName, bool isForAppend)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int medVersionsOK[] = MED_VERSIONS_APPEND_COMPATIBLE;
|
std::vector<int> medVersionsOK = GetMEDVersionsAppendCompatible();
|
||||||
// check that file is accessible
|
// check that file is accessible
|
||||||
if ( exists(fileName) ) {
|
if ( exists(fileName) ) {
|
||||||
// check HDF5 && MED compatibility
|
// check HDF5 && MED compatibility
|
||||||
@ -161,7 +164,7 @@ namespace MED
|
|||||||
ok = true;
|
ok = true;
|
||||||
else {
|
else {
|
||||||
int medVersion = 10*major + minor;
|
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) {
|
if (medVersionsOK[ii] == medVersion) {
|
||||||
ok =true;
|
ok =true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user