[Paraview] UPDATE_TIME_INDEX not part of Paraview 2.6

John Biddiscombe biddisco at cscs.ch
Wed Feb 7 03:14:10 EST 2007


Mike, The time handling has changed a bit recently. TIME_INDEX is no 
longer supported (partly because you may have 100 time steps of data 
with step number 34 missing, if step 35 is requested, do they want the 
35th of the data you actually have, or the 35th of the data you would 
have if the steps were all present). Instead, use a time value which is 
real and represents the actual time.(this also allows source which can 
produce a continuum of time values to be accessed)

To get things right, try this

//----------------------------------------------------------------------------

In RequestInformation, make sure you export the steps you can produce 
(often just 1.0, 2.0, 3.0.....etc)

  outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
               &this->TimeStepValues[0], this->TimeStepValues.size());

    where you may have std::vector<double> TimeStepValues - with the 
values pushed back when the file is opened

//----------------------------------------------------------------------------

In RequestData, check to see which time step was requested, this usually 
will be set in the GUI via SetTimeStep, but might be passed into the 
filter from downstream, if another filter is requesting data from a 
particular step

  this->ActualTimeStep = this->TimeStep; // set by the gui, but we will 
override this if the pipeline requested another

  if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
    {
    double requestedTimeValue = 
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS())[0];
    // this is overkill, I use it to ensure that if a time value which 
is slightly out is requested
    // then the correct one is fetched
    this->ActualTimeStep = vtkstd::find_if(
      this->TimeStepValues.begin(),
      this->TimeStepValues.end(),
      vtkstd::bind2nd( WithinTolerance( ), requestedTimeValue ))
      - this->TimeStepValues.begin();
    this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0];
    doOutput->GetInformation()->Set(vtkDataObject::DATA_TIME_STEPS(), 
&requestedTimeValue, 1);
    CSCSOutputMacro(<<"Got a timestep request from downstream t= " << 
requestedTimeValue << " Step : " << this->ActualTimeStep);
    }
  else
    {
    double timevalue[1];
    timevalue[0] = 
this->TimeStepValues[this->ActualTimeStep-this->TimeStepRange[0]];
    CSCSOutputMacro(<<"Using manually set t= " << timevalue[0] << " Step 
: " << this->ActualTimeStep);
    doOutput->GetInformation()->Set(vtkDataObject::DATA_TIME_STEPS(), 
&timevalue[0], 1);
    }

//----------------------------------------------------------------------------
note that

class WithinTolerance: public std::binary_function<double, double, bool>
{
public:
    result_type operator()(first_argument_type a, second_argument_type 
b) const
    {
      bool result = (fabs(a-b)<=(a*1E-6));
      return (result_type)result;
    }
};

if you want to see a filter that uses the above code and works well, 
look here
https://svn.cscs.ch/vtkContrib/trunk/vtkCSCS/vtkOpenDX/
for my openDX reader which is the most simple one I've made that uses 
the above code.

JB
> I was trying to recompile my ParaView modules and I get the error:
>
> /Users/mjackson/Task_4/Workspace/PVDislocation/vtkPrdsDislocationReader.cpp:80: 
> error: 'UPDATE_TIME_INDEX' is not a member of 
> 'vtkStreamingDemandDrivenPipeline'
>
> The offending line is:
>   outInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_INDEX(), 
> this->GetTimeStep() );
>
> This used to work in ParaView 2.4.4 and I vaguely remember that time 
> support was being changed in PV 2.6. Could someone explain what I 
> should be using now?
>
> I have written a custom ParaView reader module for our file format. I 
> need Time Support and I was successfully using this code in PV 2.4.
>
> Thanks
> --Mike Jackson   Senior Research Engineer
> Innovative Management & Technology Services
>
>
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the ParaView mailing list