VTK  9.7.1
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 "vtkDeprecation.h" // For Deprecation macro
32 #include "vtkSmartPointer.h" //needed for a private variable
33 
34 #include "vtkDataObject.h" // needed for the smart pointer
35 #include <vector> //needed for a private variable
36 
37 VTK_ABI_NAMESPACE_BEGIN
40 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkMultiTimeStepAlgorithm : public vtkAlgorithm
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
47 protected:
49 
50  ~vtkMultiTimeStepAlgorithm() override = default;
51 
55  VTK_DEPRECATED_IN_9_6_0("Please use SetTimeSteps directly instead.")
56  static vtkInformationDoubleVectorKey* UPDATE_TIME_STEPS();
57 
59 
63  virtual int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*)
64  {
65  return 1;
66  }
68 
70 
75  {
76  return 1;
77  }
79 
88  virtual int Execute(vtkInformation* vtkNotUsed(request),
89  const std::vector<vtkSmartPointer<vtkDataObject>>& vtkNotUsed(inputs),
90  vtkInformationVector* vtkNotUsed(outputVector))
91  {
92  return -1;
93  }
94 
100  {
101  return 1;
102  }
103 
106 
110  void SetTimeSteps(const std::vector<double>& values);
111 
112  bool CacheData;
113  unsigned int NumberOfCacheEntries;
114 
115 private:
117  void operator=(const vtkMultiTimeStepAlgorithm&) = delete;
118  int RequestUpdateIndex; // keep track of the time looping index
119  std::vector<double> UpdateTimeSteps; // store the requested time steps
120  bool IsInCache(double time, size_t& idx);
121  struct TimeCache
122  {
123  TimeCache(double time, vtkDataObject* data)
124  : TimeValue(time)
125  , Data(data)
126  {
127  }
128  double TimeValue;
130  };
131  std::vector<TimeCache> Cache;
132 };
133 
134 VTK_ABI_NAMESPACE_END
135 #endif
Store vtkAlgorithm input/output information.
virtual int Execute(vtkInformation *request, const std::vector< vtkSmartPointer< vtkDataObject >> &inputs, vtkInformationVector *outputVector)
Subclasses should override this method to do the actual execution.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkTypeBool
Definition: vtkABI.h:64
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
#define VTK_DEPRECATED_IN_9_6_0(reason)
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
Key for double vector values.
a simple class to control print indentation
Definition: vtkIndent.h:28
Superclass for algorithms that would like to make multiple time requests.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Composite dataset that organizes datasets into blocks.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
general representation of visualization data
Definition: vtkDataObject.h:55