Salome HOME
PR: debug imps E3 and E7
authorprascle <prascle>
Mon, 6 Dec 2010 16:59:16 +0000 (16:59 +0000)
committerprascle <prascle>
Mon, 6 Dec 2010 16:59:16 +0000 (16:59 +0000)
src/SMESHDS/SMESHDS_SubMesh.cxx

index ada454b9c051bce9b780e5ec9baf4674e8484655..b56397d97dcbebb94685be3c8a18b46fc1b1433d 100644 (file)
@@ -67,18 +67,23 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
           else
             {
               int idInSubShape = ME->getIdInShape();
-              MESSAGE("add element in subshape already belonging to that subshape "
-                << ME->GetID() << " " << oldShapeId << " " << idInSubShape);
-              // check if ok: do nothing if ok
-              if ((idInSubShape == -1) || (idInSubShape >= myElements.size()))
+              if (idInSubShape >= 0)
                 {
-                  MESSAGE("out of bounds");
-                  throw SALOME_Exception(LOCALIZED("out of bounds"));
-                }
-              if (ME != myElements[idInSubShape])
-                {
-                  MESSAGE("not the same element");
-                  throw SALOME_Exception(LOCALIZED("not the same element"));
+                  MESSAGE("add element in subshape already belonging to that subshape "
+                      << ME->GetID() << " " << oldShapeId << " " << idInSubShape);
+                  // check if ok: do nothing if ok
+                  if (idInSubShape >= myElements.size())
+                    {
+                      MESSAGE("out of bounds " << idInSubShape << " " << myElements.size());
+                      throw SALOME_Exception(LOCALIZED("out of bounds"));
+                    }
+                  if (ME != myElements[idInSubShape])
+                    {
+                      MESSAGE("not the same element");
+                      throw SALOME_Exception(LOCALIZED("not the same element"));
+                    }
+                  MESSAGE("already done, OK, nothing to do");
+                  return;
                 }
             }
         }