Commit 4aa39abd authored by Yuanxin Liu's avatar Yuanxin Liu
Browse files

vtkParticleTracerBase:: Better Handling of one time step input

Previously, such input is skipped. After the change, such input is
processed anyways. This is important in a co-processing workflow.

Change-Id: I89059aa1a5e843d9b8deafe8a219b99016a47123
parent de9a241b
......@@ -57,7 +57,6 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkXMLParticleWriter.h"
#endif
#define DEBUGPARTICLETRACE 1
#include <functional>
#include <algorithm>
#ifdef DEBUGPARTICLETRACE
......@@ -256,13 +255,9 @@ int vtkParticleTracerBase::RequestInformation(
this->InputTimeValues.resize(numberOfInputTimeSteps);
inInfo->Get( vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
&this->InputTimeValues[0] );
if (numberOfInputTimeSteps==1)
if (numberOfInputTimeSteps==1 && this->DisableResetCache==0) //warning would be skipped in coprocessing work flow
{
if(this->DisableResetCache==0) //warning would be skipped in coprocessing work flow
{
vtkWarningMacro(<<"Not enough input time steps for particle integration");
}
return 1;
vtkWarningMacro(<<"Not enough input time steps for particle integration");
}
}
else
......@@ -294,15 +289,6 @@ int vtkParticleTracerBase::RequestUpdateExtent(
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
if (this->InputTimeValues.size()<=1)
{
if(this->DisableResetCache==0) //warning would be skipped in coprocessing work flow
{
vtkWarningMacro(<<"Not enough input time steps for particle integration");
}
return 1;
}
int numInputs = inputVector[0]->GetNumberOfInformationObjects();
vtkInformation *outInfo = outputVector->GetInformationObject(0);
......@@ -313,7 +299,21 @@ int vtkParticleTracerBase::RequestUpdateExtent(
// do this only for the first time
if(this->FirstIteration)
{
this->StartTimeStep = FindInterval(StartTime, InputTimeValues);
if(this->InputTimeValues.size()==1)
{
this->StartTimeStep = this->InputTimeValues[0]==this->StartTime? 0 : -1;
}
else
{
this->StartTimeStep = FindInterval(this->StartTime, this->InputTimeValues);
}
if(this->StartTimeStep<0)
{
vtkErrorMacro("Start time not in time range");
return 0;
}
if (!this->IgnorePipelineTime && outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
{
double terminationTime = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
......@@ -326,7 +326,20 @@ int vtkParticleTracerBase::RequestUpdateExtent(
this->TerminationTime = this->InputTimeValues.back();
}
this->TerminationTimeStep = FindInterval(this->TerminationTime, this->InputTimeValues)+1;
if(this->InputTimeValues.size()==1)
{
this->TerminationTimeStep = this->TerminationTime == this->InputTimeValues[0]? 0 : -1;
}
else
{
this->TerminationTimeStep = FindInterval(this->TerminationTime, this->InputTimeValues)+1;
}
if(this->TerminationTimeStep<0)
{
vtkErrorMacro("Termination time not in time range");
return 0;
}
for(int i=0; i<this->GetNumberOfInputPorts(); i++)
{
......@@ -979,15 +992,6 @@ int vtkParticleTracerBase::RequestData(
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
if (this->InputTimeValues.size()<=1)
{
if(this->DisableResetCache==0) //warning would be skipped in coprocessing work flow
{
vtkWarningMacro(<<"Not enough input time steps for particle integration");
}
return 1;
}
PRINT("RD start: "<<this->CurrentTimeStep<<" "<<this->CurrentTime<<" "<<this->StartTimeStep<<" "<<this->TerminationTimeStep);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
......
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