Commit de9a241b authored by Yuanxin Liu's avatar Yuanxin Liu
Browse files

particle tracing: fix test failures

- Guard against the boundary condition where the previous termination
  time is the last step in the time sequence.  Also add a test to make
  sure this works.

 - Fix a problem where iterator an empty stl list is decremented,
  which seems to happen on windows.

Change-Id: I31821a421bf5b9e37dc581777c02f77661d1fae5
parent 3d262959
......@@ -462,7 +462,9 @@ int TestParticleTracers(int, char*[])
filter->Update();
pipeline->SetUpdateTimeStep(0, 200.0); //make sure this doesn't crash
filter->Update();
filter->SetIgnorePipelineTime(true);
filter->SetTerminationTime(9.0); //make sure this doesn't crash
filter->Update();
EXPECT(TestParticlePathFilter()==EXIT_SUCCESS,"");
......
......@@ -57,6 +57,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkXMLParticleWriter.h"
#endif
#define DEBUGPARTICLETRACE 1
#include <functional>
#include <algorithm>
#ifdef DEBUGPARTICLETRACE
......@@ -352,7 +353,14 @@ int vtkParticleTracerBase::RequestUpdateExtent(
for (int i=0; i<numInputs; i++)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(i);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(), this->InputTimeValues[this->CurrentTimeStep]);
if(this->CurrentTimeStep < static_cast<int>(this->InputTimeValues.size()))
{
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(), this->InputTimeValues[this->CurrentTimeStep]);
}
else
{
Assert(this->CurrentTime == this->InputTimeValues.back());
}
}
return 1;
......@@ -904,7 +912,11 @@ vtkPolyData* vtkParticleTracerBase::Execute(vtkInformationVector** inputVector)
{
this->ReinjectionCounter += 1;
ParticleListIterator lastParticle = --this->ParticleHistories.end();
ParticleListIterator lastParticle = this->ParticleHistories.end();
if (!this->ParticleHistories.empty())
{
lastParticle--;
}
int seedPointId=0;
this->LocalSeeds.clear();
for (size_t i=0; i<seedSources.size(); i++)
......@@ -914,9 +926,17 @@ vtkPolyData* vtkParticleTracerBase::Execute(vtkInformationVector** inputVector)
this->ParticleInjectionTime.Modified();
this->UpdateParticleList(this->LocalSeeds);
ParticleListIterator itr = lastParticle;
for(++itr; itr!=this->ParticleHistories.end(); ++itr)
if(itr!=this->ParticleHistories.end())
{
itr++;
}
else
{
itr = this->ParticleHistories.begin();
}
for(; itr!=this->ParticleHistories.end(); ++itr)
{
ParticleInformation& info(*lastParticle);
this->Interpolator->TestPoint(info.CurrentPosition.x);
......
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