From fee69091255af2c1ad8bf27abc84b75a18436fd4 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 31 Jan 2014 13:43:11 +0000 Subject: [PATCH] 22473: EDF 2825 SMESH: Memory allocation problem with ViscousLayer2D 1) enable recursive calls from StdMeshers_ViscousLayers2D::Compute( aMesh, F ); 2) fix computeQuadDominant() for a case of triangles on 2 sides 3) do not use triaVertex for a quadrangle FACE --- src/StdMeshers/StdMeshers_Quadrangle_2D.cxx | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 7bec7bfca..fd0cdb6ca 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -213,13 +213,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, const TopoDS_Face& F = TopoDS::Face(aShape); aMesh.GetSubMesh( F ); + // do not initialize my fields before this as StdMeshers_ViscousLayers2D + // can call Compute() recursively + SMESH_ProxyMesh::Ptr proxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F ); + if ( !proxyMesh ) + return false; + + myProxyMesh = proxyMesh; + SMESH_MesherHelper helper (aMesh); myHelper = &helper; - myProxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F ); - if ( !myProxyMesh ) - return false; - _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape); myNeedSmooth = false; @@ -463,7 +467,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, int nbright = (int) uv_e1.size(); int nbleft = (int) uv_e3.size(); - if (quad->nbNodeOut(0) && nbvertic == 2) + if (quad->nbNodeOut(0) && nbvertic == 2) // this should not occure { // Down edge is out // @@ -657,7 +661,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } // right or left boundary quadrangles - if (quad->nbNodeOut( QUAD_RIGHT_SIDE ) && nbhoriz == 2) + if (quad->nbNodeOut( QUAD_RIGHT_SIDE ) && nbhoriz == 2) // this should not occure { int g = 0; // last processed node in the grid int stop = nbright - 1; @@ -733,9 +737,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, // MESSAGE("left edge is out"); int g = nbvertic - 1; // last processed node in the grid int stop = 0; - i = nbleft - 1; - if (quad->side[3].from != stop ) stop++; - if (quad->side[3].to != i ) i--; + i = quad->side[ QUAD_LEFT_SIDE ].to-1; // nbleft - 1; for (; i > stop; i--) { const SMDS_MeshNode *a, *b, *c, *d; a = uv_e3[i].node; @@ -3949,7 +3951,8 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, TopoDS_Shape triaVertex = helper.GetMeshDS()->IndexToShape( myTriaVertexID ); if ( !triaVertex.IsNull() && triaVertex.ShapeType() == TopAbs_VERTEX && - helper.IsSubShape( triaVertex, theFace )) + helper.IsSubShape( triaVertex, theFace ) && + ( vertexByAngle.size() != 4 || vertexByAngle.begin()->first < 5 * M_PI/180. )) nbCorners = 3; else triaVertex.Nullify(); -- 2.39.2