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,7 +256,47 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, return myPoints; } - // put 2nd vertex node for a last edge + // 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; + 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" + { + u2nodeVec.clear(); + break; + } + double normPar = prevNormPar + r*aLenU/myEdgeLength[i]; + u2nodeVec.push_back( make_pair( normPar, node )); + } + nItr = sm->GetNodes(); + if ( u2nodeVec.empty() ) + 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; + u2nodeVec.push_back( make_pair( normPar, node )); + } + u2node.insert( u2nodeVec.begin(), u2nodeVec.end() ); + + // Put 2nd vertex node for a last edge if ( i+1 == myEdge.size() ) { node = SMESH_Algo::VertexNode( VV[1], meshDS ); if ( !node ) { @@ -264,39 +305,6 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, } u2node.insert( make_pair( 1., node )); } - - // put internal nodes - SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ); - if ( !sm ) continue; - 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]) - { - 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]; - } -#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;