VTK
dox/Filtering/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 "vtkDemandDrivenPipeline.h"
00035 
00036 #define VTK_UPDATE_EXTENT_COMBINE 1
00037 #define VTK_UPDATE_EXTENT_REPLACE 2
00038 
00039 class vtkExtentTranslator;
00040 class vtkInformationDoubleKey;
00041 class vtkInformationDoubleVectorKey;
00042 class vtkInformationIntegerKey;
00043 class vtkInformationIntegerVectorKey;
00044 class vtkInformationObjectBaseKey;
00045 class vtkInformationStringKey;
00046 class vtkInformationIdTypeKey;
00047 
00048 class VTK_FILTERING_EXPORT vtkStreamingDemandDrivenPipeline : public vtkDemandDrivenPipeline
00049 {
00050 public:
00051   static vtkStreamingDemandDrivenPipeline* New();
00052   vtkTypeMacro(vtkStreamingDemandDrivenPipeline,vtkDemandDrivenPipeline);
00053   void PrintSelf(ostream& os, vtkIndent indent);
00054 
00056 
00058   virtual int ProcessRequest(vtkInformation* request,
00059                              vtkInformationVector** inInfo,
00060                              vtkInformationVector* outInfo);
00062 
00064 
00065   virtual int Update();
00066   virtual int Update(int port);
00067   virtual int UpdateWholeExtent();
00069 
00072   int PropagateUpdateExtent(int outputPort);
00073 
00075 
00079   int SetMaximumNumberOfPieces(int port, int n);
00080   int SetMaximumNumberOfPieces(vtkInformation *, int n);
00081   int GetMaximumNumberOfPieces(int port);
00082   int GetMaximumNumberOfPieces(vtkInformation *);
00084 
00086 
00089   int SetWholeExtent(vtkInformation *, int extent[6]);
00090   void GetWholeExtent(vtkInformation *, int extent[6]);
00091   int* GetWholeExtent(vtkInformation *);
00093 
00095 
00099   int SetUpdateExtentToWholeExtent(int port);
00100   int SetUpdateExtentToWholeExtent(vtkInformation *);
00102   
00104 
00105   int SetUpdateExtent(int port, int extent[6]);
00106   int SetUpdateExtent(vtkInformation *, int extent[6]);
00107   void GetUpdateExtent(vtkInformation *, int extent[6]);
00108   int* GetUpdateExtent(vtkInformation *);
00110 
00112 
00114   int SetUpdateExtent(int port, 
00115                       int piece, int numPieces, int ghostLevel);
00116   int SetUpdateExtent(vtkInformation *, 
00117                       int piece, int numPieces, int ghostLevel);
00118   int SetUpdatePiece(vtkInformation *, int piece);
00119   int GetUpdatePiece(vtkInformation *);
00120   int SetUpdateNumberOfPieces(vtkInformation *, int n);
00121   int GetUpdateNumberOfPieces(vtkInformation *);
00122   int SetUpdateGhostLevel(vtkInformation *, int n);
00123   int GetUpdateGhostLevel(vtkInformation *);
00124   int SetUpdateResolution(int port, double r);
00125   int SetUpdateResolution(vtkInformation *, double r);
00126   double GetUpdateResolution(vtkInformation *);
00128 
00130 
00131   int SetUpdateTimeSteps(int port, double *times, int length);
00132   int SetUpdateTimeSteps(vtkInformation *, double *times, int length);
00133   int SetUpdateTimeStep(int port, double time);
00134   //void GetUpdateTimeSteps(vtkInformation *, int extent[6]);
00136 
00138 
00144   int SetRequestExactExtent(int port, int flag);
00145   int GetRequestExactExtent(int port);
00147 
00149 
00151   int SetExtentTranslator(int port, vtkExtentTranslator* translator);
00152   int SetExtentTranslator(vtkInformation *, vtkExtentTranslator* translator);
00153   vtkExtentTranslator* GetExtentTranslator(int port);
00154   vtkExtentTranslator* GetExtentTranslator(vtkInformation *info);
00156 
00158 
00161   int SetWholeBoundingBox(int port, double bb[6]);
00162   void GetWholeBoundingBox(int port, double bb[6]);
00163   double* GetWholeBoundingBox(int port);
00165 
00167 
00170   int SetPieceBoundingBox(int port, double bb[6]);
00171   void GetPieceBoundingBox(int port, double bb[6]);
00172   double* GetPieceBoundingBox(int port);
00174 
00176   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT();
00177 
00180   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT_INFORMATION();
00181 
00183   static vtkInformationRequestKey* REQUEST_RESOLUTION_PROPAGATE();
00184 
00187   static vtkInformationIntegerKey* CONTINUE_EXECUTING();
00188 
00190   static vtkInformationObjectBaseKey* EXTENT_TRANSLATOR();
00191 
00193 
00194   static vtkInformationIntegerKey* UPDATE_EXTENT_INITIALIZED();
00195   static vtkInformationIntegerVectorKey* UPDATE_EXTENT();
00196   static vtkInformationIntegerKey* UPDATE_PIECE_NUMBER();
00197   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_PIECES();
00198   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_GHOST_LEVELS();
00200 
00203   static vtkInformationIntegerVectorKey* COMBINED_UPDATE_EXTENT();
00204 
00207   static vtkInformationIntegerKey* UPDATE_EXTENT_TRANSLATED();
00208 
00210   static vtkInformationIntegerVectorKey* WHOLE_EXTENT();
00211 
00215   static vtkInformationIntegerKey* UNRESTRICTED_UPDATE_EXTENT();
00216 
00219   static vtkInformationIntegerKey* MAXIMUM_NUMBER_OF_PIECES();
00220 
00223   static vtkInformationDoubleVectorKey* WHOLE_BOUNDING_BOX();
00224 
00227   static vtkInformationDoubleVectorKey* PIECE_BOUNDING_BOX();
00228 
00230   static vtkInformationIntegerKey* EXACT_EXTENT();
00231 
00233   static vtkInformationDoubleVectorKey* TIME_STEPS();
00234 
00236   static vtkInformationDoubleVectorKey* TIME_RANGE();
00237 
00239   static vtkInformationDoubleVectorKey* UPDATE_TIME_STEPS();
00240 
00243   static vtkInformationDoubleKey* PRIORITY();
00244 
00247   static vtkInformationDoubleKey* UPDATE_RESOLUTION();
00248 
00251   static vtkInformationIntegerKey* REMOVE_ATTRIBUTE_INFORMATION();
00252 
00259   // Key to allow a reader to advertise that it supports a fast-path
00260   // for reading data over time.
00261   static vtkInformationIntegerKey* FAST_PATH_FOR_TEMPORAL_DATA();
00262   // The type of data being requested.
00263   // Possible values: POINT, CELL, EDGE, FACE
00264   static vtkInformationStringKey* FAST_PATH_OBJECT_TYPE();
00265   // Possible values: INDEX, GLOBAL
00266   static vtkInformationStringKey* FAST_PATH_ID_TYPE();
00267   // The id (either index or global id) being requested
00268   static vtkInformationIdTypeKey* FAST_PATH_OBJECT_ID();
00269 
00271 
00275   double ComputePriority()
00276     {
00277       return this->ComputePriority(0);
00278     }
00279   virtual double ComputePriority(int port);
00281 
00282 protected:
00283   vtkStreamingDemandDrivenPipeline();
00284   ~vtkStreamingDemandDrivenPipeline();
00285 
00287 
00290   virtual void ResetUpdateInformation(vtkInformation* request,
00291     vtkInformationVector** inInfoVec,
00292     vtkInformationVector* outInfoVec);
00294 
00295   // Keep track of the update time request corresponding to the
00296   // previous executing. If the previous update request did not
00297   // correspond to an existing time step and the reader chose 
00298   // a time step with it's own logic, the data time step will
00299   // be different than the request. If the same time step is
00300   // requested again, there is no need to re-execute the algorithm.
00301   // We know that it does not have this time step.
00302   static vtkInformationDoubleVectorKey* PREVIOUS_UPDATE_TIME_STEPS();
00303 
00304   // Keep track of the fast path keys corresponding to the 
00305   // previous executing. If all key values are the same as their
00306   // counterparts in the previous request, we do not need to re-execute.
00307   static vtkInformationIdTypeKey* PREVIOUS_FAST_PATH_OBJECT_ID();
00308   static vtkInformationStringKey* PREVIOUS_FAST_PATH_OBJECT_TYPE();
00309   static vtkInformationStringKey* PREVIOUS_FAST_PATH_ID_TYPE();
00310 
00311   // Does the time request correspond to what is in the data?
00312   // Returns 0 if yes, 1 otherwise.
00313   virtual int NeedToExecuteBasedOnTime(vtkInformation* outInfo,
00314                                        vtkDataObject* dataObject);
00315 
00316   // If the request contains a fast path key for temporal data, always execute
00317   virtual int NeedToExecuteBasedOnFastPathData(vtkInformation* outInfo);
00318 
00319   // Setup default information on the output after the algorithm
00320   // executes information.
00321   virtual int ExecuteInformation(vtkInformation* request,
00322                                  vtkInformationVector** inInfoVec,
00323                                  vtkInformationVector* outInfoVec);
00324 
00325   // Copy information for the given request.
00326   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00327                                       vtkInformationVector** inInfoVec,
00328                                       vtkInformationVector* outInfoVec);
00329 
00330   // Helper to check output information before propagating it to inputs.
00331   virtual int VerifyOutputInformation(int outputPort,
00332                                       vtkInformationVector** inInfoVec,
00333                                       vtkInformationVector* outInfoVec);
00334 
00335 
00336   // Override this check to account for update extent.
00337   virtual int NeedToExecuteData(int outputPort,
00338                                 vtkInformationVector** inInfoVec,
00339                                 vtkInformationVector* outInfoVec);
00340 
00341   // Override these to handle the continue-executing option.
00342   virtual void ExecuteDataStart(vtkInformation* request,
00343                                 vtkInformationVector** inInfoVec,
00344                                 vtkInformationVector* outInfoVec);
00345   virtual void ExecuteDataEnd(vtkInformation* request,
00346                               vtkInformationVector** inInfoVec,
00347                               vtkInformationVector* outInfoVec);
00348 
00349   // Override this to handle cropping and ghost levels.
00350   virtual void MarkOutputsGenerated(vtkInformation* request,
00351                                     vtkInformationVector** inInfoVec,
00352                                     vtkInformationVector* outInfoVec);
00353 
00354 
00355   // Remove update/whole extent when resetting pipeline information.
00356   virtual void ResetPipelineInformation(int port, vtkInformation*);
00357 
00358   // Flag for when an algorithm returns with CONTINUE_EXECUTING in the
00359   // request.
00360   int ContinueExecuting;
00361 
00362   vtkInformation *UpdateExtentRequest;
00363 
00364   // did the most recent PUE do anything ?
00365   int LastPropogateUpdateExtentShortCircuited;
00366   
00367 private:
00368   vtkStreamingDemandDrivenPipeline(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00369   void operator=(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00370 };
00371 
00372 #endif