Changes for bug 0020681.

This commit is contained in:
skl 2010-02-16 09:19:59 +00:00
parent 4bb95af61f
commit 68b6c38588

View File

@ -804,38 +804,56 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
} }
if(!IsExist) Params.InsertBefore(j,aPnts[i]); if(!IsExist) Params.InsertBefore(j,aPnts[i]);
} }
double pf, pl, par2, par1, psize; double par2, par1;
if (theReverse) { par1 = f;
pf = l; double eltSize, segmentSize = 0.;
pl = f; double currAbscissa = 0;
}
else {
pf = f;
pl = l;
}
psize = pl - pf;
par1 = pf;
//cout<<"aPnts.size() = "<<aPnts.size()<<" Params.Length() = "
// <<Params.Length()<<" nbsegs.size() = "<<nbsegs.size()<<endl;
for(i=0; i<Params.Length(); i++) { for(i=0; i<Params.Length(); i++) {
par2 = pf + Params.Value(i+1)*psize;
int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i]; int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
double dp = (par2-par1)/nbseg; segmentSize = Params.Value(i+1)*theLength - currAbscissa;
int j = 1; currAbscissa += segmentSize;
for(; j<=nbseg; j++) { GCPnts_AbscissaPoint APnt(theC3d, segmentSize, par1);
double param = par1 + dp*j; if( !APnt.IsDone() )
theParams.push_back( param ); return error( "GCPnts_AbscissaPoint failed");
par2 = APnt.Parameter();
eltSize = segmentSize/nbseg;
GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, par2);
if ( !Discret.IsDone() )
return error( "GCPnts_UniformAbscissa failed");
int NbPoints = Discret.NbPoints();
list<double> tmpParams;
for(int i=2; i<NbPoints; i++) {
double param = Discret.Parameter(i);
tmpParams.push_back( param );
} }
compensateError( eltSize, eltSize, par1, par2, theLength, theC3d, tmpParams );
list<double>::iterator itP = tmpParams.begin();
for(; itP != tmpParams.end(); itP++) {
theParams.push_back( *(itP) );
}
theParams.push_back( par2 );
par1 = par2; par1 = par2;
} }
// add for last // add for last
int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0]; int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
double dp = (pl-par1)/nbseg; segmentSize = theLength - segmentSize;
int j = 1; eltSize = segmentSize/nbseg;
for(; j<nbseg; j++) { GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, l);
double param = par1 + dp*j; if ( !Discret.IsDone() )
theParams.push_back( param ); return error( "GCPnts_UniformAbscissa failed");
int NbPoints = Discret.NbPoints();
list<double> tmpParams;
for(int i=2; i<NbPoints; i++) {
double param = Discret.Parameter(i);
tmpParams.push_back( param );
} }
compensateError(eltSize, eltSize, par1, l, segmentSize, theC3d, tmpParams);
list<double>::iterator itP = tmpParams.begin();
for(; itP != tmpParams.end(); itP++) {
theParams.push_back( *(itP) );
}
if (theReverse) { if (theReverse) {
theParams.reverse(); // NPAL18025 theParams.reverse(); // NPAL18025
} }