From e096680dda4a887f1bd27252dbe482c04be3ceb9 Mon Sep 17 00:00:00 2001 From: skl Date: Tue, 16 Feb 2010 11:07:53 +0000 Subject: [PATCH] Changes for bug 0020681. --- src/StdMeshers/StdMeshers_Regular_1D.cxx | 39 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 6dbc67bac..f4fa4a18e 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -804,20 +804,31 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, } if(!IsExist) Params.InsertBefore(j,aPnts[i]); } - double par2, par1; + double par2, par1, lp; par1 = f; + lp = l; + double sign = 1.0; + if(theReverse) { + par1 = l; + lp = f; + sign = -1.0; + } double eltSize, segmentSize = 0.; double currAbscissa = 0; for(i=0; i nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i]; segmentSize = Params.Value(i+1)*theLength - currAbscissa; currAbscissa += segmentSize; - GCPnts_AbscissaPoint APnt(theC3d, segmentSize, par1); + GCPnts_AbscissaPoint APnt(theC3d, sign*segmentSize, par1); if( !APnt.IsDone() ) return error( "GCPnts_AbscissaPoint failed"); par2 = APnt.Parameter(); eltSize = segmentSize/nbseg; GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, par2); + if(theReverse) + Discret.Initialize(theC3d, eltSize, par2, par1); + else + Discret.Initialize(theC3d, eltSize, par1, par2); if ( !Discret.IsDone() ) return error( "GCPnts_UniformAbscissa failed"); int NbPoints = Discret.NbPoints(); @@ -826,7 +837,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double param = Discret.Parameter(i); tmpParams.push_back( param ); } - compensateError( eltSize, eltSize, par1, par2, theLength, theC3d, tmpParams ); + if (theReverse) { + compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams ); + tmpParams.reverse(); + } + else { + compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams ); + } list::iterator itP = tmpParams.begin(); for(; itP != tmpParams.end(); itP++) { theParams.push_back( *(itP) ); @@ -837,9 +854,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, } // add for last int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0]; - segmentSize = theLength - segmentSize; + segmentSize = theLength - currAbscissa; eltSize = segmentSize/nbseg; - GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, l); + GCPnts_UniformAbscissa Discret; + if(theReverse) + Discret.Initialize(theC3d, eltSize, par1, lp); + else + Discret.Initialize(theC3d, eltSize, lp, par1); if ( !Discret.IsDone() ) return error( "GCPnts_UniformAbscissa failed"); int NbPoints = Discret.NbPoints(); @@ -848,7 +869,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double param = Discret.Parameter(i); tmpParams.push_back( param ); } - compensateError(eltSize, eltSize, par1, l, segmentSize, theC3d, tmpParams); + if (theReverse) { + compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams ); + tmpParams.reverse(); + } + else { + compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams ); + } list::iterator itP = tmpParams.begin(); for(; itP != tmpParams.end(); itP++) { theParams.push_back( *(itP) ); -- 2.39.2