VTK  9.3.20240328
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:
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:
71 
72  int CacheSize;
73 
74  typedef std::map<double, std::pair<unsigned long, vtkDataObject*>> CacheType;
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 
93 
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
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.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
std::map< double, std::pair< unsigned long, vtkDataObject * > > CacheType
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
~vtkTemporalDataSetCache() override
int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation *info) override
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
std::vector< double > TimeStepValues
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
static vtkTemporalDataSetCache * New()
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual int RequestInformation(vtkInformation *, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void SetCacheSize(int size)
This is the maximum number of time steps that can be retained in memory.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ size
Definition: vtkX3D.h:253
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270