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 vtkInformationIdTypeKey;
00043 class vtkInformationIntegerKey;
00044 class vtkInformationIntegerVectorKey;
00045 class vtkInformationObjectBaseKey;
00046 class vtkInformationStringKey;
00047 class vtkInformationUnsignedLongKey;
00048 
00049 class VTK_FILTERING_EXPORT vtkStreamingDemandDrivenPipeline : public vtkDemandDrivenPipeline
00050 {
00051 public:
00052   static vtkStreamingDemandDrivenPipeline* New();
00053   vtkTypeMacro(vtkStreamingDemandDrivenPipeline,vtkDemandDrivenPipeline);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055 
00057 
00059   virtual int ProcessRequest(vtkInformation* request,
00060                              vtkInformationVector** inInfo,
00061                              vtkInformationVector* outInfo);
00063 
00065 
00066   virtual int Update();
00067   virtual int Update(int port);
00068   virtual int UpdateWholeExtent();
00070 
00073   int PropagateUpdateExtent(int outputPort);
00074 
00076 
00080   int SetMaximumNumberOfPieces(int port, int n);
00081   int SetMaximumNumberOfPieces(vtkInformation *, int n);
00082   int GetMaximumNumberOfPieces(int port);
00083   int GetMaximumNumberOfPieces(vtkInformation *);
00085 
00087 
00090   int SetWholeExtent(vtkInformation *, int extent[6]);
00091   void GetWholeExtent(vtkInformation *, int extent[6]);
00092   int* GetWholeExtent(vtkInformation *);
00094 
00096 
00100   int SetUpdateExtentToWholeExtent(int port);
00101   int SetUpdateExtentToWholeExtent(vtkInformation *);
00103   
00105 
00106   int SetUpdateExtent(int port, int extent[6]);
00107   int SetUpdateExtent(vtkInformation *, int extent[6]);
00108   void GetUpdateExtent(vtkInformation *, int extent[6]);
00109   int* GetUpdateExtent(vtkInformation *);
00111 
00113 
00115   int SetUpdateExtent(int port, 
00116                       int piece, int numPieces, int ghostLevel);
00117   int SetUpdateExtent(vtkInformation *, 
00118                       int piece, int numPieces, int ghostLevel);
00119   int SetUpdatePiece(vtkInformation *, int piece);
00120   int GetUpdatePiece(vtkInformation *);
00121   int SetUpdateNumberOfPieces(vtkInformation *, int n);
00122   int GetUpdateNumberOfPieces(vtkInformation *);
00123   int SetUpdateGhostLevel(vtkInformation *, int n);
00124   int GetUpdateGhostLevel(vtkInformation *);
00125   int SetUpdateResolution(int port, double r);
00126   int SetUpdateResolution(vtkInformation *, double r);
00127   double GetUpdateResolution(vtkInformation *);
00129 
00131 
00132   int SetUpdateTimeSteps(int port, double *times, int length);
00133   int SetUpdateTimeSteps(vtkInformation *, double *times, int length);
00134   int SetUpdateTimeStep(int port, double time);
00135   //void GetUpdateTimeSteps(vtkInformation *, int extent[6]);
00137 
00139 
00145   int SetRequestExactExtent(int port, int flag);
00146   int GetRequestExactExtent(int port);
00148 
00150 
00152   int SetExtentTranslator(int port, vtkExtentTranslator* translator);
00153   int SetExtentTranslator(vtkInformation *, vtkExtentTranslator* translator);
00154   vtkExtentTranslator* GetExtentTranslator(int port);
00155   vtkExtentTranslator* GetExtentTranslator(vtkInformation *info);
00157 
00159 
00162   int SetWholeBoundingBox(int port, double bb[6]);
00163   void GetWholeBoundingBox(int port, double bb[6]);
00164   double* GetWholeBoundingBox(int port);
00166 
00168 
00171   int SetPieceBoundingBox(int port, double bb[6]);
00172   void GetPieceBoundingBox(int port, double bb[6]);
00173   double* GetPieceBoundingBox(int port);
00175 
00177   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT();
00178 
00180 
00182   static vtkInformationRequestKey* REQUEST_UPDATE_EXTENT_INFORMATION();
00183   static vtkInformationRequestKey* REQUEST_MANAGE_INFORMATION();
00185 
00187   static vtkInformationRequestKey* REQUEST_RESOLUTION_PROPAGATE();
00188 
00191   static vtkInformationIntegerKey* CONTINUE_EXECUTING();
00192 
00194   static vtkInformationObjectBaseKey* EXTENT_TRANSLATOR();
00195 
00197 
00198   static vtkInformationIntegerKey* UPDATE_EXTENT_INITIALIZED();
00199   static vtkInformationIntegerVectorKey* UPDATE_EXTENT();
00200   static vtkInformationIntegerKey* UPDATE_PIECE_NUMBER();
00201   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_PIECES();
00202   static vtkInformationIntegerKey* UPDATE_NUMBER_OF_GHOST_LEVELS();
00204 
00207   static vtkInformationIntegerVectorKey* COMBINED_UPDATE_EXTENT();
00208 
00211   static vtkInformationIntegerKey* UPDATE_EXTENT_TRANSLATED();
00212 
00214   static vtkInformationIntegerVectorKey* WHOLE_EXTENT();
00215 
00219   static vtkInformationIntegerKey* UNRESTRICTED_UPDATE_EXTENT();
00220 
00223   static vtkInformationIntegerKey* MAXIMUM_NUMBER_OF_PIECES();
00224 
00227   static vtkInformationDoubleVectorKey* WHOLE_BOUNDING_BOX();
00228 
00231   static vtkInformationDoubleVectorKey* PIECE_BOUNDING_BOX();
00232 
00234   static vtkInformationDoubleVectorKey* PIECE_NORMAL();
00235 
00237   static vtkInformationIntegerKey* EXACT_EXTENT();
00238 
00240   static vtkInformationDoubleVectorKey* TIME_STEPS();
00241 
00243   static vtkInformationDoubleVectorKey* TIME_RANGE();
00244 
00246   static vtkInformationDoubleVectorKey* UPDATE_TIME_STEPS();
00247 
00250   static vtkInformationDoubleKey* PRIORITY();
00251 
00254   static vtkInformationUnsignedLongKey* ORIGINAL_NUMBER_OF_CELLS();
00255 
00258   static vtkInformationDoubleKey* UPDATE_RESOLUTION();
00259 
00262   static vtkInformationIntegerKey* REMOVE_ATTRIBUTE_INFORMATION();
00263 
00270   // Key to allow a reader to advertise that it supports a fast-path
00271   // for reading data over time.
00272   static vtkInformationIntegerKey* FAST_PATH_FOR_TEMPORAL_DATA();
00273   // The type of data being requested.
00274   // Possible values: POINT, CELL, EDGE, FACE
00275   static vtkInformationStringKey* FAST_PATH_OBJECT_TYPE();
00276   // Possible values: INDEX, GLOBAL
00277   static vtkInformationStringKey* FAST_PATH_ID_TYPE();
00278   // The id (either index or global id) being requested
00279   static vtkInformationIdTypeKey* FAST_PATH_OBJECT_ID();
00280 
00282 
00286   double ComputePriority()
00287     {
00288       return this->ComputePriority(0);
00289     }
00290   virtual double ComputePriority(int port);
00292 
00293 protected:
00294   vtkStreamingDemandDrivenPipeline();
00295   ~vtkStreamingDemandDrivenPipeline();
00296 
00298 
00301   virtual void ResetUpdateInformation(vtkInformation* request,
00302     vtkInformationVector** inInfoVec,
00303     vtkInformationVector* outInfoVec);
00305 
00306   // Keep track of the update time request corresponding to the
00307   // previous executing. If the previous update request did not
00308   // correspond to an existing time step and the reader chose 
00309   // a time step with it's own logic, the data time step will
00310   // be different than the request. If the same time step is
00311   // requested again, there is no need to re-execute the algorithm.
00312   // We know that it does not have this time step.
00313   static vtkInformationDoubleVectorKey* PREVIOUS_UPDATE_TIME_STEPS();
00314 
00315   // Keep track of the fast path keys corresponding to the 
00316   // previous executing. If all key values are the same as their
00317   // counterparts in the previous request, we do not need to re-execute.
00318   static vtkInformationIdTypeKey* PREVIOUS_FAST_PATH_OBJECT_ID();
00319   static vtkInformationStringKey* PREVIOUS_FAST_PATH_OBJECT_TYPE();
00320   static vtkInformationStringKey* PREVIOUS_FAST_PATH_ID_TYPE();
00321 
00322   // Does the time request correspond to what is in the data?
00323   // Returns 0 if yes, 1 otherwise.
00324   virtual int NeedToExecuteBasedOnTime(vtkInformation* outInfo,
00325                                        vtkDataObject* dataObject);
00326 
00327   // If the request contains a fast path key for temporal data, always execute
00328   virtual int NeedToExecuteBasedOnFastPathData(vtkInformation* outInfo);
00329 
00330   // Setup default information on the output after the algorithm
00331   // executes information.
00332   virtual int ExecuteInformation(vtkInformation* request,
00333                                  vtkInformationVector** inInfoVec,
00334                                  vtkInformationVector* outInfoVec);
00335 
00336   // Copy information for the given request.
00337   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00338                                       vtkInformationVector** inInfoVec,
00339                                       vtkInformationVector* outInfoVec);
00340 
00341   // Helper to check output information before propagating it to inputs.
00342   virtual int VerifyOutputInformation(int outputPort,
00343                                       vtkInformationVector** inInfoVec,
00344                                       vtkInformationVector* outInfoVec);
00345 
00346 
00347   // Override this check to account for update extent.
00348   virtual int NeedToExecuteData(int outputPort,
00349                                 vtkInformationVector** inInfoVec,
00350                                 vtkInformationVector* outInfoVec);
00351 
00352   // Override these to handle the continue-executing option.
00353   virtual void ExecuteDataStart(vtkInformation* request,
00354                                 vtkInformationVector** inInfoVec,
00355                                 vtkInformationVector* outInfoVec);
00356   virtual void ExecuteDataEnd(vtkInformation* request,
00357                               vtkInformationVector** inInfoVec,
00358                               vtkInformationVector* outInfoVec);
00359 
00360   // Override this to handle cropping and ghost levels.
00361   virtual void MarkOutputsGenerated(vtkInformation* request,
00362                                     vtkInformationVector** inInfoVec,
00363                                     vtkInformationVector* outInfoVec);
00364 
00365 
00366   // Remove update/whole extent when resetting pipeline information.
00367   virtual void ResetPipelineInformation(int port, vtkInformation*);
00368 
00369   // Flag for when an algorithm returns with CONTINUE_EXECUTING in the
00370   // request.
00371   int ContinueExecuting;
00372 
00373   vtkInformation *UpdateExtentRequest;
00374 
00375   // did the most recent PUE do anything ?
00376   int LastPropogateUpdateExtentShortCircuited;
00377   
00378 private:
00379   vtkStreamingDemandDrivenPipeline(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00380   void operator=(const vtkStreamingDemandDrivenPipeline&);  // Not implemented.
00381 };
00382 
00383 #endif