VTK
dox/Filtering/vtkCompositeDataPipeline.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCompositeDataPipeline.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 =========================================================================*/
00049 #ifndef __vtkCompositeDataPipeline_h
00050 #define __vtkCompositeDataPipeline_h
00051 
00052 #include "vtkStreamingDemandDrivenPipeline.h"
00053 
00054 class vtkCompositeDataSet;
00055 class vtkInformationDoubleKey;
00056 class vtkInformationIntegerVectorKey;
00057 class vtkInformationObjectBaseKey;
00058 class vtkInformationStringKey;
00059 class vtkInformationDataObjectKey;
00060 class vtkInformationIntegerKey;
00061 
00062 class VTK_FILTERING_EXPORT vtkCompositeDataPipeline : public vtkStreamingDemandDrivenPipeline
00063 {
00064 public:
00065   static vtkCompositeDataPipeline* New();
00066   vtkTypeMacro(vtkCompositeDataPipeline,vtkStreamingDemandDrivenPipeline);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00070 
00072   virtual int ProcessRequest(vtkInformation* request,
00073                              vtkInformationVector** inInfo,
00074                              vtkInformationVector* outInfo);
00076 
00079   vtkDataObject* GetCompositeOutputData(int port);
00080 
00082 
00084   vtkDataObject* GetCompositeInputData(
00085     int port, int index, vtkInformationVector **inInfoVec);
00087 
00089   static vtkInformationIntegerKey*       REQUIRES_TIME_DOWNSTREAM();
00090 
00096   static vtkInformationObjectBaseKey* COMPOSITE_DATA_META_DATA();
00097 
00106   static vtkInformationIntegerVectorKey* UPDATE_COMPOSITE_INDICES();
00107 
00113   static vtkInformationIntegerVectorKey* COMPOSITE_INDICES();
00114 
00120   static vtkInformationIntegerKey* COMPOSITE_INDEX();
00121 
00122 protected:
00123   vtkCompositeDataPipeline();
00124   ~vtkCompositeDataPipeline();
00125 
00126   virtual int ForwardUpstream(vtkInformation* request);
00127   virtual int ForwardUpstream(int i, int j, vtkInformation* request);
00128 
00129   // Copy information for the given request.
00130   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00131                                       vtkInformationVector** inInfoVec,
00132                                       vtkInformationVector* outInfoVec);
00133 
00134   virtual void CopyFromDataToInformation(
00135     vtkDataObject* dobj, vtkInformation* inInfo);
00136   virtual void PushInformation(vtkInformation*);
00137   virtual void PopInformation (vtkInformation*);
00138 
00139   virtual int ExecuteDataObject(vtkInformation* request,
00140                                 vtkInformationVector** inInfo,
00141                                 vtkInformationVector* outInfo);
00142 
00143   virtual int ExecuteData(vtkInformation* request,
00144                           vtkInformationVector** inInfoVec,
00145                           vtkInformationVector* outInfoVec);
00146 
00147   virtual void ExecuteDataStart(vtkInformation* request,
00148                                 vtkInformationVector** inInfoVec,
00149                                 vtkInformationVector* outInfoVec);
00150 
00151   // Override this check to account for update extent.
00152   virtual int NeedToExecuteData(int outputPort,
00153                                 vtkInformationVector** inInfoVec,
00154                                 vtkInformationVector* outInfoVec);
00155 
00156   // Override this check to account for iterating over temporal data.
00157   virtual int NeedToExecuteBasedOnTime(vtkInformation *outInfo,
00158                                        vtkDataObject *dataObject);
00159 
00160   // Check whether the data object in the pipeline information for an
00161   // output port exists and has a valid type.
00162   virtual int CheckCompositeData(vtkInformation *request,
00163                                  int port, 
00164                                  vtkInformationVector** inInfoVec,
00165                                  vtkInformationVector* outInfoVec);
00166 
00167   // True when the pipeline is iterating over the current (simple) filter
00168   // to produce composite output. In this case, ExecuteDataStart() should
00169   // NOT Initialize() the composite output.
00170   int InLocalLoop;
00171   
00172   virtual void ExecuteSimpleAlgorithm(vtkInformation* request,
00173                                       vtkInformationVector** inInfoVec,
00174                                       vtkInformationVector* outInfoVec,
00175                                       int compositePort);
00176   virtual void ExecuteSimpleAlgorithmTime(vtkInformation* request,
00177                                           vtkInformationVector** inInfoVec,
00178                                           vtkInformationVector* outInfoVec);
00179   vtkDataObject* ExecuteSimpleAlgorithmForBlock(
00180     vtkInformationVector** inInfoVec,
00181     vtkInformationVector* outInfoVec,
00182     vtkInformation* inInfo,
00183     vtkInformation* outInfo,
00184     vtkInformation* request,  
00185     vtkDataObject* dobj);
00186 
00187   bool ShouldIterateOverInput(int& compositePort);
00188   bool ShouldIterateTemporalData(vtkInformation *request,
00189                                  vtkInformationVector** inInfoVec, 
00190                                  vtkInformationVector *outInfoVec);
00191   virtual int InputTypeIsValid(int port, int index, 
00192                                 vtkInformationVector **inInfoVec);
00193 
00194   vtkInformation* InformationCache;
00195 
00196   vtkInformation* GenericRequest;
00197   vtkInformation* DataObjectRequest;
00198   vtkInformation* InformationRequest;
00199   vtkInformation* UpdateExtentRequest;
00200   vtkInformation* DataRequest;
00201 
00202   // Because we sometimes have to swap between "simple" data types and composite
00203   // data types, we sometimes want to skip resetting the pipeline information.
00204   int SuppressResetPipelineInformation;
00205 
00206   virtual void ResetPipelineInformation(int port, vtkInformation*);
00207 
00209 
00216   vtkCompositeDataSet* CreateOutputCompositeDataSet(
00217     vtkCompositeDataSet* input, int compositePort);
00219 
00220   // Override this to handle UPDATE_COMPOSITE_INDICES().
00221   virtual void MarkOutputsGenerated(vtkInformation* request,
00222                                     vtkInformationVector** inInfoVec,
00223                                     vtkInformationVector* outInfoVec);
00224 
00225   int NeedToExecuteBasedOnCompositeIndices(vtkInformation* outInfo);
00226 
00227 private:
00228   vtkCompositeDataPipeline(const vtkCompositeDataPipeline&);  // Not implemented.
00229   void operator=(const vtkCompositeDataPipeline&);  // Not implemented.
00230 };
00231 
00232 #endif