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:
46  static vtkTemporalDataSetCache* New();
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:
81  ~vtkTemporalDataSetCache() override;
82 
83  int CacheSize;
84 
85  typedef std::map<double, std::pair<unsigned long, vtkDataObject*>> CacheType;
86  CacheType Cache;
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 
103  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
104 
105  virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
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
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
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:69
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:62
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:39
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:65