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