Salome HOME
PAL14921 (memory limitation and Salome freeze)
authoreap <eap@opencascade.com>
Fri, 18 May 2007 08:38:37 +0000 (08:38 +0000)
committereap <eap@opencascade.com>
Fri, 18 May 2007 08:38:37 +0000 (08:38 +0000)
-  Unexpect aCatch(SalomeException);
+  // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+  //Unexpect aCatch(SalomeException);

src/StdMeshers/StdMeshers_Hexa_3D.cxx
src/StdMeshers/StdMeshers_Hexa_3D.hxx
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_Projection_1D.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_Projection_3D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.hxx
src/StdMeshers/StdMeshers_RadialPrism_3D.cxx
src/StdMeshers/StdMeshers_Regular_1D.cxx

index a92e94b84d0c6a73c5ea9c65fc10f34bf61530a5..129c270ee106dbf551ff702cec22fdf79d123d99 100644 (file)
@@ -176,9 +176,10 @@ static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int&
 //=============================================================================
 
 bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh &         aMesh,
-                                 const TopoDS_Shape & aShape) throw(SALOME_Exception)
+                                 const TopoDS_Shape & aShape)// throw(SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
+  // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+  //Unexpect aCatch(SalomeException);
   MESSAGE("StdMeshers_Hexa_3D::Compute");
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   
index 4d364d4e8da6f565b33415dd5c6834df771adb97..db4d2e60f55fba83f5e2a17b5c16168dd9d7da63 100644 (file)
@@ -74,7 +74,7 @@ public:
 
   virtual bool Compute(SMESH_Mesh& aMesh,
                       const TopoDS_Shape& aShape)
-    throw (SALOME_Exception);
+    /*throw (SALOME_Exception)*/;
 
   static TopoDS_Vertex OppositeVertex(const TopoDS_Vertex& aVertex,
                                       const TopTools_IndexedMapOfShape& aQuads0Vertices,
index cb4e61fc161b2a9531355add902b62fcc010982a..c919f6a1e045e3bba6c410edc363142a6d0cc627 100644 (file)
@@ -517,7 +517,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
     }
     if ( m + uvPtVec.size()-1 > mefistoToDS.size() ) {
       MESSAGE("Wrong mefistoToDS.size: "<<mefistoToDS.size()<<" < "<<m + uvPtVec.size()-1);
-      return error(dfltErr(),"Internal error");
+      return error("Internal error");
     }
 
     vector<UVPtStruct>::const_iterator uvPt = uvPtVec.begin();
index d7da4e5871a164957db8fe704a1ad1bf03be4a08..bf404289700355fb5b955f30aac0af6d10a0e63a 100644 (file)
@@ -287,7 +287,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
     else {
       gp_Pnt topCoords = myShapeXYZ[ ID_TOP_FACE ];
       if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE ))
-        return error(dfltErr(),TCom("Can't compute normalized parameters ")
+        return error(TCom("Can't compute normalized parameters ")
                      << "for node " << column.back()->GetID()
                      << " on the face #"<< column.back()->GetPosition()->GetShapeId() );
     }
@@ -316,7 +316,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
       // compute coords for a new node
       gp_XYZ coords;
       if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords ))
-        return error(dfltErr(),"Can't compute coordinates by normalized parameters");
+        return error("Can't compute coordinates by normalized parameters");
 
       // create a node
       node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() );
@@ -349,13 +349,13 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
       if ( n->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) {
         bot_column = myBotToColumnMap.find( n );
         if ( bot_column == myBotToColumnMap.end() )
-          return error(dfltErr(),TCom("No nodes found above node ") << n->GetID() );
+          return error(TCom("No nodes found above node ") << n->GetID() );
         columns[ i ] = & bot_column->second;
       }
       else {
         columns[ i ] = myBlock.GetNodeColumn( n );
         if ( !columns[ i ] )
-          return error(dfltErr(),TCom("No side nodes found above node ") << n->GetID() );
+          return error(TCom("No side nodes found above node ") << n->GetID() );
       }
     }
     // create prisms
@@ -467,7 +467,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
   SMESHDS_SubMesh * topSMDS = topSM->GetSubMeshDS();
 
   if ( !botSMDS || botSMDS->NbElements() == 0 )
-    return error(dfltErr(),TCom("No elememts on face #") << botSM->GetId());
+    return error(TCom("No elememts on face #") << botSM->GetId());
 
   bool needProject = false;
   if ( !topSMDS || 
@@ -475,13 +475,13 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
        botSMDS->NbNodes()    != topSMDS->NbNodes())
   {
     if ( myBlock.HasNotQuadElemOnTop() )
-      return error(dfltErr(),TCom("Mesh on faces #") << botSM->GetId()
+      return error(TCom("Mesh on faces #") << botSM->GetId()
                    <<" and #"<< topSM->GetId() << " seems different" );
     needProject = true;
   }
 
   if ( 0/*needProject && !myProjectTriangles*/ )
-    return error(dfltErr(),TCom("Mesh on faces #") << botSM->GetId()
+    return error(TCom("Mesh on faces #") << botSM->GetId()
                  <<" and #"<< topSM->GetId() << " seems different" );
   ///RETURN_BAD_RESULT("Need to project but not allowed");
 
@@ -497,7 +497,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
   if ( !TAssocTool::FindSubShapeAssociation( botFace, myBlock.Mesh(),
                                              topFace, myBlock.Mesh(),
                                              shape2ShapeMap) )
-    return error(dfltErr(),TCom("Topology of faces #") << botSM->GetId()
+    return error(TCom("Topology of faces #") << botSM->GetId()
                  <<" and #"<< topSM->GetId() << " seems different" );
 
   // Find matching nodes of top and bottom faces
@@ -505,7 +505,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
   if ( ! TAssocTool::FindMatchingNodesOnFaces( botFace, myBlock.Mesh(),
                                                topFace, myBlock.Mesh(),
                                                shape2ShapeMap, n2nMap ))
-    return error(dfltErr(),TCom("Mesh on faces #") << botSM->GetId()
+    return error(TCom("Mesh on faces #") << botSM->GetId()
                  <<" and #"<< topSM->GetId() << " seems different" );
 
   // Fill myBotToColumnMap
@@ -522,7 +522,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
     TNode bN( botNode );
     if ( zSize > 2 )
       if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), ID_BOT_FACE ))
-        return error(dfltErr(),TCom("Can't compute normalized parameters ")
+        return error(TCom("Can't compute normalized parameters ")
                      << "for node " << botNode->GetID() << " on the face #"<< botSM->GetId() );
     // create node column
     TNode2ColumnMap::iterator bN_col = 
@@ -570,13 +570,13 @@ bool StdMeshers_Prism_3D::projectBottomToTop()
     // compute bottom node params
     TNode bN( botNode );
     if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), ID_BOT_FACE ))
-      return error(dfltErr(),TCom("Can't compute normalized parameters ")
+      return error(TCom("Can't compute normalized parameters ")
                    << "for node " << botNode->GetID() << " on the face #"<< botSM->GetId() );
     // compute top node coords
     gp_XYZ topXYZ; gp_XY topUV;
     if ( !myBlock.FacePoint( ID_TOP_FACE, bN.GetParams(), topXYZ ) ||
          !myBlock.FaceUV   ( ID_TOP_FACE, bN.GetParams(), topUV ))
-      return error(dfltErr(),TCom("Can't compute coordinates ")
+      return error(TCom("Can't compute coordinates ")
                    << "by normalized parameters on the face #"<< topSM->GetId() );
     SMDS_MeshNode * topNode = meshDS->AddNode( topXYZ.X(),topXYZ.Y(),topXYZ.Z() );
     meshDS->SetNodeOnFace( topNode, topFaceID, topUV.X(), topUV.Y() );
@@ -610,13 +610,13 @@ bool StdMeshers_Prism_3D::projectBottomToTop()
       if ( n->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) {
         TNode2ColumnMap::iterator bot_column = myBotToColumnMap.find( n );
         if ( bot_column == myBotToColumnMap.end() )
-          return error(dfltErr(),TCom("No nodes found above node ") << n->GetID() );
+          return error(TCom("No nodes found above node ") << n->GetID() );
         nodes[ i ] = bot_column->second.back();
       }
       else {
         const TNodeColumn* column = myBlock.GetNodeColumn( n );
         if ( !column )
-          return error(dfltErr(),TCom("No side nodes found above node ") << n->GetID() );
+          return error(TCom("No side nodes found above node ") << n->GetID() );
         nodes[ i ] = column->back();
       }
     }
index 1bfdc41c5a3db5df1be7bbeb0f09afcc6b4584c5..d3d2925756f4be27b5e547990283f57406f79f72 100644 (file)
@@ -191,7 +191,7 @@ bool StdMeshers_Projection_1D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
   TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap );
   if ( !TAssocTool::FindSubShapeAssociation( tgtEdge, tgtMesh, srcEdge, srcMesh,
                                              shape2ShapeMap) )
-    return error(dfltErr(),SMESH_Comment("Vertices association failed" ));
+    return error(SMESH_Comment("Vertices association failed" ));
 
   // ----------------------------------------------
   // Assure that mesh on a source edge is computed
@@ -275,7 +275,7 @@ bool StdMeshers_Projection_1D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
       // from the point at given parameter.
       GCPnts_AbscissaPoint Discret( curveAdaptor, dl * lengths[ i-1 ], tgtParams[ i-1 ] );
       if ( !Discret.IsDone() )
-        return error(dfltErr(),"GCPnts_AbscissaPoint failed");
+        return error("GCPnts_AbscissaPoint failed");
       tgtParams[ i ] = Discret.Parameter();
     }
     // make internal nodes 
index c122ea63174a2ddc24df88e17675569b0d0655f6..687ccc4af384b7661b55141d3fcc837413ec5547 100644 (file)
@@ -458,14 +458,14 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
 
   mapper.Apply( tgtFace, tgtV1, reverse );
   if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK )
-    return error(dfltErr(),"Can't apply source mesh pattern to the face");
+    return error("Can't apply source mesh pattern to the face");
 
   // Create the mesh
 
   const bool toCreatePolygons = false, toCreatePolyedrs = false;
   mapper.MakeMesh( tgtMesh, toCreatePolygons, toCreatePolyedrs );
   if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK )
-    return error(dfltErr(),"Can't make mesh by source mesh pattern");
+    return error("Can't make mesh by source mesh pattern");
 
   // it will remove mesh built by pattern mapper on edges and vertices
   // in failure case
index 68eda5d6593ea297364697efd0f8b1d9b276a54b..f634ecf2b5331c71872a433ccda0133863360866 100644 (file)
@@ -251,12 +251,12 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
     TopExp::Vertices( TopoDS::Edge( exp.Current() ), tgtV000, tgtV100 );
 
     if ( !shape2ShapeMap.IsBound( tgtV000 ) || !shape2ShapeMap.IsBound( tgtV100 ))
-      return error(dfltErr(),"Association of subshapes failed" );
+      return error("Association of subshapes failed" );
     srcV000 = TopoDS::Vertex( shape2ShapeMap( tgtV000 ));
     srcV100 = TopoDS::Vertex( shape2ShapeMap( tgtV100 ));
     if ( !TAssocTool::IsSubShape( srcV000, srcShell ) ||
          !TAssocTool::IsSubShape( srcV100, srcShell ))
-      return error(dfltErr(),"Incorrect association of subshapes" );
+      return error("Incorrect association of subshapes" );
   }
 
   // Load 2 SMESH_Block's with src and tgt shells
@@ -342,12 +342,12 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
         gp_Pnt srcCoord = gpXYZ( srcNode );
         gp_XYZ srcParam;
         if ( !srcBlock.ComputeParameters( srcCoord, srcParam ))
-          return error(dfltErr(),SMESH_Comment("Can't compute normalized parameters ")
+          return error(SMESH_Comment("Can't compute normalized parameters ")
                        << "for source node " << srcNode->GetID());
         // compute coordinates of target node by srcParam
         gp_XYZ tgtXYZ;
         if ( !tgtBlock.ShellPoint( srcParam, tgtXYZ ))
-          return error(dfltErr(),"Can't compute coordinates by normalized parameters");
+          return error("Can't compute coordinates by normalized parameters");
         // add node
         SMDS_MeshNode* newNode = tgtMeshDS->AddNode( tgtXYZ.X(), tgtXYZ.Y(), tgtXYZ.Z() );
         tgtMeshDS->SetNodeInVolume( newNode, helper.GetSubShapeID() );
index 8a16594023e981506d8590d6d35c411e73d6ec71..f35fabb7325fa9b4a2d912b6469fb04f1fae77eb 100644 (file)
@@ -132,9 +132,10 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
 //=============================================================================
 
 bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
-                                        const TopoDS_Shape& aShape) throw (SALOME_Exception)
+                                        const TopoDS_Shape& aShape)// throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
+  // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+  //Unexpect aCatchSalomeException);
 
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   aMesh.GetSubMesh(aShape);
@@ -562,10 +563,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
 
 FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMesh,
                                                        const TopoDS_Shape & aShape)
-     throw(SALOME_Exception)
+  //throw(SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   const TopoDS_Face & F = TopoDS::Face(aShape);
   const bool ignoreMediumNodes = _quadraticMesh;
 
@@ -645,10 +644,8 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
 FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
                            (SMESH_Mesh &         aMesh,
                             const TopoDS_Shape & aShape,
-                            const bool           CreateQuadratic) throw(SALOME_Exception)
+                            const bool           CreateQuadratic) //throw(SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   _quadraticMesh = CreateQuadratic;
 
   FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
@@ -695,9 +692,8 @@ namespace {
 
 bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
                                                   const TopoDS_Shape& aShape,
-                                                  FaceQuadStruct* & quad) throw (SALOME_Exception)
+                                                  FaceQuadStruct* & quad) //throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
   // Algorithme décrit dans "Génération automatique de maillages"
   // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
   // traitement dans le domaine paramétrique 2d u,v
@@ -738,7 +734,7 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
   const vector<UVPtStruct>& uv_e3 = GetUVPtStructIn( quad, 3, nbvertic - 1 );
 
   if ( uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty() )
-    return error(dfltErr(), "Can't find nodes on sides");
+    return error( "Can't find nodes on sides");
 
   // nodes Id on "in" edges
   if (! quad->isEdgeOut[0]) {
@@ -888,10 +884,7 @@ static gp_UV CalcUV(double x0, double x1, double y0, double y1,
 bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
                                                 const TopoDS_Shape& aShape,
                                                 FaceQuadStruct*     quad)
-  throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   const TopoDS_Face& F = TopoDS::Face(aShape);
   Handle(Geom_Surface) S = BRep_Tool::Surface(F);
index 7fb2b72d10ab954bf2fcb11be1b739edee20abb4..8ee2c77c352f286797e2b3a8f367fabd0c1c18ba 100644 (file)
@@ -45,14 +45,8 @@ enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES };
 typedef uvPtStruct UVPtStruct;
 typedef struct faceQuadStruct
 {
-  //int nbPts[4];
-  //TopoDS_Edge edge[4];
   vector< StdMeshers_FaceSide*> side;
-  //double first[4];
-  //double last[4];
-  //bool isEdgeForward[4];
   bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite
-  //UVPtStruct* uv_edges[4];
   UVPtStruct* uv_grid;
   ~faceQuadStruct();
 } FaceQuadStruct;
@@ -68,32 +62,27 @@ public:
                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
 
   virtual bool Compute(SMESH_Mesh& aMesh,
-                      const TopoDS_Shape& aShape)
-    throw (SALOME_Exception);
+                      const TopoDS_Shape& aShape);
 
   FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
                                    const TopoDS_Shape& aShape,
-                                    const bool CreateQuadratic)
-    throw (SALOME_Exception);
+                                    const bool CreateQuadratic);
 
 protected:
 
   FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh,
-                               const TopoDS_Shape& aShape)
-    throw (SALOME_Exception);
+                               const TopoDS_Shape& aShape);
 
   bool SetNormalizedGrid(SMESH_Mesh& aMesh,
                         const TopoDS_Shape& aShape,
-                        FaceQuadStruct*& quad)
-    throw (SALOME_Exception);
+                        FaceQuadStruct*& quad);
 
   /**
    * Special function for creation only quandrangle faces
    */
   bool ComputeQuadPref(SMESH_Mesh& aMesh,
                        const TopoDS_Shape& aShape,
-                       FaceQuadStruct* quad)
-    throw (SALOME_Exception);
+                       FaceQuadStruct* quad);
 
   UVPtStruct* LoadEdgePoints2(SMESH_Mesh& aMesh,
                              const TopoDS_Face& F, const TopoDS_Edge& E,
index 89946a7aa7668744031b2df0fe35c4cd118950b0..eab107c7688dc96b1e0e9cc2400d88e66eee8101 100644 (file)
@@ -192,7 +192,7 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
     TopoDS_Face outFace = TopoDS::Face( exp.Current() );
     TopoDS_Face inFace;
     if ( !shape2ShapeMap.IsBound( outFace )) {
-      return error(dfltErr(),SMESH_Comment("Corresponding inner face not found for face #" )
+      return error(SMESH_Comment("Corresponding inner face not found for face #" )
                    << meshDS->ShapeToIndex( outFace ));
     } else {
       inFace = TopoDS::Face( shape2ShapeMap( outFace ));
@@ -318,24 +318,24 @@ public:
                 const StdMeshers_LayerDistribution* hyp)
   {
     double len = pIn.Distance( pOut );
-    if ( len <= DBL_MIN ) return error(dfltErr(),"Too close points of inner and outer shells");
+    if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells");
 
     if ( !hyp || !hyp->GetLayerDistribution() )
-      return error(dfltErr(), "Invalid LayerDistribution hypothesis");
+      return error( "Invalid LayerDistribution hypothesis");
     myUsedHyps.clear();
     myUsedHyps.push_back( hyp->GetLayerDistribution() );
 
     TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut );
     SMESH_Hypothesis::Hypothesis_Status aStatus;
     if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus ))
-      return error(dfltErr(), "StdMeshers_Regular_1D::CheckHypothesis() failed"
+      return error( "StdMeshers_Regular_1D::CheckHypothesis() failed"
                    "with LayerDistribution hypothesis");
 
     BRepAdaptor_Curve C3D(edge);
     double f = C3D.FirstParameter(), l = C3D.LastParameter();
     list< double > params;
     if ( !StdMeshers_Regular_1D::computeInternalParameters( C3D, len, f, l, params, false ))
-      return error(dfltErr(),"StdMeshers_Regular_1D failed to compute layers distribution");
+      return error("StdMeshers_Regular_1D failed to compute layers distribution");
 
     positions.clear();
     positions.reserve( params.size() );
index 9e59aa0c6b4a28c654a274a61fd9dee4265ad322..bbbdfbbc028c6cfc59b233ab3a3125a16cdd980b 100644 (file)
@@ -627,7 +627,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(Adaptor3d_Curve& theC3d,
     }
     GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
     if ( !Discret.IsDone() )
-      return error( dfltErr(), "GCPnts_UniformAbscissa failed");
+      return error( "GCPnts_UniformAbscissa failed");
 
     int NbPoints = Discret.NbPoints();
     for ( int i = 2; i < NbPoints; i++ )