VTK
dox/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.h
Go to the documentation of this file.
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 "vtkCommonExecutionModelModule.h" // For export macro
00035 #include "vtkDemandDrivenPipeline.h"
00036 
00037 #define VTK_UPDATE_EXTENT_COMBINE 1
00038 #define VTK_UPDATE_EXTENT_REPLACE 2
00039 
00040 class vtkExtentTranslator;
00041 class vtkInformationDoubleKey;
00042 class vtkInformationDoubleVectorKey;
00043 class vtkInformationIdTypeKey;
00044 class vtkInformationIntegerKey;
00045 class vtkInformationIntegerVectorKey;
00046 class vtkInformationObjectBaseKey;
00047 class vtkInformationStringKey;
00048 class vtkInformationStringKey;
00049 class vtkInformationUnsignedLongKey;
00050 
00051 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkStreamingDemandDrivenPipeline : public vtkDemandDrivenPipeline
00052 {
00053 public:
00054   static vtkStreamingDemandDrivenPipeline* New();
00055   vtkTypeMacro(vtkStreamingDemandDrivenPipeline,vtkDemandDrivenPipeline);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059 
00061   virtual int ProcessRequest(vtkInformation* request,
00062                              vtkInformationVector** inInfo,
00063                              vtkInformationVector* outInfo);
00065 
00067 
00068   virtual int Update();
00069   virtual int Update(int port);
00070   virtual int UpdateWholeExtent();
00072 
00075   int PropagateUpdateExtent(int outputPort);
00076 
00077 
00079 
00081   int PropagateTime(int outputPort);
00082   int UpdateTimeDependentInformation(int outputPort);
00084 
00085 
00087 
00091   int SetMaximumNumberOfPieces(int port, int n);
00092   static int SetMaximumNumberOfPieces(vtkInformation *, int n);
00093   int GetMaximumNumberOfPieces(int port);
00094   static int GetMaximumNumberOfPieces(vtkInformation *);
00096 
00098 
00101   static int SetWholeExtent(vtkInformation *, int extent[6]);
00102   static void GetWholeExtent(vtkInformation *, int extent[6]);
00103   static int* GetWholeExtent(vtkInformation *);
00105 
00107 
00111   int SetUpdateExtentToWholeExtent(int port);
00112   static int SetUpdateExtentToWholeExtent(vtkInformation *);
00114 
00116 
00117   int SetUpdateExtent(int port, int extent[6]);
00118   int SetUpdateExtent(int port, int x0, int x1, int y0, int y1, int z0, int z1);
00119   static int SetUpdateExtent(vtkInformation *, int extent[6]);
00120   static void GetUpdateExtent(vtkInformation *, int extent[6]);
00121   static int* GetUpdateExtent(vtkInformation *);
00123 
00125 
00127   int SetUpdateExtent(int port,
00128                       int piece, int numPieces, int ghostLevel);
00129   static int SetUpdateExtent(vtkInformation *,
00130                              int piece, int numPieces, int ghostLevel);
00131   static int SetUpdatePiece(vtkInformation *, int piece);
00132   static int GetUpdatePiece(vtkInformation *);
00133   static int SetUpdateNumberOfPieces(vtkInformation *, int n);
00134   static int GetUpdateNumberOfPieces(vtkInformation *);
00135   static int SetUpdateGhostLevel(vtkInformation *, int n);
00136   static int GetUpdateGhostLevel(vtkInformation *);
00137   int SetUpdateResolution(int port, double r);
00138   int SetUpdateResolution(vtkInformation *, double r);
00139   double GetUpdateResolution(vtkInformation *);
00141 
00143 
00144   int SetUpdateTimeStep(int port, double time);
00145   static int SetUpdateTimeStep(vtkInformation *, double time);
00147 
00149 
00155   int SetRequestExactExtent(int port, int flag);
00156   int GetRequestExactExtent(int port);
00158 
00160 
00162   int SetExtentTranslator(int port, vtkExtentTranslator* translator);
00163   static int SetExtentTranslator(vtkInformation *, vtkExtentTranslator* translator);
00164   vtkExtentTranslator* GetExtentTranslator(int port);
00165   static vtkExtentTranslator* GetExtentTranslator(vtkInformation *info);
00167 
00169 
00172   int SetWholeBoundingBox(int port, double bb[6]);
00173   void GetWholeBoundingBox(int port, double bb[6]);
00174   double* GetWholeBoundingBox(int port);
00176 
00178 
00181   int SetPieceBoundingBox(int port, double bb[6]);
00182   void GetPieceBoundingBox(int port, double bb[6]);
00183   double* GetPieceBoundingBox(int port);
00185 
00187   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT();
00188 
00189   // Key defining a request to propagate the update extent upstream.
00190   static vtkInformationRequestKey* REQUEST_UPDATE_TIME();
00193   static vtkInformationRequestKey* REQUEST_TIME_DEPENDENT_INFORMATION();
00194 
00195 
00197 
00199   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT_INFORMATION();
00200   static vtkInformationRequestKey* REQUEST_MANAGE_INFORMATION();
00202 
00204   static vtkInformationRequestKey* REQUEST_RESOLUTION_PROPAGATE();
00205 
00208   static vtkInformationIntegerKey* CONTINUE_EXECUTING();
00209 
00211   static vtkInformationObjectBaseKey* EXTENT_TRANSLATOR();
00212 
00214 
00215   static vtkInformationIntegerKey* UPDATE_EXTENT_INITIALIZED();
00216   static vtkInformationIntegerVectorKey* UPDATE_EXTENT();
00217   static vtkInformationIntegerKey* UPDATE_PIECE_NUMBER();
00218   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_PIECES();
00219   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_GHOST_LEVELS();
00221 
00223   static vtkInformationIntegerKey* UPDATE_AMR_LEVEL();
00224 
00227   static vtkInformationIntegerVectorKey* COMBINED_UPDATE_EXTENT();
00228 
00231   static vtkInformationIntegerKey* UPDATE_EXTENT_TRANSLATED();
00232 
00234   static vtkInformationIntegerVectorKey* WHOLE_EXTENT();
00235 
00239   static vtkInformationIntegerKey* UNRESTRICTED_UPDATE_EXTENT();
00240 
00243   static vtkInformationIntegerKey* MAXIMUM_NUMBER_OF_PIECES();
00244 
00247   static vtkInformationDoubleVectorKey* WHOLE_BOUNDING_BOX();
00248 
00251   static vtkInformationDoubleVectorKey* PIECE_BOUNDING_BOX();
00252 
00254   static vtkInformationDoubleVectorKey* PIECE_NORMAL();
00255 
00257   static vtkInformationIntegerKey* EXACT_EXTENT();
00258 
00260   static vtkInformationDoubleVectorKey* TIME_STEPS();
00261 
00263   static vtkInformationDoubleVectorKey* TIME_RANGE();
00264 
00267   static vtkInformationStringKey* TIME_LABEL_ANNOTATION();
00268 
00270   static vtkInformationDoubleKey* UPDATE_TIME_STEP();
00271 
00275   static vtkInformationIntegerKey* TIME_DEPENDENT_INFORMATION();
00276 
00279   static vtkInformationDoubleKey* PRIORITY();
00280 
00283   static vtkInformationUnsignedLongKey* ORIGINAL_NUMBER_OF_CELLS();
00284 
00287   static vtkInformationDoubleKey* UPDATE_RESOLUTION();
00288 
00291   static vtkInformationIntegerKey* REMOVE_ATTRIBUTE_INFORMATION();
00292 
00299   // Key to allow a reader to advertise that it supports a fast-path
00300   // for reading data over time.
00301   static vtkInformationIntegerKey* FAST_PATH_FOR_TEMPORAL_DATA();
00302   // The type of data being requested.
00303   // Possible values: POINT, CELL, EDGE, FACE
00304   static vtkInformationStringKey* FAST_PATH_OBJECT_TYPE();
00305   // Possible values: INDEX, GLOBAL
00306   static vtkInformationStringKey* FAST_PATH_ID_TYPE();
00307   // The id (either index or global id) being requested
00308   static vtkInformationIdTypeKey* FAST_PATH_OBJECT_ID();
00309 
00310 
00312   static vtkInformationDoubleVectorKey *BOUNDS();
00313 
00314 
00316 
00320   double ComputePriority()
00321     {
00322       return this->ComputePriority(0);
00323     }
00324   virtual double ComputePriority(int port);
00326 
00327 protected:
00328   vtkStreamingDemandDrivenPipeline();
00329   ~vtkStreamingDemandDrivenPipeline();
00330 
00332 
00335   virtual void ResetUpdateInformation(vtkInformation* request,
00336     vtkInformationVector** inInfoVec,
00337     vtkInformationVector* outInfoVec);
00339 
00340   // Keep track of the update time request corresponding to the
00341   // previous executing. If the previous update request did not
00342   // correspond to an existing time step and the reader chose
00343   // a time step with it's own logic, the data time step will
00344   // be different than the request. If the same time step is
00345   // requested again, there is no need to re-execute the algorithm.
00346   // We know that it does not have this time step.
00347   static vtkInformationDoubleKey* PREVIOUS_UPDATE_TIME_STEP();
00348 
00349   // Keep track of the fast path keys corresponding to the
00350   // previous executing. If all key values are the same as their
00351   // counterparts in the previous request, we do not need to re-execute.
00352   static vtkInformationIdTypeKey* PREVIOUS_FAST_PATH_OBJECT_ID();
00353   static vtkInformationStringKey* PREVIOUS_FAST_PATH_OBJECT_TYPE();
00354   static vtkInformationStringKey* PREVIOUS_FAST_PATH_ID_TYPE();
00355 
00356   // Does the time request correspond to what is in the data?
00357   // Returns 0 if yes, 1 otherwise.
00358   virtual int NeedToExecuteBasedOnTime(vtkInformation* outInfo,
00359                                        vtkDataObject* dataObject);
00360 
00361   // If the request contains a fast path key for temporal data, always execute
00362   virtual int NeedToExecuteBasedOnFastPathData(vtkInformation* outInfo);
00363 
00364   // Setup default information on the output after the algorithm
00365   // executes information.
00366   virtual int ExecuteInformation(vtkInformation* request,
00367                                  vtkInformationVector** inInfoVec,
00368                                  vtkInformationVector* outInfoVec);
00369 
00370   // Copy information for the given request.
00371   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00372                                       vtkInformationVector** inInfoVec,
00373                                       vtkInformationVector* outInfoVec);
00374 
00375   // Helper to check output information before propagating it to inputs.
00376   virtual int VerifyOutputInformation(int outputPort,
00377                                       vtkInformationVector** inInfoVec,
00378                                       vtkInformationVector* outInfoVec);
00379 
00380 
00381   // Override this check to account for update extent.
00382   virtual int NeedToExecuteData(int outputPort,
00383                                 vtkInformationVector** inInfoVec,
00384                                 vtkInformationVector* outInfoVec);
00385 
00386   // Override these to handle the continue-executing option.
00387   virtual void ExecuteDataStart(vtkInformation* request,
00388                                 vtkInformationVector** inInfoVec,
00389                                 vtkInformationVector* outInfoVec);
00390   virtual void ExecuteDataEnd(vtkInformation* request,
00391                               vtkInformationVector** inInfoVec,
00392                               vtkInformationVector* outInfoVec);
00393 
00394   // Override this to handle cropping and ghost levels.
00395   virtual void MarkOutputsGenerated(vtkInformation* request,
00396                                     vtkInformationVector** inInfoVec,
00397                                     vtkInformationVector* outInfoVec);
00398 
00399 
00400   // Remove update/whole extent when resetting pipeline information.
00401   virtual void ResetPipelineInformation(int port, vtkInformation*);
00402 
00403   // Flag for when an algorithm returns with CONTINUE_EXECUTING in the
00404   // request.
00405   int ContinueExecuting;
00406 
00407   vtkInformation *UpdateExtentRequest;
00408 
00409   // did the most recent PUE do anything ?
00410   int LastPropogateUpdateExtentShortCircuited;
00411 
00412 private:
00413   vtkStreamingDemandDrivenPipeline(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00414   void operator=(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00415 };
00416 
00417 #endif