Salome HOME
0020693: EDF 1288 SMESH: Problem to recompute a mesh with a sub-mesh and a conversion...
authoreap <eap@opencascade.com>
Thu, 13 May 2010 06:24:13 +0000 (06:24 +0000)
committereap <eap@opencascade.com>
Thu, 13 May 2010 06:24:13 +0000 (06:24 +0000)
     ## Computes the mesh and returns the status of the computation
+    #  @param discardModifs if True and the mesh has been edited since
+    #         a last total re-compute and that may prevent successful partial re-compute,
+    #         then the mesh is cleaned before Compute()
     #  @return True or False
     #  @ingroup l2_construct
-    def Compute(self, geom=0):
+    def Compute(self, geom=0, discardModifs=False):

src/SMESH_SWIG/smeshDC.py

index 4cde48b12cdb848136938135f8bb726f787d1a62..c12d93ef2cd94548565bdbcbfa09fded1ff7d986 100644 (file)
@@ -438,6 +438,7 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
     elif status == HYP_NOTCONFORM :
         reason = "a non-conform mesh would be built"
     elif status == HYP_ALREADY_EXIST :
+        if isAlgo: return # it does not influence anything
         reason = hypType + " of the same dimension is already assigned to this shape"
     elif status == HYP_BAD_DIM :
         reason = hypType + " mismatches the shape"
@@ -1164,9 +1165,12 @@ class Mesh:
 
 
     ## Computes the mesh and returns the status of the computation
+    #  @param discardModifs if True and the mesh has been edited since
+    #         a last total re-compute and that may prevent successful partial re-compute,
+    #         then the mesh is cleaned before Compute()
     #  @return True or False
     #  @ingroup l2_construct
-    def Compute(self, geom=0):
+    def Compute(self, geom=0, discardModifs=False):
         if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object):
             if self.geom == 0:
                 geom = self.mesh.GetShapeToMesh()
@@ -1174,6 +1178,8 @@ class Mesh:
                 geom = self.geom
         ok = False
         try:
+            if discardModifs and self.mesh.HasModificationsToDiscard(): # issue 0020693
+                self.mesh.Clear()
             ok = self.smeshpyD.Compute(self.mesh, geom)
         except SALOME.SALOME_Exception, ex:
             print "Mesh computation failed, exception caught:"
@@ -1197,6 +1203,8 @@ class Mesh:
                             if not s: continue
                             mainSO = s.FindObjectIOR(mainIOR)
                             if not mainSO: continue
+                            if err.subShapeID == 1:
+                                shapeText = ' on "%s"' % mainSO.GetName()
                             subIt = s.NewChildIterator(mainSO)
                             while subIt.More():
                                 subSO = subIt.Value()