From 2e3f1dc0ff749af609faf4f5f9eb0500e206e952 Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 25 Jan 2013 13:47:57 +0000 Subject: [PATCH] Mantis issue 0020483: EDF 1117 SMESH,VISU: Mesh with descending connectivity is badly read by SMESH and VISU --- idl/SMESH_Mesh.idl | 1 + src/Driver/Driver_Mesh.h | 1 + src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 24 +++++++++++++++++++--- src/SMESHGUI/SMESH_msg_en.ts | 4 ++++ src/SMESHGUI/SMESH_msg_fr.ts | 4 ++++ src/SMESH_I/SMESH_Mesh_i.cxx | 2 ++ 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 29c6a1539..33c775e38 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -228,6 +228,7 @@ module SMESH DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers, // so the numbers from the file are ignored DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data + DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity DRS_FAIL // general failure (exception etc.) }; diff --git a/src/Driver/Driver_Mesh.h b/src/Driver/Driver_Mesh.h index fcaea2b3e..a3629e497 100644 --- a/src/Driver/Driver_Mesh.h +++ b/src/Driver/Driver_Mesh.h @@ -54,6 +54,7 @@ class MESHDRIVER_EXPORT Driver_Mesh DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers, // so the numbers from the file are ignored DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data + DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity DRS_FAIL // general failure (exception etc.) }; diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 35caa0286..d6bb729e4 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -71,6 +71,7 @@ DriverMED_R_SMESHDS_Mesh ::Perform() { Status aResult = DRS_FAIL; + bool isDescConn = false; #ifndef _DEXCEPT_ try{ #endif @@ -173,15 +174,26 @@ DriverMED_R_SMESHDS_Mesh } } + // Are there any MED cells in descending connectivity + //--------------------------------------------------- + if (!isDescConn) { + MED::TEntityInfo aEntityInfoDesc = aMed->GetEntityInfo(aMeshInfo, eDESC); + MED::TEntityInfo::iterator anEntityIterDesc = aEntityInfoDesc.begin(); + for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) { + const EEntiteMaillage& anEntity = anEntityIterDesc->first; + if (anEntity != eNOEUD) isDescConn = true; + } + } + // Reading pre information about all MED cells //-------------------------------------------- typedef MED::TVector TNodeIds; bool takeNumbers = true; // initially we trust the numbers from file - MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); + MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo, eNOD); MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin(); - for(; anEntityIter != aEntityInfo.end(); anEntityIter++){ + for (; anEntityIter != aEntityInfo.end(); anEntityIter++) { const EEntiteMaillage& anEntity = anEntityIter->first; - if(anEntity == eNOEUD) continue; + if (anEntity == eNOEUD) continue; // Reading MED cells to the corresponding SMDS structure //------------------------------------------------------ const MED::TGeom2Size& aGeom2Size = anEntityIter->second; @@ -905,6 +917,12 @@ DriverMED_R_SMESHDS_Mesh #endif if (myMesh) myMesh->compactMesh(); + + if (aResult == DRS_OK && isDescConn) { + INFOS("There are some elements in descending connectivity in med file. They were not read !!!"); + aResult = DRS_WARN_DESCENDING; + } + if(MYDEBUG) MESSAGE("Perform - aResult status = "< SMESH_DRS_4 + MED file contains some elements in descending connectivity. They were not read. + + + SMESH_DRS_5 The file is incorrect, some data is missed diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 74dbb0125..5345d612b 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -1450,6 +1450,10 @@ ce qui peut faire planter l'application. Voulez-vous continuer la visualisa SMESH_DRS_4 + MED file contains some elements in descending connectivity. They were not read. + + + SMESH_DRS_5 Le fichier n'est pas correct, des données sont manquantes diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index dde636000..cf8441623 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -320,6 +320,8 @@ static SMESH::DriverMED_ReadStatus ConvertDriverMEDReadStatus (int theStatus) res = SMESH::DRS_WARN_RENUMBER; break; case DriverMED_R_SMESHDS_Mesh::DRS_WARN_SKIP_ELEM: res = SMESH::DRS_WARN_SKIP_ELEM; break; + case DriverMED_R_SMESHDS_Mesh::DRS_WARN_DESCENDING: + res = SMESH::DRS_WARN_DESCENDING; break; case DriverMED_R_SMESHDS_Mesh::DRS_FAIL: default: res = SMESH::DRS_FAIL; break; -- 2.39.2