VTK  9.4.20241010
vtkTemporalAlgorithm.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
79#ifndef vtkTemporalAlgorithm_h
80#define vtkTemporalAlgorithm_h
81
82#include "vtkAlgorithm.h"
83#include "vtkCommonExecutionModelModule.h" // For export macro
84#include "vtkNew.h" // For TimeSteps
85
86VTK_ABI_NAMESPACE_BEGIN
87
88class vtkDoubleArray;
89class vtkInformation;
91
92template <class AlgorithmT>
93class vtkTemporalAlgorithm : public AlgorithmT
94{
95public:
97
102
107 static const char* TimeStepsArrayName() { return "time_steps"; }
108
109 static_assert(std::is_base_of<vtkAlgorithm, AlgorithmT>::value,
110 "Template argument must inherit vtkAlgorithm");
111
112protected:
114
116 vtkInformationVector* outputVector) override;
118 vtkInformationVector* outputVector) override;
120 vtkInformationVector* outputVector) override;
122 vtkInformationVector* outputVector) override;
123
132 virtual int Initialize(vtkInformation* request, vtkInformationVector** inputVector,
133 vtkInformationVector* outputVector) = 0;
134
140 virtual int Execute(vtkInformation* request, vtkInformationVector** inputVector,
141 vtkInformationVector* outputVector) = 0;
142
147 virtual int Finalize(vtkInformation* request, vtkInformationVector** inputVector,
148 vtkInformationVector* outputVector) = 0;
149
154
158 double GetCurrentTimeStep() const;
159
166
173 bool RunBackward = false;
174
176
180 std::vector<double> InputTimeSteps;
184
188 bool MustReset() const;
189
193 bool MustContinue() const;
194
201
207
208private:
210 void operator=(const vtkTemporalAlgorithm&) = delete;
211};
212
213VTK_ABI_NAMESPACE_END
214
215#define vtkCreateWrappedTemporalAlgorithmInterface() \
216 static const char* TimeStepsArrayName(); \
217 \
218protected: \
219 int GetCurrentTimeIndex() const; \
220 double GetCurrentTimeStep() const; \
221 bool IntegrateFullTimeSeries; \
222 \
223public:
224
225#include "vtkTemporalAlgorithm.txx"
226#endif
dynamic, self-adjusting array of double
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
Base class for temporal algorithms.
virtual int Initialize(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
Method called at first temporal iteration.
int TerminationTimeIndex
When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to kee...
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
bool MustContinue() const
Returns true if there are time steps missing that must be requested upstream.
int GetCurrentTimeIndex() const
Returns the current time index being executed (or finalized).
vtkNew< vtkDoubleArray > ProcessedTimeSteps
Array only used when the information key NO_PRIOR_TEMPORAL_ACCESS() is set.
vtkTemplateTypeMacro(vtkTemporalAlgorithm, AlgorithmT)
Standard methods for instantiation, type information, and printing.
double GetCurrentTimeStep() const
Returns the current time step being executed (or finalized).
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
virtual int Execute(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
Method called at each time step.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
std::vector< double > InputTimeSteps
When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to kee...
int RequestUpdateTime(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
bool IntegrateFullTimeSeries
To be set in the constructon.
int CurrentTimeIndex
When the information key NO_PRIOR_TEMPORAL_ACCESS() is not set on the input port, this is used to kee...
static const char * TimeStepsArrayName()
When vtkStreamingDemandDrivenPipeline::NO_PRIOR_TEMPORAL_ACCESS() is set, an array with this name is ...
bool NoPriorTimeStepAccess
When true, the algorithm calls Finalize at each iteration.
bool RunBackward
When turned on, time steps will be requested backward upstream.
bool MustReset() const
Returns true if the cache must be reinitialized before executing the current time step.
virtual int Finalize(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
Method that converts the temporal cache into the outputs.