]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021823: [CEA 649] Compute failed without any errors
authoreap <eap@opencascade.com>
Thu, 30 Aug 2012 07:42:09 +0000 (07:42 +0000)
committereap <eap@opencascade.com>
Thu, 30 Aug 2012 07:42:09 +0000 (07:42 +0000)
report a warning if no elements are assigned to a sub-shape

src/SMESH/SMESH_subMesh.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx

index afaa256ec055eeacf819c99cf66fbad0a971dd4a..aa1bfc5ca0b0367b56978da62403f62dae8579ee 100644 (file)
@@ -1758,13 +1758,25 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
     }
   }
   {
-    // Check my state
+
+    // Set my _computeState
+
+    _computeState = FAILED_TO_COMPUTE;
     if ( !_computeError || _computeError->IsOK() )
     {
       // no error description is set to this sub-mesh, check if any mesh is computed
       _computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE;
+      if ( _computeState != COMPUTE_OK )
+      {
+        if ( _subShape.ShapeType() == TopAbs_EDGE &&
+             BRep_Tool::Degenerated( TopoDS::Edge( _subShape )) )
+          _computeState = COMPUTE_OK;
+        else
+          _computeError = SMESH_ComputeError::New(COMPERR_NO_MESH_ON_SHAPE,"",theAlgo);
+      }
+      noErrors = ( _computeState == COMPUTE_OK );
     }
-    else
+    if ( !noErrors )
     {
       if ( !_computeError->myAlgo )
         _computeError->myAlgo = theAlgo;
@@ -1783,7 +1795,6 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
 
       _computeState = _computeError->IsKO() ? FAILED_TO_COMPUTE : COMPUTE_OK;
 
-      noErrors = false;
     }
   }
   return noErrors;
index 07646ef9a83b7936647bec9d66b4732e26646f53..bb931e3ddded41f5968b3ab71fcf4e51a24196a6 100644 (file)
@@ -337,15 +337,16 @@ namespace SMESH
   {
     QString text;
     switch ( errCode ) {
-      CASE2TEXT( COMPERR_OK            );
-      CASE2TEXT( COMPERR_BAD_INPUT_MESH);
-      CASE2TEXT( COMPERR_STD_EXCEPTION );
-      CASE2TEXT( COMPERR_OCC_EXCEPTION );
+      CASE2TEXT( COMPERR_OK               );
+      CASE2TEXT( COMPERR_BAD_INPUT_MESH   );
+      CASE2TEXT( COMPERR_STD_EXCEPTION    );
+      CASE2TEXT( COMPERR_OCC_EXCEPTION    );
     case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception"
-      CASE2TEXT( COMPERR_EXCEPTION     );
-      CASE2TEXT( COMPERR_MEMORY_PB     );
-      CASE2TEXT( COMPERR_BAD_SHAPE     );
-      CASE2TEXT( COMPERR_CANCELED      );
+      CASE2TEXT( COMPERR_EXCEPTION        );
+      CASE2TEXT( COMPERR_MEMORY_PB        );
+      CASE2TEXT( COMPERR_BAD_SHAPE        );
+      CASE2TEXT( COMPERR_CANCELED         );
+      CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE );
     case SMESH::COMPERR_ALGO_FAILED:
       if ( strlen(comment) == 0 )
         text = QObject::tr("COMPERR_ALGO_FAILED");
@@ -951,7 +952,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
   {
     bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported
     for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
-      onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING );
+      onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ||
+                       theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE );
 
     // full or brief mesh info
     SMESH::long_array_var aRes = myMesh->GetMeshInfo();