]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL16202,16203 (Propagation 1D on edges group)
authoreap <eap@opencascade.com>
Wed, 7 Nov 2007 10:08:53 +0000 (10:08 +0000)
committereap <eap@opencascade.com>
Wed, 7 Nov 2007 10:08:53 +0000 (10:08 +0000)
   1) fix error message when Mesh.Compute() fails due to bad hypo definition
   2) fix args of TreatHypoStatus() calls

src/SMESH_SWIG/smesh.py

index 1b668ed4d04d1117e26499ebb14f3416eb0bf230..c39c0655090b64082d2ad3e36bcc29aac8078f1d 100644 (file)
@@ -468,7 +468,7 @@ class Mesh_Algorithm:
 
         self.algo = algo
         status = mesh.mesh.AddHypothesis(self.geom, self.algo)
-        TreatHypoStatus( status, algo.GetName(), GetName(algo), True )
+        TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True )
 
     ## Private method
     def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0):
@@ -494,7 +494,7 @@ class Mesh_Algorithm:
             SetName(hypo, hyp + a)
             pass
         status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
-        TreatHypoStatus( status, hyp, GetName(hypo), 0 )
+        TreatHypoStatus( status, GetName(hypo), GetName(self.geom), 0 )
         return hypo
 
 
@@ -1501,33 +1501,36 @@ class Mesh:
         try:
             ok = smesh.Compute(self.mesh, geom)
         except SALOME.SALOME_Exception, ex:
-            print "Mesh computation failed, exception cought:"
+            print "Mesh computation failed, exception caught:"
             print "    ", ex.details.text
         except:
             import traceback
-            print "Mesh computation failed, exception cought:"
+            print "Mesh computation failed, exception caught:"
             traceback.print_exc()
         if not ok:
             errors = smesh.GetAlgoState( self.mesh, geom )
             allReasons = ""
             for err in errors:
                 if err.isGlobalAlgo:
-                    glob = " global "
+                    glob = "global"
                 else:
-                    glob = " local "
+                    glob = "local"
                     pass
-                dim = str(err.algoDim)
-                if err.name == MISSING_ALGO:
-                    reason = glob + dim + "D algorithm is missing"
-                elif err.name == MISSING_HYPO:
-                    name = '"' + err.algoName + '"'
-                    reason = glob + dim + "D algorithm " + name + " misses " + dim + "D hypothesis"
-                elif err.name == NOT_CONFORM_MESH:
-                    reason = "Global \"Not Conform mesh allowed\" hypothesis is missing"
-                elif err.name == BAD_PARAM_VALUE:
-                    name = '"' + err.algoName + '"'
-                    reason = "Hypothesis of" + glob + dim + "D algorithm " + name +\
-                             " has a bad parameter value"
+                dim = err.algoDim
+                name = err.algoName
+                if len(name) == 0:
+                    reason = '%s %sD algorithm is missing' % (glob, dim)
+                elif err.state == HYP_MISSING:
+                    reason = ('%s %sD algorithm "%s" misses %sD hypothesis'
+                              % (glob, dim, name, dim))
+                elif err.state == HYP_NOTCONFORM:
+                    reason = 'Global "Not Conform mesh allowed" hypothesis is missing'
+                elif err.state == HYP_BAD_PARAMETER:
+                    reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value'
+                              % ( glob, dim, name ))
+                elif err.state == HYP_BAD_GEOMETRY:
+                    reason = ('%s %sD algorithm "%s" is assigned to geometry mismatching'
+                              'its expectation' % ( glob, dim, name ))
                 else:
                     reason = "For unknown reason."+\
                              " Revise Mesh.Compute() implementation in smesh.py!"