VTK  9.3.1
vtkTemporalDataSetCache.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
22 #ifndef vtkTemporalDataSetCache_h
23 #define vtkTemporalDataSetCache_h
24 
25 #include "vtkFiltersHybridModule.h" // For export macro
26 
27 #include "vtkAlgorithm.h"
28 #include <map> // used for the cache
29 #include <vector> // used for the timestep records
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class VTKFILTERSHYBRID_EXPORT vtkTemporalDataSetCache : public vtkAlgorithm
33 {
34 public:
35  static vtkTemporalDataSetCache* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
44  void SetCacheSize(int size);
45  vtkGetMacro(CacheSize, int);
47 
49 
53  vtkSetMacro(CacheInMemkind, bool);
54  vtkGetMacro(CacheInMemkind, bool);
55  vtkBooleanMacro(CacheInMemkind, bool);
57 
59 
63  vtkSetMacro(IsASource, bool);
64  vtkGetMacro(IsASource, bool);
65  vtkBooleanMacro(IsASource, bool);
67 
68 protected:
70  ~vtkTemporalDataSetCache() override;
71 
72  int CacheSize;
73 
74  typedef std::map<double, std::pair<unsigned long, vtkDataObject*>> CacheType;
75  CacheType Cache;
76  std::vector<double> TimeStepValues;
81  vtkInformationVector* outputVector) override;
82 
84  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
85 
86  virtual int RequestInformation(
87  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
88 
89  virtual int RequestDataObject(
90  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
91 
92  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
93 
94  virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
95 
96 private:
98  void operator=(const vtkTemporalDataSetCache&) = delete;
99 
100  void ReplaceCacheItem(vtkDataObject* input, double inTime, vtkMTimeType outputUpdateTime);
101  bool CacheInMemkind;
102  bool IsASource;
103 
104  // a helper to deal with eviction smoothly. In effect we are an N+1 cache.
105  void SetEjected(vtkDataObject*);
106  vtkGetObjectMacro(Ejected, vtkDataObject);
107  vtkDataObject* Ejected;
108 };
109 
110 VTK_ABI_NAMESPACE_END
111 #endif
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
std::map< double, std::pair< unsigned long, vtkDataObject * > > CacheType
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< double > TimeStepValues
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...
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:51
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
general representation of visualization data
Definition: vtkDataObject.h:54