From: eap Date: Mon, 5 Mar 2007 16:15:11 +0000 (+0000) Subject: fix PAL15141 (Hypothesis "Composite side discretization" does not work) X-Git-Tag: V3_2_6pre2~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7e6987663fd5e0ea42b1287f7226d6c7f837bdce;p=modules%2Fsmesh.git fix PAL15141 (Hypothesis "Composite side discretization" does not work) search also backward from the first edge in a wire --- diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 79e56a799..399436890 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -137,8 +137,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); aMesh.GetSubMesh(aShape); - myTool = new SMESH_MesherHelper(aMesh); - std::auto_ptr helperDeleter( myTool );// to delete helper at exit from Compute() + SMESH_MesherHelper helper(aMesh); + myTool = &helper; _quadraticMesh = myTool->IsQuadraticSubMesh(aShape); @@ -578,35 +578,54 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes } FaceQuadStruct* quad = new FaceQuadStruct; quad->uv_grid = 0; - for ( int i = 0; i < NB_SIDES; ++i ) - quad->side[i] = 0; + quad->side.reserve(nbEdgesInWire.front()); int nbSides = 0; list< TopoDS_Edge >::iterator edgeIt = edges.begin(); if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ ) - quad->side[nbSides] = new StdMeshers_FaceSide(F, *edgeIt, &aMesh, - nbSidesside.push_back( new StdMeshers_FaceSide(F, *edgeIt, &aMesh, + nbSides 4 ) { // more than 4 edges - try to unite some list< TopoDS_Edge > sideEdges; - while ( edgeIt != edges.end()) { + while ( !edges.empty()) { sideEdges.clear(); - sideEdges.push_back( *edgeIt++ ); + sideEdges.splice( sideEdges.end(), edges, edges.begin()); // edges.front() -> sideEdges.end() bool sameSide = true; - while ( edgeIt != edges.end() && sameSide ) { - GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.back(), *edgeIt ); + while ( !edges.empty() && sameSide ) { + GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.back(), edges.front() ); sameSide = ( cont >= GeomAbs_C1 ); if ( sameSide ) - sideEdges.push_back( *edgeIt++ ); + sideEdges.splice( sideEdges.end(), edges, edges.begin()); } - quad->side[nbSides] = new StdMeshers_FaceSide(F, sideEdges, &aMesh, - nbSides= GeomAbs_C1 ); + if ( sameSide ) + sideEdges.splice( sideEdges.begin(), edges, --edges.end()); + } + } + quad->side.push_back( new StdMeshers_FaceSide(F, sideEdges, &aMesh, + nbSidesside[i]->NbEdges(); ++e ) + cout << myTool->GetMeshDS()->ShapeToIndex( quad->side[i]->Edge( e )) << " "; + cout << ")"; + } + cout << endl; +#else INFOS("face must have 4 edges / quadrangle"); +#endif delete quad; quad = 0; } @@ -647,7 +666,7 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute faceQuadStruct::~faceQuadStruct() { - for (int i = 0; i < 4; i++) { + for (int i = 0; i < side.size(); i++) { if (side[i]) delete side[i]; //if (uv_edges[i]) delete [] uv_edges[i]; } diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx index 1bc272a5c..7fb2b72d1 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx @@ -47,7 +47,7 @@ typedef struct faceQuadStruct { //int nbPts[4]; //TopoDS_Edge edge[4]; - StdMeshers_FaceSide* side[4]; + vector< StdMeshers_FaceSide*> side; //double first[4]; //double last[4]; //bool isEdgeForward[4];