VTK  9.1.0
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 =========================================================================*/
31 #ifndef vtkTemporalDataSetCache_h
32 #define vtkTemporalDataSetCache_h
33 
34 #include "vtkFiltersHybridModule.h" // For export macro
35 
36 #include "vtkAlgorithm.h"
37 #include <map> // used for the cache
38 #include <vector> // used for the timestep records
39 
40 class VTKFILTERSHYBRID_EXPORT vtkTemporalDataSetCache : public vtkAlgorithm
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
52  void SetCacheSize(int size);
53  vtkGetMacro(CacheSize, int);
55 
57 
61  vtkSetMacro(CacheInMemkind, bool);
62  vtkGetMacro(CacheInMemkind, bool);
63  vtkBooleanMacro(CacheInMemkind, bool);
65 
67 
71  vtkSetMacro(IsASource, bool);
72  vtkGetMacro(IsASource, bool);
73  vtkBooleanMacro(IsASource, bool);
75 
76 protected:
79 
80  int CacheSize;
81 
82  typedef std::map<double, std::pair<unsigned long, vtkDataObject*>> CacheType;
84  std::vector<double> TimeStepValues;
89  vtkInformationVector* outputVector) override;
90 
92  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
93 
94  virtual int RequestInformation(
95  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
96 
97  virtual int RequestDataObject(
98  vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
99 
101 
103 
104 private:
106  void operator=(const vtkTemporalDataSetCache&) = delete;
107 
108  void ReplaceCacheItem(vtkDataObject* input, double inTime, vtkMTimeType outputUpdateTime);
109  bool CacheInMemkind;
110  bool IsASource;
111 
112  // a helper to deal with eviction smoothly. In effect we are an N+1 cache.
113  void SetEjected(vtkDataObject*);
114  vtkGetObjectMacro(Ejected, vtkDataObject);
115  vtkDataObject* Ejected;
116 };
117 
118 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:64
general representation of visualization data
Definition: vtkDataObject.h:60
a simple class to control print indentation
Definition: vtkIndent.h:34
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