Salome HOME
NPAL14921 ( memory limitation and Salome freeze )
[modules/smesh.git] / src / SMESH / SMESH_subMesh.cxx
index 3af8072816c5befef88feff24429a594018483dc..86da9d3a0dfbf5c6a8be79f26242592b881a2587 100644 (file)
@@ -53,7 +53,7 @@
 #include <TopoDS_Compound.hxx>
 #include <gp_Pnt.hxx>
 
-#include <Standard_Failure.hxx>
+#include <Standard_OutOfMemory.hxx>
 #include <Standard_ErrorHandler.hxx>
 
 using namespace std;
@@ -1400,6 +1400,20 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           if ( !ret )
             _computeError = algo->GetComputeError();
         }
+        catch ( std::bad_alloc& exc ) {
+          if ( _computeError ) {
+            _computeError->myName = COMPERR_MEMORY_PB;
+            //_computeError->myComment = exc.what();
+          }
+          throw exc;
+        }
+        catch ( Standard_OutOfMemory& exc ) {
+          if ( _computeError ) {
+            _computeError->myName    = COMPERR_MEMORY_PB;
+            //_computeError->myComment = exc.what();
+          }
+          throw exc;
+        }
         catch (Standard_Failure& exc) {
           if ( !_computeError ) _computeError = SMESH_ComputeError::New();
           _computeError->myName    = COMPERR_OCC_EXCEPTION;
@@ -1410,13 +1424,6 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           _computeError->myName    = COMPERR_SLM_EXCEPTION;
           _computeError->myComment = S_ex.what();
         }
-        catch ( std::bad_alloc& exc ) {
-          if ( _computeError ) {
-            _computeError->myName    = COMPERR_MEMORY_PB;
-            _computeError->myComment = exc.what();
-          }
-          throw exc;
-        }
         catch ( std::exception& exc ) {
           if ( !_computeError ) _computeError = SMESH_ComputeError::New();
           _computeError->myName    = COMPERR_STD_EXCEPTION;
@@ -1604,7 +1611,7 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo)
 
     // Show error
     SMESH_Comment text;
-    text << theAlgo->GetName() << " failed on subshape " << _Id << " with error ";
+    text << theAlgo->GetName() << " failed on subshape #" << _Id << " with error ";
     if (_computeError->IsCommon() )
       text << _computeError->CommonName();
     else
@@ -1615,11 +1622,12 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo)
 #ifdef _DEBUG_
     cout << text << endl;
     // Show vertices location of a failed shape
-    cout << "Subshape vertices (first 10):" << endl;
     TopTools_IndexedMapOfShape vMap;
     TopExp::MapShapes( _subShape, TopAbs_VERTEX, vMap );
+    cout << "Subshape vertices " << ( vMap.Extent()>10 ? "(first 10):" : ":") << endl;
     for ( int iv = 1; iv <= vMap.Extent() && iv < 11; ++iv ) {
       gp_Pnt P( BRep_Tool::Pnt( TopoDS::Vertex( vMap( iv ) )));
+      cout << "#" << _father->GetMeshDS()->ShapeToIndex( vMap( iv )) << " ";
       cout << P.X() << " " << P.Y() << " " << P.Z() << " " << endl;
     }
 #else