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
This commit is contained in:
eap 2014-01-31 13:43:11 +00:00
parent ae475d83da
commit fee6909125

View File

@ -213,13 +213,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
const TopoDS_Face& F = TopoDS::Face(aShape); const TopoDS_Face& F = TopoDS::Face(aShape);
aMesh.GetSubMesh( F ); 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); SMESH_MesherHelper helper (aMesh);
myHelper = &helper; myHelper = &helper;
myProxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F );
if ( !myProxyMesh )
return false;
_quadraticMesh = myHelper->IsQuadraticSubMesh(aShape); _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
myNeedSmooth = false; myNeedSmooth = false;
@ -463,7 +467,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
int nbright = (int) uv_e1.size(); int nbright = (int) uv_e1.size();
int nbleft = (int) uv_e3.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 // Down edge is out
// //
@ -657,7 +661,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
} }
// right or left boundary quadrangles // 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 g = 0; // last processed node in the grid
int stop = nbright - 1; int stop = nbright - 1;
@ -733,9 +737,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
// MESSAGE("left edge is out"); // MESSAGE("left edge is out");
int g = nbvertic - 1; // last processed node in the grid int g = nbvertic - 1; // last processed node in the grid
int stop = 0; int stop = 0;
i = nbleft - 1; i = quad->side[ QUAD_LEFT_SIDE ].to-1; // nbleft - 1;
if (quad->side[3].from != stop ) stop++;
if (quad->side[3].to != i ) i--;
for (; i > stop; i--) { for (; i > stop; i--) {
const SMDS_MeshNode *a, *b, *c, *d; const SMDS_MeshNode *a, *b, *c, *d;
a = uv_e3[i].node; 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 ); TopoDS_Shape triaVertex = helper.GetMeshDS()->IndexToShape( myTriaVertexID );
if ( !triaVertex.IsNull() && if ( !triaVertex.IsNull() &&
triaVertex.ShapeType() == TopAbs_VERTEX && triaVertex.ShapeType() == TopAbs_VERTEX &&
helper.IsSubShape( triaVertex, theFace )) helper.IsSubShape( triaVertex, theFace ) &&
( vertexByAngle.size() != 4 || vertexByAngle.begin()->first < 5 * M_PI/180. ))
nbCorners = 3; nbCorners = 3;
else else
triaVertex.Nullify(); triaVertex.Nullify();