Salome HOME
Improve checking of validity of mesh elements connectivity
authorapo <apo@opencascade.com>
Wed, 26 Jan 2005 06:49:06 +0000 (06:49 +0000)
committerapo <apo@opencascade.com>
Wed, 26 Jan 2005 06:49:06 +0000 (06:49 +0000)
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx

index fe5100d4f2cc2293029c30d8af7ac4c556fc7dbe..1433e3208a970c74ef6d00e1f498552e3100d94d 100644 (file)
@@ -309,21 +309,35 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                break;
              }
              vector<TInt> aNodeIds(aNbNodes);
                break;
              }
              vector<TInt> aNodeIds(aNbNodes);
+             bool anIsValidConnect = false;
+
+             try{
 #ifdef _EDF_NODE_IDS_
 #ifdef _EDF_NODE_IDS_
-             if(anIsNodeNum) {
-               for(int i = 0; i < aNbNodes; i++){
-                 aNodeIds[i] = aNodeInfo->GetElemNum(aCellInfo->GetConn(iElem,i)-1);
+               if(anIsNodeNum) {
+                 for(int i = 0; i < aNbNodes; i++){
+                   aNodeIds[i] = aNodeInfo->GetElemNum(aCellInfo->GetConn(iElem,i)-1);
+                 }
+               }else{
+                 for(int i = 0; i < aNbNodes; i++){
+                   aNodeIds[i] = aCellInfo->GetConn(iElem,i);
+                 }
                }
                }
-             }else{
+#else
                for(int i = 0; i < aNbNodes; i++){
                  aNodeIds[i] = aCellInfo->GetConn(iElem,i);
                }
                for(int i = 0; i < aNbNodes; i++){
                  aNodeIds[i] = aCellInfo->GetConn(iElem,i);
                }
-             }
-#else
-             for(int i = 0; i < aNbNodes; i++){
-               aNodeIds[i] = aCellInfo->GetConn(iElem,i);
-             }
 #endif
 #endif
+               anIsValidConnect = true;
+             }catch(const std::exception& exc){
+               //INFOS("Follow exception was cought:\n\t"<<exc.what());
+               aResult = DRS_FAIL;
+             }catch(...){
+               //INFOS("Unknown exception was cought !!!");
+               aResult = DRS_FAIL;
+             }
+             
+             if(!anIsValidConnect)
+               continue;
 
              bool isRenum = false;
              SMDS_MeshElement* anElement = NULL;
 
              bool isRenum = false;
              SMDS_MeshElement* anElement = NULL;