VTK  9.3.20240221
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 
86 VTK_ABI_NAMESPACE_BEGIN
87 
88 class vtkDoubleArray;
89 class vtkInformation;
91 
92 template <class AlgorithmT>
93 class vtkTemporalAlgorithm : public AlgorithmT
94 {
95 public:
97 
102 
107  static const char* TimeStepsArrayName() { return "time_steps"; }
108 
110  "Template argument must inherit vtkAlgorithm");
111 
112 protected:
114 
116  vtkInformationVector* outputVector) override;
118  vtkInformationVector* outputVector) override;
120  vtkInformationVector* outputVector) override;
121  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
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 
153  int GetCurrentTimeIndex() const;
154 
158  double GetCurrentTimeStep() const;
159 
166 
173  bool RunBackward = false;
174 
175 private:
177  void operator=(const vtkTemporalAlgorithm&) = delete;
178 
182  bool MustReset() const;
183 
187  bool MustContinue() const;
188 
194  bool NoPriorTimeStepAccess = false;
195 
197 
201  std::vector<double> InputTimeSteps;
202  int TerminationTimeIndex = 0;
203  int CurrentTimeIndex = 0;
205 
210  vtkNew<vtkDoubleArray> ProcessedTimeSteps;
211 };
212 
213 VTK_ABI_NAMESPACE_END
214 
215 #define vtkCreateWrappedTemporalAlgorithmInterface() \
216  static const char* TimeStepsArrayName(); \
217  \
218 protected: \
219  int GetCurrentTimeIndex() const; \
220  double GetCurrentTimeStep() const; \
221  bool IntegrateFullTimeSeries; \
222  \
223 public:
224 
225 #include "vtkTemporalAlgorithm.txx"
226 #endif
dynamic, self-adjusting array of double
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Base class for temporal algorithms.
virtual int Initialize(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
Method called at first temporal iteration.
static const char * TimeStepsArrayName()
When vtkStreamingDemandDrivenPipeline::NO_PRIOR_TEMPORAL_ACCESS() is set, an array with this name is ...
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
int GetCurrentTimeIndex() const
Returns the current time index being executed (or finalized).
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
int RequestUpdateTime(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
bool IntegrateFullTimeSeries
To be set in the constructon.
bool RunBackward
When turned on, time steps will be requested backward upstream.
virtual int Finalize(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
Method that converts the temporal cache into the outputs.
@ value
Definition: vtkX3D.h:220