VTK  9.2.6
vtkTemporalDataSetCache.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTemporalDataSetCache.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 =========================================================================*/
34 #ifndef vtkTemporalDataSetCache_h
35 #define vtkTemporalDataSetCache_h
36 
37 #include "vtkFiltersHybridModule.h" // For export macro
38 
39 #include "vtkAlgorithm.h"
40 #include <map> // used for the cache
41 #include <vector> // used for the timestep records
42 
43 class VTKFILTERSHYBRID_EXPORT vtkTemporalDataSetCache : public vtkAlgorithm
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
55  void SetCacheSize(int size);
56  vtkGetMacro(CacheSize, int);
58 
60 
64  vtkSetMacro(CacheInMemkind, bool);
65  vtkGetMacro(CacheInMemkind, bool);
66  vtkBooleanMacro(CacheInMemkind, bool);
68 
70 
74  vtkSetMacro(IsASource, bool);
75  vtkGetMacro(IsASource, bool);
76  vtkBooleanMacro(IsASource, bool);
78 
79 protected:
82 
83  int CacheSize;
84 
85  typedef std::map<double, std::pair<unsigned long, vtkDataObject*>> CacheType;
87  std::vector<double> TimeStepValues;
92  vtkInformationVector* outputVector) override;
93 
95  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
96 
97  virtual int RequestInformation(
98  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
99 
100  virtual int RequestDataObject(
101  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
102 
104 
106 
107 private:
109  void operator=(const vtkTemporalDataSetCache&) = delete;
110 
111  void ReplaceCacheItem(vtkDataObject* input, double inTime, vtkMTimeType outputUpdateTime);
112  bool CacheInMemkind;
113  bool IsASource;
114 
115  // a helper to deal with eviction smoothly. In effect we are an N+1 cache.
116  void SetEjected(vtkDataObject*);
117  vtkGetObjectMacro(Ejected, vtkDataObject);
118  vtkDataObject* Ejected;
119 };
120 
121 #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:119
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:382
@ port
Definition: vtkX3D.h:453
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287