VTK  9.4.20250131
Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkTemporalAlgorithm< AlgorithmT > Class Template Referenceabstract

Base class for temporal algorithms. More...

#include <vtkTemporalAlgorithm.h>

Inherits AlgorithmT.

Collaboration diagram for vtkTemporalAlgorithm< AlgorithmT >:
[legend]

Public Member Functions

 vtkTemplateTypeMacro (vtkTemporalAlgorithm, AlgorithmT)
 Standard methods for instantiation, type information, and printing.
 

Static Public Member Functions

static const char * TimeStepsArrayName ()
 When vtkStreamingDemandDrivenPipeline::NO_PRIOR_TEMPORAL_ACCESS() is set, an array with this name is populated in the output's field data listing all the time steps executed so far.
 

Protected Member Functions

 vtkTemporalAlgorithm ()
 
int RequestInformation (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
 
int RequestUpdateTime (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
 
int RequestUpdateExtent (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
 
int RequestData (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
 
virtual int Initialize (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
 Method called at first temporal iteration.
 
virtual int Execute (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
 Method called at each time step.
 
virtual int Finalize (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
 Method that converts the temporal cache into the outputs.
 
int GetCurrentTimeIndex () const
 Returns the current time index being executed (or finalized).
 
double GetCurrentTimeStep () const
 Returns the current time step being executed (or finalized).
 
bool MustReset () const
 Returns true if the cache must be reinitialized before executing the current time step.
 
bool MustContinue () const
 Returns true if there are time steps missing that must be requested upstream.
 

Protected Attributes

bool IntegrateFullTimeSeries = false
 To be set in the constructon.
 
bool RunBackward = false
 When turned on, time steps will be requested backward upstream.
 
bool NoPriorTimeStepAccess = false
 When true, the algorithm calls Finalize at each iteration.
 
vtkNew< vtkDoubleArrayProcessedTimeSteps
 Array only used when the information key NO_PRIOR_TEMPORAL_ACCESS() is set.
 
std::vector< double > InputTimeSteps
 When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.
 
int TerminationTimeIndex = 0
 When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.
 
int CurrentTimeIndex = 0
 When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.
 

Detailed Description

template<class AlgorithmT>
class vtkTemporalAlgorithm< AlgorithmT >

Base class for temporal algorithms.

vtkTemporalAlgorithm is a class to template over a subclass of vtkAlgorithm. It effectively implements RequestData, which, depending on the request, will call Initialize, ‘Execute’ and / or Finalize. Algorithms subclassing vtkTemporalAlgorithm should provide a temporal cache that on which to accumulate data in order to provide a complete output upon calling Finalize. This algorithm class assumes temporal integration over input port 0, connection 0. Time steps are gathered from its input information, and UPDATE_TIME_STEP() requests are propagated to this input connection only. Filters taking multiple time series as inputs should probably not inherit from this class.

This class of algorithm handles 2 types of temporal integration, controlled by the member IntegrateFullTimeSeries:

In any case, this algorithm will request all necessary time steps upstream in order to generate the output, in chronological order, setting the information key CONTINUE_EXECUTING(). The executive of this filter will iterate over all time requests until the output is generating. Initialize will be called if the requested time step is more ancient than the last generated time step. Then, at each iteration, Execute is called. Finally, when the last needed iteration has completed, Finalize is called.

There are cases where the user does not have access to the entire time series at once. This compromises filters that have IntegrateFullTimeSeries ON, and which rely on knowledge provided by the information key TIME_STEPS(). The implementation of this algorithm provides a specal mode for such circumstences. All the user needs to do is set the information key NO_PRIOR_TEMPORAL_ACCESS() in the sources. If the information key NO_PRIOR_TEMPORAL_ACCESS() is set on the first input on port 0, then this class will assume that the user is requesing time steps in chronological order using UpdateTimeStep(double) and will provide a complete output at each temporal iteration. Effectively, at each iteration, Execute and Finalize are called. Initialize is called at the first iteration, or when NO_PRIOR_TEMPORAL_ACCESS() is set to vtkStreamingDemandDrivenPipeline::NO_PRIOR_TEMPORAL_ACCESS_RESET. Processed time steps are gathered in an array added to the field data of the outputs. The name of this array is time_steps and can be retrieved through the method TimeStepsArrayName().

Warning
Python wrapping of subclasses require special handling. Here is an example ensuring wrapping works as expected, implementing a temporal algorithm as a vtkPassInputTypeAlgorithm:
#ifndef __VTK_WRAP__
#define vtkPassInputTypeAlgorithm vtkTemporalAlgorithm<vtkPassInputTypeAlgorithm>
#endif
// We make the wrapper think that we inherit from vtkPassInputTypeAlgorithm
class MyTemporalFilter : vtkPassInputTypeAlgorithm
{
public:
vtkTypeMacro(MyTemporalFilter, vtkPassInputTypeAlgorithm);
// We do not need to trick the wrapper with the superclass name anymore
#ifndef __VTK_WRAP__
#undef vtkPassInputTypeAlgorithm
#endif
// We didn't wrap the non-overridden API of vtkTemporalAlgorithm. We define
// the missing API using this macro
#if defined(__VTK_WRAP__) || defined(__WRAP_GCCXML)
#endif
// ...
};
Superclass for algorithms that produce output of the same type as input.
#define vtkCreateWrappedTemporalAlgorithmInterface()

Definition at line 93 of file vtkTemporalAlgorithm.h.

Constructor & Destructor Documentation

◆ vtkTemporalAlgorithm()

template<class AlgorithmT >
vtkTemporalAlgorithm< AlgorithmT >::vtkTemporalAlgorithm ( )
protected

Member Function Documentation

◆ vtkTemplateTypeMacro()

template<class AlgorithmT >
vtkTemporalAlgorithm< AlgorithmT >::vtkTemplateTypeMacro ( vtkTemporalAlgorithm< AlgorithmT >  ,
AlgorithmT   
)

Standard methods for instantiation, type information, and printing.

◆ TimeStepsArrayName()

template<class AlgorithmT >
static const char * vtkTemporalAlgorithm< AlgorithmT >::TimeStepsArrayName ( )
inlinestatic

When vtkStreamingDemandDrivenPipeline::NO_PRIOR_TEMPORAL_ACCESS() is set, an array with this name is populated in the output's field data listing all the time steps executed so far.

Definition at line 107 of file vtkTemporalAlgorithm.h.

◆ RequestInformation()

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::RequestInformation ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
overrideprotected

◆ RequestUpdateTime()

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::RequestUpdateTime ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
overrideprotected

◆ RequestUpdateExtent()

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::RequestUpdateExtent ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
overrideprotected

◆ RequestData()

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::RequestData ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
overrideprotected

◆ Initialize()

template<class AlgorithmT >
virtual int vtkTemporalAlgorithm< AlgorithmT >::Initialize ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
protectedpure virtual

Method called at first temporal iteration.

This method wipes any temporal cache that could be maintained and sets up all the internals needed to run Execute properly. The parameters are passed as is by RequestData.

Warning
Within this method, GetCurrentTimeIndex and GetCurrentTimeStep should not be called. One can assume the current index is 0.

◆ Execute()

template<class AlgorithmT >
virtual int vtkTemporalAlgorithm< AlgorithmT >::Execute ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
protectedpure virtual

Method called at each time step.

The temporal cache is updated to represent the data available in the input. The parameters are passed as is by RequestData.

◆ Finalize()

template<class AlgorithmT >
virtual int vtkTemporalAlgorithm< AlgorithmT >::Finalize ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
)
protectedpure virtual

Method that converts the temporal cache into the outputs.

The parameters are passed as is by RequestData.

◆ GetCurrentTimeIndex()

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::GetCurrentTimeIndex ( ) const
protected

Returns the current time index being executed (or finalized).

First iteration is indexed at 0.

◆ GetCurrentTimeStep()

template<class AlgorithmT >
double vtkTemporalAlgorithm< AlgorithmT >::GetCurrentTimeStep ( ) const
protected

Returns the current time step being executed (or finalized).

◆ MustReset()

template<class AlgorithmT >
bool vtkTemporalAlgorithm< AlgorithmT >::MustReset ( ) const
protected

Returns true if the cache must be reinitialized before executing the current time step.

◆ MustContinue()

template<class AlgorithmT >
bool vtkTemporalAlgorithm< AlgorithmT >::MustContinue ( ) const
protected

Returns true if there are time steps missing that must be requested upstream.

Member Data Documentation

◆ IntegrateFullTimeSeries

template<class AlgorithmT >
bool vtkTemporalAlgorithm< AlgorithmT >::IntegrateFullTimeSeries = false
protected

To be set in the constructon.

If true, all time steps are requested upstream for any requested time step dowstream. Downstream effectively lose temporality. Otherwise, the algorithm integrates inputs up to the requested time step.

Definition at line 165 of file vtkTemporalAlgorithm.h.

◆ RunBackward

template<class AlgorithmT >
bool vtkTemporalAlgorithm< AlgorithmT >::RunBackward = false
protected

When turned on, time steps will be requested backward upstream.

Warning
This is deprecated. This is only here for one release cycle for backward compatibility of some subclasses. Please avoid setting this.

Definition at line 173 of file vtkTemporalAlgorithm.h.

◆ InputTimeSteps

template<class AlgorithmT >
std::vector<double> vtkTemporalAlgorithm< AlgorithmT >::InputTimeSteps
protected

When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.

Definition at line 180 of file vtkTemporalAlgorithm.h.

◆ TerminationTimeIndex

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::TerminationTimeIndex = 0
protected

When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.

Definition at line 181 of file vtkTemporalAlgorithm.h.

◆ CurrentTimeIndex

template<class AlgorithmT >
int vtkTemporalAlgorithm< AlgorithmT >::CurrentTimeIndex = 0
protected

When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to keep track of which iteration we are currently executing, and when to terminate.

Definition at line 182 of file vtkTemporalAlgorithm.h.

◆ NoPriorTimeStepAccess

template<class AlgorithmT >
bool vtkTemporalAlgorithm< AlgorithmT >::NoPriorTimeStepAccess = false
protected

When true, the algorithm calls Finalize at each iteration.

It is set to true if the first input on port 0 has set the information key NO_PRIOR_TEMPORAL_ACCESS(). It is typically set for in situ visualization.

Definition at line 200 of file vtkTemporalAlgorithm.h.

◆ ProcessedTimeSteps

template<class AlgorithmT >
vtkNew<vtkDoubleArray> vtkTemporalAlgorithm< AlgorithmT >::ProcessedTimeSteps
protected

Array only used when the information key NO_PRIOR_TEMPORAL_ACCESS() is set.

It is put in the output's field data.

Definition at line 206 of file vtkTemporalAlgorithm.h.


The documentation for this class was generated from the following file: