Salome HOME
Merge from V6_main 19/03/2013 mergefrom_V6_main_19Mar13
authorvsr <vsr@opencascade.com>
Tue, 19 Mar 2013 16:30:57 +0000 (16:30 +0000)
committervsr <vsr@opencascade.com>
Tue, 19 Mar 2013 16:30:57 +0000 (16:30 +0000)
src/CONVERTOR/VISU_MedConvertor.cxx

index df3107cb91427670db93d5af4e34b0d1ee11ec42..2f9e8f1d416480faea77ef936aa01ae5a31e2d68 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  VISU OBJECT : interactive object for VISU entities implementation
 //  File   : VISU_MedConvertor.cxx
@@ -41,6 +40,8 @@
 #define NO_CAS_CATCH
 #endif
 
+#include <NCollection_Map.hxx>
+
 #include <Standard_Failure.hxx>
 
 #ifdef NO_CAS_CATCH
@@ -1436,9 +1437,11 @@ VISU_MedConvertor
   TInt aNbMeshes = myMed->GetNbMeshes();
   VISU::TMeshMap& aMeshMap = myMeshMap;
 
+  bool isDescConn = false; // Mantis issue 0020483
+
   INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
 
-  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+  for (TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++) {
 #ifndef _DEXCEPT_
     try{
 #endif
@@ -1469,18 +1472,25 @@ VISU_MedConvertor
           aMesh->myEntityInfo = anEntityInfo;
 
           // Check connectivity (Mantis issue 0020483)
-          {
-            bool isDescConn = false;
+          if (!isDescConn) {
+            NCollection_Map<MED::EEntiteMaillage> aDescendingEntitiesMap;
 
             MED::TEntityInfo aEntityInfoDesc = myMed->GetEntityInfo(aMeshInfo, MED::eDESC);
             MED::TEntityInfo::iterator anEntityIterDesc = aEntityInfoDesc.begin();
-            for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) {
+            //for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) {
+            for (; anEntityIterDesc != aEntityInfoDesc.end(); anEntityIterDesc++) {
               const MED::EEntiteMaillage& anEntity = anEntityIterDesc->first;
-              if (anEntity != MED::eNOEUD) isDescConn = true;
+              aDescendingEntitiesMap.Add(anEntity);
+              //if (anEntity != MED::eNOEUD) isDescConn = true;
+            }
+            MED::TEntityInfo aEntityInfo = myMed->GetEntityInfo(aMeshInfo, MED::eNOD);
+            MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+            for (; anEntityIter != aEntityInfo.end(); anEntityIter++) {
+              const MED::EEntiteMaillage& anEntity = anEntityIter->first;
+              aDescendingEntitiesMap.Remove(anEntity);
             }
 
-            if (isDescConn)
-              INFOS("There are some elements in descending connectivity in med file. They were not read !!!");
+            if (aDescendingEntitiesMap.Extent()) isDescConn = true;
           }
 
 #ifndef _DEXCEPT_
@@ -1544,7 +1554,11 @@ VISU_MedConvertor
       MSG(MYDEBUG,"Unknown exception !!!");
     }
 #endif
-  } 
+  }
+
+  // Mantis issue 0020483
+  if (isDescConn)
+    INFOS("There are some elements in descending connectivity in med file. They were not read !!!");
 
   return this; 
 }