From: eap Date: Fri, 18 May 2007 08:38:37 +0000 (+0000) Subject: PAL14921 (memory limitation and Salome freeze) X-Git-Tag: V3_2_7~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ed35cc5acbe62ee9c08c005864fb513858c009ea;p=modules%2Fsmesh.git PAL14921 (memory limitation and Salome freeze) - Unexpect aCatch(SalomeException); + // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside + //Unexpect aCatch(SalomeException); --- diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index a92e94b84..129c270ee 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -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(); diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.hxx b/src/StdMeshers/StdMeshers_Hexa_3D.hxx index 4d364d4e8..db4d2e60f 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.hxx @@ -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, diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index cb4e61fc1..c919f6a1e 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -517,7 +517,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires, } if ( m + uvPtVec.size()-1 > mefistoToDS.size() ) { MESSAGE("Wrong mefistoToDS.size: "<::const_iterator uvPt = uvPtVec.begin(); diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index d7da4e587..bf4042897 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -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(); } } diff --git a/src/StdMeshers/StdMeshers_Projection_1D.cxx b/src/StdMeshers/StdMeshers_Projection_1D.cxx index 1bfdc41c5..d3d292575 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.cxx @@ -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 diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index c122ea631..687ccc4af 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -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 diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index 68eda5d65..f634ecf2b 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -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() ); diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 8a1659402..f35fabb73 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -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& 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); diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx index 7fb2b72d1..8ee2c77c3 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx @@ -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, diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index 89946a7aa..eab107c76 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -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() ); diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 9e59aa0c6..bbbdfbbc0 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -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++ )