VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkStreamingDemandDrivenPipeline.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 =========================================================================*/ 00031 #ifndef __vtkStreamingDemandDrivenPipeline_h 00032 #define __vtkStreamingDemandDrivenPipeline_h 00033 00034 #include "vtkDemandDrivenPipeline.h" 00035 00036 class vtkExtentTranslator; 00037 class vtkInformationDoubleKey; 00038 class vtkInformationDoubleVectorKey; 00039 class vtkInformationIntegerKey; 00040 class vtkInformationIntegerVectorKey; 00041 class vtkInformationObjectBaseKey; 00042 class vtkInformationStringKey; 00043 class vtkInformationIdTypeKey; 00044 00045 class VTK_FILTERING_EXPORT vtkStreamingDemandDrivenPipeline : public vtkDemandDrivenPipeline 00046 { 00047 public: 00048 static vtkStreamingDemandDrivenPipeline* New(); 00049 vtkTypeMacro(vtkStreamingDemandDrivenPipeline,vtkDemandDrivenPipeline); 00050 void PrintSelf(ostream& os, vtkIndent indent); 00051 00053 00055 virtual int ProcessRequest(vtkInformation* request, 00056 vtkInformationVector** inInfo, 00057 vtkInformationVector* outInfo); 00059 00061 00062 virtual int Update(); 00063 virtual int Update(int port); 00064 virtual int UpdateWholeExtent(); 00066 00069 int PropagateUpdateExtent(int outputPort); 00070 00072 00076 int SetMaximumNumberOfPieces(int port, int n); 00077 int SetMaximumNumberOfPieces(vtkInformation *, int n); 00078 int GetMaximumNumberOfPieces(int port); 00079 int GetMaximumNumberOfPieces(vtkInformation *); 00081 00083 00086 int SetWholeExtent(vtkInformation *, int extent[6]); 00087 void GetWholeExtent(vtkInformation *, int extent[6]); 00088 int* GetWholeExtent(vtkInformation *); 00090 00092 00096 int SetUpdateExtentToWholeExtent(int port); 00097 int SetUpdateExtentToWholeExtent(vtkInformation *); 00099 00101 00102 int SetUpdateExtent(int port, int extent[6]); 00103 int SetUpdateExtent(vtkInformation *, int extent[6]); 00104 void GetUpdateExtent(vtkInformation *, int extent[6]); 00105 int* GetUpdateExtent(vtkInformation *); 00107 00109 00111 int SetUpdateExtent(int port, 00112 int piece, int numPieces, int ghostLevel); 00113 int SetUpdateExtent(vtkInformation *, 00114 int piece, int numPieces, int ghostLevel); 00115 int SetUpdatePiece(vtkInformation *, int piece); 00116 int GetUpdatePiece(vtkInformation *); 00117 int SetUpdateNumberOfPieces(vtkInformation *, int n); 00118 int GetUpdateNumberOfPieces(vtkInformation *); 00119 int SetUpdateGhostLevel(vtkInformation *, int n); 00120 int GetUpdateGhostLevel(vtkInformation *); 00121 int SetUpdateResolution(int port, double r); 00122 int SetUpdateResolution(vtkInformation *, double r); 00123 double GetUpdateResolution(vtkInformation *); 00125 00127 00131 int SetSplitUpdateExtent(int port, 00132 int major, int minor, 00133 int numPieces, 00134 int ghostLevel) 00135 { 00136 return this->SetUpdateExtent(port, major+minor, numPieces, ghostLevel); 00137 } 00139 00140 00142 00143 int SetUpdateTimeSteps(int port, double *times, int length); 00144 int SetUpdateTimeSteps(vtkInformation *, double *times, int length); 00145 int SetUpdateTimeStep(int port, double time); 00146 //void GetUpdateTimeSteps(vtkInformation *, int extent[6]); 00148 00150 00156 int SetRequestExactExtent(int port, int flag); 00157 int GetRequestExactExtent(int port); 00159 00161 00163 int SetExtentTranslator(int port, vtkExtentTranslator* translator); 00164 int SetExtentTranslator(vtkInformation *, vtkExtentTranslator* translator); 00165 vtkExtentTranslator* GetExtentTranslator(int port); 00166 vtkExtentTranslator* GetExtentTranslator(vtkInformation *info); 00168 00170 00173 int SetWholeBoundingBox(int port, double bb[6]); 00174 void GetWholeBoundingBox(int port, double bb[6]); 00175 double* GetWholeBoundingBox(int port); 00177 00179 00182 int SetPieceBoundingBox(int port, double bb[6]); 00183 void GetPieceBoundingBox(int port, double bb[6]); 00184 double* GetPieceBoundingBox(int port); 00186 00188 static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT(); 00189 00192 static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT_INFORMATION(); 00193 00195 static vtkInformationRequestKey* REQUEST_RESOLUTION_PROPAGATE(); 00196 00199 static vtkInformationIntegerKey* CONTINUE_EXECUTING(); 00200 00202 static vtkInformationObjectBaseKey* EXTENT_TRANSLATOR(); 00203 00205 00206 static vtkInformationIntegerKey* UPDATE_EXTENT_INITIALIZED(); 00207 static vtkInformationIntegerVectorKey* UPDATE_EXTENT(); 00208 static vtkInformationIntegerKey* UPDATE_PIECE_NUMBER(); 00209 static vtkInformationIntegerKey* UPDATE_NUMBER_OF_PIECES(); 00210 static vtkInformationIntegerKey* UPDATE_NUMBER_OF_GHOST_LEVELS(); 00212 00215 static vtkInformationIntegerKey* UPDATE_EXTENT_TRANSLATED(); 00216 00218 static vtkInformationIntegerVectorKey* WHOLE_EXTENT(); 00219 00222 static vtkInformationIntegerKey* MAXIMUM_NUMBER_OF_PIECES(); 00223 00226 static vtkInformationDoubleVectorKey* WHOLE_BOUNDING_BOX(); 00227 00230 static vtkInformationDoubleVectorKey* PIECE_BOUNDING_BOX(); 00231 00233 static vtkInformationIntegerKey* EXACT_EXTENT(); 00234 00236 static vtkInformationDoubleVectorKey* TIME_STEPS(); 00237 00239 static vtkInformationDoubleVectorKey* TIME_RANGE(); 00240 00242 static vtkInformationDoubleVectorKey* UPDATE_TIME_STEPS(); 00243 00246 static vtkInformationDoubleKey* PRIORITY(); 00247 00250 static vtkInformationDoubleKey* UPDATE_RESOLUTION(); 00251 00254 static vtkInformationIntegerKey* REMOVE_ATTRIBUTE_INFORMATION(); 00255 00262 // Key to allow a reader to advertise that it supports a fast-path 00263 // for reading data over time. 00264 static vtkInformationIntegerKey* FAST_PATH_FOR_TEMPORAL_DATA(); 00265 // The type of data being requested. 00266 // Possible values: POINT, CELL, EDGE, FACE 00267 static vtkInformationStringKey* FAST_PATH_OBJECT_TYPE(); 00268 // Possible values: INDEX, GLOBAL 00269 static vtkInformationStringKey* FAST_PATH_ID_TYPE(); 00270 // The id (either index or global id) being requested 00271 static vtkInformationIdTypeKey* FAST_PATH_OBJECT_ID(); 00272 00274 00278 double ComputePriority() 00279 { 00280 return this->ComputePriority(0); 00281 } 00282 virtual double ComputePriority(int port); 00284 00285 protected: 00286 vtkStreamingDemandDrivenPipeline(); 00287 ~vtkStreamingDemandDrivenPipeline(); 00288 00290 00293 virtual void ResetUpdateInformation(vtkInformation* request, 00294 vtkInformationVector** inInfoVec, 00295 vtkInformationVector* outInfoVec); 00297 00298 // Keep track of the update time request corresponding to the 00299 // previous executing. If the previous update request did not 00300 // correspond to an existing time step and the reader chose 00301 // a time step with it's own logic, the data time step will 00302 // be different than the request. If the same time step is 00303 // requested again, there is no need to re-execute the algorithm. 00304 // We know that it does not have this time step. 00305 static vtkInformationDoubleVectorKey* PREVIOUS_UPDATE_TIME_STEPS(); 00306 00307 // Keep track of the fast path keys corresponding to the 00308 // previous executing. If all key values are the same as their 00309 // counterparts in the previous request, we do not need to re-execute. 00310 static vtkInformationIdTypeKey* PREVIOUS_FAST_PATH_OBJECT_ID(); 00311 static vtkInformationStringKey* PREVIOUS_FAST_PATH_OBJECT_TYPE(); 00312 static vtkInformationStringKey* PREVIOUS_FAST_PATH_ID_TYPE(); 00313 00314 // Does the time request correspond to what is in the data? 00315 // Returns 0 if yes, 1 otherwise. 00316 virtual int NeedToExecuteBasedOnTime(vtkInformation* outInfo, 00317 vtkDataObject* dataObject); 00318 00319 // If the request contains a fast path key for temporal data, always execute 00320 virtual int NeedToExecuteBasedOnFastPathData(vtkInformation* outInfo); 00321 00322 // Setup default information on the output after the algorithm 00323 // executes information. 00324 virtual int ExecuteInformation(vtkInformation* request, 00325 vtkInformationVector** inInfoVec, 00326 vtkInformationVector* outInfoVec); 00327 00328 // Copy information for the given request. 00329 virtual void CopyDefaultInformation(vtkInformation* request, int direction, 00330 vtkInformationVector** inInfoVec, 00331 vtkInformationVector* outInfoVec); 00332 00333 // Helper to check output information before propagating it to inputs. 00334 virtual int VerifyOutputInformation(int outputPort, 00335 vtkInformationVector** inInfoVec, 00336 vtkInformationVector* outInfoVec); 00337 00338 00339 // Override this check to account for update extent. 00340 virtual int NeedToExecuteData(int outputPort, 00341 vtkInformationVector** inInfoVec, 00342 vtkInformationVector* outInfoVec); 00343 00344 // Override these to handle the continue-executing option. 00345 virtual void ExecuteDataStart(vtkInformation* request, 00346 vtkInformationVector** inInfoVec, 00347 vtkInformationVector* outInfoVec); 00348 virtual void ExecuteDataEnd(vtkInformation* request, 00349 vtkInformationVector** inInfoVec, 00350 vtkInformationVector* outInfoVec); 00351 00352 // Override this to handle cropping and ghost levels. 00353 virtual void MarkOutputsGenerated(vtkInformation* request, 00354 vtkInformationVector** inInfoVec, 00355 vtkInformationVector* outInfoVec); 00356 00357 00358 // Remove update/whole extent when resetting pipeline information. 00359 virtual void ResetPipelineInformation(int port, vtkInformation*); 00360 00361 // Flag for when an algorithm returns with CONTINUE_EXECUTING in the 00362 // request. 00363 int ContinueExecuting; 00364 00365 vtkInformation *UpdateExtentRequest; 00366 00367 // did the most recent PUE do anything ? 00368 int LastPropogateUpdateExtentShortCircuited; 00369 00370 private: 00371 vtkStreamingDemandDrivenPipeline(const vtkStreamingDemandDrivenPipeline&); // Not implemented. 00372 void operator=(const vtkStreamingDemandDrivenPipeline&); // Not implemented. 00373 }; 00374 00375 #endif