VTK  9.1.20211115
vtkMultiTimeStepAlgorithm.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMultiTimeStepAlgorithm.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkMultiTimeStepAlgorithm_h
39 #define vtkMultiTimeStepAlgorithm_h
40 
41 #include "vtkAlgorithm.h"
42 #include "vtkCommonExecutionModelModule.h" // For export macro
43 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
44 #include "vtkSmartPointer.h" //needed for a private variable
45 
46 #include "vtkDataObject.h" // needed for the smart pointer
47 #include <vector> //needed for a private variable
48 
51 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkMultiTimeStepAlgorithm : public vtkAlgorithm
52 {
53 public:
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
58 protected:
60 
61  ~vtkMultiTimeStepAlgorithm() override = default;
62 
67 
69 
74  {
75  return 1;
76  }
78 
80 
85  {
86  return 1;
87  }
89 
94  VTK_DEPRECATED_IN_9_1_0("cannot support all input data types; use `Execute` instead.")
96  {
97  return 1;
98  }
99 
108  virtual int Execute(vtkInformation* vtkNotUsed(request),
109  const std::vector<vtkSmartPointer<vtkDataObject>>& vtkNotUsed(inputs),
110  vtkInformationVector* vtkNotUsed(outputVector))
111  {
112  return -1;
113  }
114 
120  {
121  return 1;
122  }
123 
126 
127  bool CacheData;
128  unsigned int NumberOfCacheEntries;
129 
130 private:
132  void operator=(const vtkMultiTimeStepAlgorithm&) = delete;
133  int RequestUpdateIndex; // keep track of the time looping index
134  std::vector<double> UpdateTimeSteps; // store the requested time steps
135  bool IsInCache(double time, size_t& idx);
136  struct TimeCache
137  {
138  TimeCache(double time, vtkDataObject* data)
139  : TimeValue(time)
140  , Data(data)
141  {
142  }
143  double TimeValue;
145  };
146  std::vector<TimeCache> Cache;
147 };
148 
149 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:122
general representation of visualization data
a simple class to control print indentation
Definition: vtkIndent.h:113
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:243
@ time
Definition: vtkX3D.h:503
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)