From 630691342408423638e133f1888ce3cc8fd9859f Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 6 May 2010 12:08:58 +0000 Subject: [PATCH] fix regression on "imps/A3" test --- src/StdMeshers/StdMeshers_FaceSide.cxx | 77 +++++++++++++++----------- src/StdMeshers/StdMeshers_FaceSide.hxx | 2 + 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 85acfda3f..c0cef600d 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -239,8 +239,9 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, map< double, const SMDS_MeshNode*> u2node; //int nbOnDegen = 0; - for ( int i = 0; i < myEdge.size(); ++i ) { - // put 1st vertex node + for ( int i = 0; i < myEdge.size(); ++i ) + { + // Put 1st vertex node of a current edge TopoDS_Vertex VV[2]; // TopExp::FirstVertex() returns NULL for INTERNAL edge for ( TopoDS_Iterator vIt(myEdge[i]); vIt.More(); vIt.Next() ) VV[ VV[0].IsNull() ? 0 : 1 ] = TopoDS::Vertex(vIt.Value()); @@ -255,47 +256,54 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, return myPoints; } - // put 2nd vertex node for a last edge - if ( i+1 == myEdge.size() ) { - node = SMESH_Algo::VertexNode( VV[1], meshDS ); - if ( !node ) { - MESSAGE(" NO NODE on VERTEX" ); - return myPoints; - } - u2node.insert( make_pair( 1., node )); - } - - // put internal nodes + // Put internal nodes SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ); if ( !sm ) continue; + vector< pair< double, const SMDS_MeshNode*> > u2nodeVec; + u2nodeVec.reserve( sm->NbNodes() ); SMDS_NodeIteratorPtr nItr = sm->GetNodes(); double paramSize = myLast[i] - myFirst[i]; double r = myNormPar[i] - prevNormPar; - while ( nItr->more() ) - { - const SMDS_MeshNode* node = nItr->next(); - if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge )) - continue; - double u = helper.GetNodeU( myEdge[i], node, ¶mOK ); - - // paramSize is signed so orientation is taken into account - double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize; - if(!myIsUniform[i]) + if ( !myIsUniform[i] ) + while ( nItr->more() ) { + const SMDS_MeshNode* node = nItr->next(); + if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge )) + continue; + double u = helper.GetNodeU( myEdge[i], node, ¶mOK ); double aLenU = GCPnts_AbscissaPoint::Length ( const_cast( myC3dAdaptor[i]), myFirst[i], u ); - if ( myEdgeLength[i] > aLenU ) // nonregression test "3D_mesh_NETGEN/G6" - normPar = prevNormPar + r*aLenU/myEdgeLength[i]; + if ( myEdgeLength[i] < aLenU ) // nonregression test "3D_mesh_NETGEN/G6" + { + u2nodeVec.clear(); + break; + } + double normPar = prevNormPar + r*aLenU/myEdgeLength[i]; + u2nodeVec.push_back( make_pair( normPar, node )); } -#ifdef _DEBUG_ - if ( normPar > 1 || normPar < 0) { - dump("DEBUG"); - MESSAGE ( "WRONG normPar: "< 1 ) { reverse( myEdge ); reverse( myC2d ); + reverse( myC3dAdaptor ); reverse( myFirst ); reverse( myLast ); reverse( myNormPar ); + reverse( myEdgeLength ); + reverse( myIsUniform ); } myNormPar[nbEdges-1]=1.; myPoints.clear(); diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 9c1d05fbb..69d3f87a8 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -198,6 +198,8 @@ public: protected: + + // DON't FORGET tO update Reverse() when adding one more vector! std::vector myPoints, myFalsePoints; std::vector myEdge; std::vector myC2d; -- 2.39.2