VTK  9.3.20240221
vtkMultiTimeStepAlgorithm.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
26 #ifndef vtkMultiTimeStepAlgorithm_h
27 #define vtkMultiTimeStepAlgorithm_h
28 
29 #include "vtkAlgorithm.h"
30 #include "vtkCommonExecutionModelModule.h" // For export macro
31 #include "vtkSmartPointer.h" //needed for a private variable
32 
33 #include "vtkDataObject.h" // needed for the smart pointer
34 #include <vector> //needed for a private variable
35 
36 VTK_ABI_NAMESPACE_BEGIN
39 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkMultiTimeStepAlgorithm : public vtkAlgorithm
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
46 protected:
48 
49  ~vtkMultiTimeStepAlgorithm() override = default;
50 
55 
57 
62  {
63  return 1;
64  }
66 
68 
73  {
74  return 1;
75  }
77 
86  virtual int Execute(vtkInformation* vtkNotUsed(request),
87  const std::vector<vtkSmartPointer<vtkDataObject>>& vtkNotUsed(inputs),
88  vtkInformationVector* vtkNotUsed(outputVector))
89  {
90  return -1;
91  }
92 
98  {
99  return 1;
100  }
101 
104 
105  bool CacheData;
106  unsigned int NumberOfCacheEntries;
107 
108 private:
110  void operator=(const vtkMultiTimeStepAlgorithm&) = delete;
111  int RequestUpdateIndex; // keep track of the time looping index
112  std::vector<double> UpdateTimeSteps; // store the requested time steps
113  bool IsInCache(double time, size_t& idx);
114  struct TimeCache
115  {
116  TimeCache(double time, vtkDataObject* data)
117  : TimeValue(time)
118  , Data(data)
119  {
120  }
121  double TimeValue;
123  };
124  std::vector<TimeCache> Cache;
125 };
126 
127 VTK_ABI_NAMESPACE_END
128 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:161
general representation of visualization data
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
Superclass for algorithms that would like to make multiple time requests.
static vtkMultiTimeStepAlgorithm * New()
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
virtual int Execute(vtkInformation *vtkNotUsed(request), const std::vector< vtkSmartPointer< vtkDataObject >> &vtkNotUsed(inputs), vtkInformationVector *vtkNotUsed(outputVector))
Subclasses should override this method to do the actual execution.
~vtkMultiTimeStepAlgorithm() override=default
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
static vtkInformationDoubleVectorKey * UPDATE_TIME_STEPS()
This is filled by the child class to request multiple time steps.
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
@ vector
Definition: vtkX3D.h:237
@ time
Definition: vtkX3D.h:497
@ data
Definition: vtkX3D.h:315
int vtkTypeBool
Definition: vtkABI.h:64