VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMultiTimeStepAlgorithm.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00026 #ifndef vtkMultiTimeStepAlgorithm_h 00027 #define vtkMultiTimeStepAlgorithm_h 00028 00029 #include "vtkCommonExecutionModelModule.h" // For export macro 00030 #include "vtkAlgorithm.h" 00031 #include "vtkSmartPointer.h" //needed for a private variable 00032 00033 #include <vector> //needed for a private variable 00034 #include "vtkDataObject.h" // needed for the smart pointer 00035 00036 class vtkInformationDoubleVectorKey; 00037 class vtkMultiBlockDataSet; 00038 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkMultiTimeStepAlgorithm : public vtkAlgorithm 00039 { 00040 public: 00041 static vtkMultiTimeStepAlgorithm *New(); 00042 vtkTypeMacro(vtkMultiTimeStepAlgorithm,vtkAlgorithm); 00043 void PrintSelf(ostream& os, vtkIndent indent); 00044 00045 00046 protected: 00047 vtkMultiTimeStepAlgorithm(); 00048 00049 ~vtkMultiTimeStepAlgorithm() 00050 { 00051 }; 00052 00054 static vtkInformationDoubleVectorKey* UPDATE_TIME_STEPS(); 00055 00056 00058 00060 virtual int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*) 00061 { 00062 return 1; 00063 }; 00065 00067 00069 virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) 00070 { 00071 return 1; 00072 }; 00074 00076 00078 virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) 00079 { 00080 return 1; 00081 } 00083 00085 00087 virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*) 00088 { 00089 return 1; 00090 } 00092 00093 int ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*); 00094 00095 bool CacheData; 00096 unsigned int NumberOfCacheEntries; 00097 00098 private: 00099 vtkMultiTimeStepAlgorithm(const vtkMultiTimeStepAlgorithm&); // Not implemented. 00100 void operator=(const vtkMultiTimeStepAlgorithm&); // Not implemented. 00101 00102 00103 vtkSmartPointer<vtkMultiBlockDataSet> MDataSet; //stores all the temporal data sets 00104 int RequestUpdateIndex; //keep track of the time looping index 00105 std::vector<double> UpdateTimeSteps; //store the requested time steps 00106 00107 bool IsInCache(double time, size_t& idx); 00108 00109 struct TimeCache 00110 { 00111 TimeCache(double time, vtkDataObject* data) : TimeValue(time), Data(data) 00112 { 00113 } 00114 double TimeValue; 00115 vtkSmartPointer<vtkDataObject> Data; 00116 }; 00117 00118 std::vector<TimeCache> Cache; 00119 }; 00120 00121 #endif