From 7f18f75436555a166cd36bb245804705d2b531ed Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 22 Apr 2010 13:32:59 +0000 Subject: [PATCH] Regress of 3D_mesh_NETGEN/G6 test * avoid pb that for internal node GCPnts_AbscissaPoint::Length() return value larger than total edge length * cash values used for work with non-uniformly paramtrized edges --- src/StdMeshers/StdMeshers_FaceSide.cxx | 102 +++++++++++-------------- src/StdMeshers/StdMeshers_FaceSide.hxx | 8 +- 2 files changed, 50 insertions(+), 60 deletions(-) diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index f95693298..32f798dee 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -92,9 +92,12 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, int nbEdges = theEdges.size(); myEdge.resize( nbEdges ); myC2d.resize( nbEdges ); + myC3dAdaptor.resize( nbEdges ); myFirst.resize( nbEdges ); myLast.resize( nbEdges ); myNormPar.resize( nbEdges ); + myEdgeLength.resize( nbEdges ); + myIsUniform.resize( nbEdges ); myLength = 0; myNbPonits = myNbSegments = 0; myMesh = theMesh; @@ -104,7 +107,6 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, if ( nbEdges == 0 ) return; SMESHDS_Mesh* meshDS = theMesh->GetMeshDS(); - vector len( nbEdges ); int nbDegen = 0; list::iterator edge = theEdges.begin(); @@ -112,9 +114,9 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, for ( int index = 0; edge != theEdges.end(); ++index, ++edge ) { int i = theIsForward ? index : nbEdges - index - 1; - len[i] = SMESH_Algo::EdgeLength( *edge ); - if ( len[i] < DBL_MIN ) nbDegen++; - myLength += len[i]; + myEdgeLength[i] = SMESH_Algo::EdgeLength( *edge ); + if ( myEdgeLength[i] < DBL_MIN ) nbDegen++; + myLength += myEdgeLength[i]; myEdge[i] = *edge; if ( !theIsForward ) myEdge[i].Reverse(); @@ -142,6 +144,24 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, myNbPonits += 1; // for the first end else myMissingVertexNodes = true; + + // check if edge has non-uniform parametrization (issue 0020705) + if ( !myC2d[i].IsNull() ) + { + Geom2dAdaptor_Curve A2dC( myC2d[i] ); + double p2 = myFirst[i]+(myLast[i]-myFirst[i])/2., p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.; + double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 ); + double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 ); + //cout<<"len = "< 1 || normPar < 0) { @@ -552,19 +547,11 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const double par = myFirst[i] * ( 1 - r ) + myLast[i] * r; // check parametrization of curve - if( !IsUniform( myC2d[i], myFirst[i], myLast[i] ) ) { - double fp,lp; - TopLoc_Location L; - Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],L,fp,lp); - fp = myFirst[i]; - lp = myLast[i]; - GeomAdaptor_Curve A3dC( C3d ); - double aLen3d = GCPnts_AbscissaPoint::Length( A3dC, fp, lp ); - double aLen3dU = aLen3d*r; - if(fp>lp) { - aLen3dU = -aLen3dU; - } - GCPnts_AbscissaPoint AbPnt( A3dC, aLen3dU, fp ); + if( !myIsUniform[i] ) + { + double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.); + GCPnts_AbscissaPoint AbPnt + ( const_cast( myC3dAdaptor[i]), aLen3dU, myFirst[i] ); if( AbPnt.IsDone() ) { par = AbPnt.Parameter(); } @@ -572,7 +559,6 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const return myC2d[ i ]->Value(par); } - //return gp_Pnt2d( 1e+100, 1e+100 ); return myDefaultPnt2d; } diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 3fd8b81b3..9c1d05fbb 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -29,10 +29,11 @@ #ifndef StdMeshers_FaceSide_HeaderFile #define StdMeshers_FaceSide_HeaderFile -#include +#include +#include #include #include -#include +#include #include "SMESH_StdMeshers.hxx" @@ -200,8 +201,11 @@ protected: std::vector myPoints, myFalsePoints; std::vector myEdge; std::vector myC2d; + std::vector myC3dAdaptor; std::vector myFirst, myLast; std::vector myNormPar; + std::vector myEdgeLength; + std::vector myIsUniform; double myLength; int myNbPonits, myNbSegments; SMESH_Mesh* myMesh; -- 2.39.2