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 
00115 protected:
00116   vtkCompositeDataPipeline();
00117   ~vtkCompositeDataPipeline();
00118 
00119   virtual int ForwardUpstream(vtkInformation* request);
00120   virtual int ForwardUpstream(int i, int j, vtkInformation* request);
00121 
00122   // Copy information for the given request.
00123   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00124                                       vtkInformationVector** inInfoVec,
00125                                       vtkInformationVector* outInfoVec);
00126 
00127   virtual void CopyFromDataToInformation(
00128     vtkDataObject* dobj, vtkInformation* inInfo);
00129   virtual void PushInformation(vtkInformation*);
00130   virtual void PopInformation (vtkInformation*);
00131 
00132   virtual int ExecuteDataObject(vtkInformation* request,
00133                                 vtkInformationVector** inInfo,
00134                                 vtkInformationVector* outInfo);
00135 
00136   virtual int ExecuteData(vtkInformation* request,
00137                           vtkInformationVector** inInfoVec,
00138                           vtkInformationVector* outInfoVec);
00139 
00140   virtual void ExecuteDataStart(vtkInformation* request,
00141                                 vtkInformationVector** inInfoVec,
00142                                 vtkInformationVector* outInfoVec);
00143 
00144   // Override this check to account for update extent.
00145   virtual int NeedToExecuteData(int outputPort,
00146                                 vtkInformationVector** inInfoVec,
00147                                 vtkInformationVector* outInfoVec);
00148 
00149   // Override this check to account for iterating over temporal data.
00150   virtual int NeedToExecuteBasedOnTime(vtkInformation *outInfo,
00151                                        vtkDataObject *dataObject);
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 CheckCompositeData(vtkInformation *request,
00156                                  int port, 
00157                                  vtkInformationVector** inInfoVec,
00158                                  vtkInformationVector* outInfoVec);
00159 
00160   // True when the pipeline is iterating over the current (simple) filter
00161   // to produce composite output. In this case, ExecuteDataStart() should
00162   // NOT Initialize() the composite output.
00163   int InLocalLoop;
00164   
00165   virtual void ExecuteSimpleAlgorithm(vtkInformation* request,
00166                                       vtkInformationVector** inInfoVec,
00167                                       vtkInformationVector* outInfoVec,
00168                                       int compositePort);
00169   virtual void ExecuteSimpleAlgorithmTime(vtkInformation* request,
00170                                           vtkInformationVector** inInfoVec,
00171                                           vtkInformationVector* outInfoVec);
00172   vtkDataObject* ExecuteSimpleAlgorithmForBlock(
00173     vtkInformationVector** inInfoVec,
00174     vtkInformationVector* outInfoVec,
00175     vtkInformation* inInfo,
00176     vtkInformation* outInfo,
00177     vtkInformation* request,  
00178     vtkDataObject* dobj);
00179 
00180   bool ShouldIterateOverInput(int& compositePort);
00181   bool ShouldIterateTemporalData(vtkInformation *request,
00182                                  vtkInformationVector** inInfoVec, 
00183                                  vtkInformationVector *outInfoVec);
00184   virtual int InputTypeIsValid(int port, int index, 
00185                                 vtkInformationVector **inInfoVec);
00186 
00187   vtkInformation* InformationCache;
00188 
00189   vtkInformation* GenericRequest;
00190   vtkInformation* DataObjectRequest;
00191   vtkInformation* InformationRequest;
00192   vtkInformation* UpdateExtentRequest;
00193   vtkInformation* DataRequest;
00194 
00195   // Because we sometimes have to swap between "simple" data types and composite
00196   // data types, we sometimes want to skip resetting the pipeline information.
00197   int SuppressResetPipelineInformation;
00198 
00199   virtual void ResetPipelineInformation(int port, vtkInformation*);
00200 
00202 
00209   vtkCompositeDataSet* CreateOutputCompositeDataSet(
00210     vtkCompositeDataSet* input, int compositePort);
00212 
00213   // Override this to handle UPDATE_COMPOSITE_INDICES().
00214   virtual void MarkOutputsGenerated(vtkInformation* request,
00215                                     vtkInformationVector** inInfoVec,
00216                                     vtkInformationVector* outInfoVec);
00217 
00218   int NeedToExecuteBasedOnCompositeIndices(vtkInformation* outInfo);
00219 
00220 private:
00221   vtkCompositeDataPipeline(const vtkCompositeDataPipeline&);  // Not implemented.
00222   void operator=(const vtkCompositeDataPipeline&);  // Not implemented.
00223 };
00224 
00225 #endif