Commit 1fe673cd authored by allens's avatar allens
Browse files

optimized the alogrithm with fewer calculations per step

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23175 18c085ea-50e0-402c-830e-de6fd14e8384
parent b60c3312
......@@ -73,7 +73,7 @@ const char* avtIVPVTKTimeVaryingField::NextTimePrefix = "__pathlineNextTimeVar__
avtIVPVTKTimeVaryingField::avtIVPVTKTimeVaryingField( vtkDataSet* dataset,
avtCellLocator* locator,
double _t0, double _t1 )
: ds(dataset), loc(locator), t0(_t0), t1(_t1)
: ds(dataset), loc(locator), t0(_t0), t1(_t1), dt(_t1-_t0)
{
if( ds )
ds->Register( NULL );
......@@ -82,17 +82,13 @@ avtIVPVTKTimeVaryingField::avtIVPVTKTimeVaryingField( vtkDataSet* dataset,
{
velCellBased = false;
velData[1] =
ds->GetPointData()
->GetArray( NextTimePrefix );
velData[1] = ds->GetPointData()->GetArray( NextTimePrefix );
}
else if( (velData[0] = ds->GetCellData()->GetVectors()) )
{
velCellBased = true;
velData[1] =
ds->GetCellData()
->GetArray( NextTimePrefix );
velData[1] = ds->GetCellData()->GetArray( NextTimePrefix );
}
else
{
......@@ -255,26 +251,32 @@ avtIVPVTKTimeVaryingField::operator()( const double &t, const avtVector &p, avtV
{
double v0[3], v1[3];
double p0 = (t1-t)/dt;
double p1 = (t-t0)/dt;
velData[0]->GetTuple( lastCell, v0 );
velData[1]->GetTuple( lastCell, v1 );
vel.x = (t-t0)/(t1-t0) * v1[0] + (t1-t)/(t1-t0) * v0[0];
vel.y = (t-t0)/(t1-t0) * v1[1] + (t1-t)/(t1-t0) * v0[1];
vel.z = (t-t0)/(t1-t0) * v1[2] + (t1-t)/(t1-t0) * v0[2];
vel.x = p1 * v1[0] + p0 * v0[0];
vel.y = p1 * v1[1] + p0 * v0[1];
vel.z = p1 * v1[2] + p0 * v0[2];
}
else
{
double v0[3], v1[3];
double p0 = (t1-t)/dt;
double p1 = (t-t0)/dt;
for( avtInterpolationWeights::const_iterator wi=lastWeights.begin();
wi!=lastWeights.end(); ++wi )
{
velData[0]->GetTuple( wi->i, v0 );
velData[1]->GetTuple( wi->i, v1 );
v0[0] = (t-t0)/(t1-t0) * v1[0] + (t1-t)/(t1-t0) * v0[0];
v0[1] = (t-t0)/(t1-t0) * v1[1] + (t1-t)/(t1-t0) * v0[1];
v0[2] = (t-t0)/(t1-t0) * v1[2] + (t1-t)/(t1-t0) * v0[2];
v0[0] = p1 * v1[0] + p0 * v0[0];
v0[1] = p1 * v1[1] + p0 * v0[1];
v0[2] = p1 * v1[2] + p0 * v0[2];
vel.x += wi->w * v0[0];
vel.y += wi->w * v0[1];
......@@ -602,4 +604,3 @@ avtIVPVTKTimeVaryingField::GetTimeRange( double range[2] ) const
range[1] = t0;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment