VTK
dox/Filtering/vtkDemandDrivenPipeline.h
Go to the documentation of this file.
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 =========================================================================*/
00026 #ifndef __vtkDemandDrivenPipeline_h
00027 #define __vtkDemandDrivenPipeline_h
00028 
00029 #include "vtkExecutive.h"
00030 
00031 class vtkAbstractArray;
00032 class vtkDataArray;
00033 class vtkDataSetAttributes;
00034 class vtkDemandDrivenPipelineInternals;
00035 class vtkFieldData;
00036 class vtkInformation;
00037 class vtkInformationIntegerKey;
00038 class vtkInformationVector;
00039 class vtkInformationKeyVectorKey;
00040 class vtkInformationUnsignedLongKey;
00041 
00042 class VTK_FILTERING_EXPORT vtkDemandDrivenPipeline : public vtkExecutive
00043 {
00044 public:
00045   static vtkDemandDrivenPipeline* New();
00046   vtkTypeMacro(vtkDemandDrivenPipeline,vtkExecutive);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00050 
00052   virtual int ProcessRequest(vtkInformation* request,
00053                              vtkInformationVector** inInfo,
00054                              vtkInformationVector* outInfo);
00056 
00058 
00059   virtual int
00060   ComputePipelineMTime(vtkInformation* request,
00061                        vtkInformationVector** inInfoVec,
00062                        vtkInformationVector* outInfoVec,
00063                        int requestFromOutputPort,
00064                        unsigned long* mtime);
00066 
00068 
00070   virtual int Update();
00071   virtual int Update(int port);
00073 
00075 
00076   vtkGetMacro(PipelineMTime, unsigned long);
00078 
00081   virtual int SetReleaseDataFlag(int port, int n);
00082 
00084   virtual int GetReleaseDataFlag(int port);
00085 
00087   virtual int UpdatePipelineMTime();
00088 
00092   virtual int UpdateDataObject();
00093 
00095   virtual int UpdateInformation();
00096 
00100   virtual int UpdateData(int outputPort);
00101 
00103   static vtkInformationRequestKey* REQUEST_DATA_OBJECT();
00104   
00107   static vtkInformationRequestKey* REQUEST_INFORMATION();
00108   
00110   static vtkInformationRequestKey* REQUEST_DATA();
00111 
00114   static vtkInformationRequestKey* REQUEST_DATA_NOT_GENERATED();
00115 
00118   static vtkInformationIntegerKey* RELEASE_DATA();
00119 
00123   static vtkInformationIntegerKey* DATA_NOT_GENERATED();
00124 
00128   static vtkDataObject* NewDataObject(const char* type);
00129 
00132   static vtkInformationIntegerKey* REQUEST_REGENERATE_INFORMATION();
00133 
00134 protected:
00135   vtkDemandDrivenPipeline();
00136   ~vtkDemandDrivenPipeline();
00137 
00138   // Helper methods to send requests to the algorithm.
00139   virtual int ExecuteDataObject(vtkInformation* request,
00140                                 vtkInformationVector** inInfo,
00141                                 vtkInformationVector* outInfo);
00142   virtual int ExecuteInformation(vtkInformation* request,
00143                                  vtkInformationVector** inInfo,
00144                                  vtkInformationVector* outInfo);
00145   virtual int ExecuteData(vtkInformation* request,
00146                           vtkInformationVector** inInfo,
00147                           vtkInformationVector* outInfo);
00148 
00149 
00150   // Reset the pipeline update values in the given output information object.
00151   virtual void ResetPipelineInformation(int port, vtkInformation*);
00152 
00153   // Check whether the data object in the pipeline information for an
00154   // output port exists and has a valid type.
00155   virtual int CheckDataObject(int port, vtkInformationVector* outInfo);
00156 
00157 
00158   // Input connection validity checkers.
00159   int InputCountIsValid(vtkInformationVector **);
00160   int InputCountIsValid(int port,vtkInformationVector **);
00161   int InputTypeIsValid(vtkInformationVector **);
00162   int InputTypeIsValid(int port,vtkInformationVector **);
00163   virtual int InputTypeIsValid(int port, int index,vtkInformationVector **);
00164   int InputFieldsAreValid(vtkInformationVector **);
00165   int InputFieldsAreValid(int port,vtkInformationVector **);
00166   virtual int InputFieldsAreValid(int port, int index,vtkInformationVector **);
00167 
00168   // Field existence checkers.
00169   int DataSetAttributeExists(vtkDataSetAttributes* dsa, vtkInformation* field);
00170   int FieldArrayExists(vtkFieldData* data, vtkInformation* field);
00171   int ArrayIsValid(vtkAbstractArray* array, vtkInformation* field);
00172 
00173   // Input port information checkers.
00174   int InputIsOptional(int port);
00175   int InputIsRepeatable(int port);
00176 
00177   // Decide whether the output data need to be generated.
00178   virtual int NeedToExecuteData(int outputPort,
00179                                 vtkInformationVector** inInfoVec,
00180                                 vtkInformationVector* outInfoVec);
00181 
00182   // Handle before/after operations for ExecuteData method.
00183   virtual void ExecuteDataStart(vtkInformation* request,
00184                                 vtkInformationVector** inInfoVec,
00185                                 vtkInformationVector* outInfoVec);
00186   virtual void ExecuteDataEnd(vtkInformation* request,
00187                               vtkInformationVector** inInfoVec,
00188                               vtkInformationVector* outInfoVec);
00189   virtual void MarkOutputsGenerated(vtkInformation* request,
00190                                     vtkInformationVector** inInfoVec,
00191                                     vtkInformationVector* outInfoVec);
00192 
00193   // Largest MTime of any algorithm on this executive or preceding
00194   // executives.
00195   unsigned long PipelineMTime;
00196 
00197   // Time when information or data were last generated.
00198   vtkTimeStamp DataObjectTime;
00199   vtkTimeStamp InformationTime;
00200   vtkTimeStamp DataTime;
00201 
00202 //BTX
00203   friend class vtkCompositeDataPipeline;
00204 //ETX
00205 
00206 
00207   vtkInformation *InfoRequest;
00208   vtkInformation *DataObjectRequest;
00209   vtkInformation *DataRequest;
00210   
00211 private:
00212   vtkDemandDrivenPipeline(const vtkDemandDrivenPipeline&);  // Not implemented.
00213   void operator=(const vtkDemandDrivenPipeline&);  // Not implemented.
00214 };
00215 
00216 #endif