VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDemandDrivenPipeline.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 =========================================================================*/ 00032 #ifndef vtkDemandDrivenPipeline_h 00033 #define vtkDemandDrivenPipeline_h 00034 00035 #include "vtkCommonExecutionModelModule.h" // For export macro 00036 #include "vtkExecutive.h" 00037 00038 class vtkAbstractArray; 00039 class vtkDataArray; 00040 class vtkDataSetAttributes; 00041 class vtkDemandDrivenPipelineInternals; 00042 class vtkFieldData; 00043 class vtkInformation; 00044 class vtkInformationIntegerKey; 00045 class vtkInformationVector; 00046 class vtkInformationKeyVectorKey; 00047 class vtkInformationUnsignedLongKey; 00048 00055 00056 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkDemandDrivenPipeline : public vtkExecutive 00057 { 00058 public: 00059 static vtkDemandDrivenPipeline* New(); 00060 vtkTypeMacro(vtkDemandDrivenPipeline,vtkExecutive); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00062 00064 00066 virtual int ProcessRequest(vtkInformation* request, 00067 vtkInformationVector** inInfo, 00068 vtkInformationVector* outInfo); 00070 00072 00073 virtual int 00074 ComputePipelineMTime(vtkInformation* request, 00075 vtkInformationVector** inInfoVec, 00076 vtkInformationVector* outInfoVec, 00077 int requestFromOutputPort, 00078 unsigned long* mtime); 00080 00082 00084 virtual int Update(); 00085 virtual int Update(int port); 00087 00089 00090 vtkGetMacro(PipelineMTime, unsigned long); 00092 00095 virtual int SetReleaseDataFlag(int port, int n); 00096 00098 virtual int GetReleaseDataFlag(int port); 00099 00101 virtual int UpdatePipelineMTime(); 00102 00106 virtual int UpdateDataObject(); 00107 00109 virtual int UpdateInformation(); 00110 00114 virtual int UpdateData(int outputPort); 00115 00118 static vtkInformationRequestKey* REQUEST_DATA_OBJECT(); 00119 00122 static vtkInformationRequestKey* REQUEST_INFORMATION(); 00123 00126 static vtkInformationRequestKey* REQUEST_DATA(); 00127 00130 static vtkInformationRequestKey* REQUEST_DATA_NOT_GENERATED(); 00131 00134 static vtkInformationIntegerKey* RELEASE_DATA(); 00135 00139 static vtkInformationIntegerKey* DATA_NOT_GENERATED(); 00140 00144 static vtkDataObject* NewDataObject(const char* type); 00145 00146 protected: 00147 vtkDemandDrivenPipeline(); 00148 ~vtkDemandDrivenPipeline(); 00149 00150 // Helper methods to send requests to the algorithm. 00151 virtual int ExecuteDataObject(vtkInformation* request, 00152 vtkInformationVector** inInfo, 00153 vtkInformationVector* outInfo); 00154 virtual int ExecuteInformation(vtkInformation* request, 00155 vtkInformationVector** inInfo, 00156 vtkInformationVector* outInfo); 00157 virtual int ExecuteData(vtkInformation* request, 00158 vtkInformationVector** inInfo, 00159 vtkInformationVector* outInfo); 00160 00161 00162 // Reset the pipeline update values in the given output information object. 00163 virtual void ResetPipelineInformation(int, vtkInformation*); 00164 00165 // Check whether the data object in the pipeline information for an 00166 // output port exists and has a valid type. 00167 virtual int CheckDataObject(int port, vtkInformationVector* outInfo); 00168 00169 00170 // Input connection validity checkers. 00171 int InputCountIsValid(vtkInformationVector **); 00172 int InputCountIsValid(int port,vtkInformationVector **); 00173 int InputTypeIsValid(vtkInformationVector **); 00174 int InputTypeIsValid(int port,vtkInformationVector **); 00175 virtual int InputTypeIsValid(int port, int index,vtkInformationVector **); 00176 int InputFieldsAreValid(vtkInformationVector **); 00177 int InputFieldsAreValid(int port,vtkInformationVector **); 00178 virtual int InputFieldsAreValid(int port, int index,vtkInformationVector **); 00179 00180 // Field existence checkers. 00181 int DataSetAttributeExists(vtkDataSetAttributes* dsa, vtkInformation* field); 00182 int FieldArrayExists(vtkFieldData* data, vtkInformation* field); 00183 int ArrayIsValid(vtkAbstractArray* array, vtkInformation* field); 00184 00185 // Input port information checkers. 00186 int InputIsOptional(int port); 00187 int InputIsRepeatable(int port); 00188 00189 // Decide whether the output data need to be generated. 00190 virtual int NeedToExecuteData(int outputPort, 00191 vtkInformationVector** inInfoVec, 00192 vtkInformationVector* outInfoVec); 00193 00194 // Handle before/after operations for ExecuteData method. 00195 virtual void ExecuteDataStart(vtkInformation* request, 00196 vtkInformationVector** inInfoVec, 00197 vtkInformationVector* outInfoVec); 00198 virtual void ExecuteDataEnd(vtkInformation* request, 00199 vtkInformationVector** inInfoVec, 00200 vtkInformationVector* outInfoVec); 00201 virtual void MarkOutputsGenerated(vtkInformation* request, 00202 vtkInformationVector** inInfoVec, 00203 vtkInformationVector* outInfoVec); 00204 00205 // Largest MTime of any algorithm on this executive or preceding 00206 // executives. 00207 unsigned long PipelineMTime; 00208 00209 // Time when information or data were last generated. 00210 vtkTimeStamp DataObjectTime; 00211 vtkTimeStamp InformationTime; 00212 vtkTimeStamp DataTime; 00213 00214 //BTX 00215 friend class vtkCompositeDataPipeline; 00216 //ETX 00217 00218 00219 vtkInformation *InfoRequest; 00220 vtkInformation *DataObjectRequest; 00221 vtkInformation *DataRequest; 00222 00223 private: 00224 vtkDemandDrivenPipeline(const vtkDemandDrivenPipeline&); // Not implemented. 00225 void operator=(const vtkDemandDrivenPipeline&); // Not implemented. 00226 }; 00227 00228 #endif