VTK
dox/Common/ExecutionModel/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 "vtkCommonExecutionModelModule.h" // For export macro
00053 #include "vtkStreamingDemandDrivenPipeline.h"
00054 
00055 class vtkCompositeDataSet;
00056 class vtkCompositeDataIterator;
00057 class vtkInformationDoubleKey;
00058 class vtkInformationIntegerVectorKey;
00059 class vtkInformationObjectBaseKey;
00060 class vtkInformationStringKey;
00061 class vtkInformationDataObjectKey;
00062 class vtkInformationIntegerKey;
00063 
00064 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkCompositeDataPipeline :
00065   public vtkStreamingDemandDrivenPipeline
00066 {
00067 public:
00068   static vtkCompositeDataPipeline* New();
00069   vtkTypeMacro(vtkCompositeDataPipeline,vtkStreamingDemandDrivenPipeline);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00074   vtkDataObject* GetCompositeOutputData(int port);
00075 
00077 
00079   vtkDataObject* GetCompositeInputData(
00080     int port, int index, vtkInformationVector **inInfoVec);
00082 
00085   static vtkInformationIntegerKey*  LOAD_REQUESTED_BLOCKS();
00086 
00092   static vtkInformationObjectBaseKey* COMPOSITE_DATA_META_DATA();
00093 
00102   static vtkInformationIntegerVectorKey* UPDATE_COMPOSITE_INDICES();
00103 
00109   static vtkInformationIntegerVectorKey* COMPOSITE_INDICES();
00110 
00111 
00112 protected:
00113   vtkCompositeDataPipeline();
00114   ~vtkCompositeDataPipeline();
00115 
00116   virtual int ForwardUpstream(vtkInformation* request);
00117   virtual int ForwardUpstream(int i, int j, vtkInformation* request);
00118 
00119   // Copy information for the given request.
00120   virtual void CopyDefaultInformation(vtkInformation* request, int direction,
00121                                       vtkInformationVector** inInfoVec,
00122                                       vtkInformationVector* outInfoVec);
00123 
00124   virtual void CopyFromDataToInformation(
00125     vtkDataObject* dobj, vtkInformation* inInfo);
00126   virtual void PushInformation(vtkInformation*);
00127   virtual void PopInformation (vtkInformation*);
00128 
00129   virtual int ExecuteDataObject(vtkInformation* request,
00130                                 vtkInformationVector** inInfo,
00131                                 vtkInformationVector* outInfo);
00132 
00133   virtual int ExecuteData(vtkInformation* request,
00134                           vtkInformationVector** inInfoVec,
00135                           vtkInformationVector* outInfoVec);
00136 
00137   virtual void ExecuteDataStart(vtkInformation* request,
00138                                 vtkInformationVector** inInfoVec,
00139                                 vtkInformationVector* outInfoVec);
00140 
00141   // Override this check to account for update extent.
00142   virtual int NeedToExecuteData(int outputPort,
00143                                 vtkInformationVector** inInfoVec,
00144                                 vtkInformationVector* outInfoVec);
00145 
00146   // Check whether the data object in the pipeline information for an
00147   // output port exists and has a valid type.
00148   virtual int CheckCompositeData(vtkInformation *request,
00149                                  int port,
00150                                  vtkInformationVector** inInfoVec,
00151                                  vtkInformationVector* outInfoVec);
00152 
00153   // True when the pipeline is iterating over the current (simple) filter
00154   // to produce composite output. In this case, ExecuteDataStart() should
00155   // NOT Initialize() the composite output.
00156   int InLocalLoop;
00157 
00158   virtual void ExecuteSimpleAlgorithm(vtkInformation* request,
00159                                       vtkInformationVector** inInfoVec,
00160                                       vtkInformationVector* outInfoVec,
00161                                       int compositePort);
00162 
00163   virtual void ExecuteEach(vtkCompositeDataIterator* iter,
00164                            vtkInformationVector** inInfoVec,
00165                            vtkInformationVector* outInfoVec,
00166                            int compositePort,
00167                            int connection,
00168                            vtkInformation* request,
00169                            vtkCompositeDataSet* compositeOutput);
00170 
00171   vtkDataObject* ExecuteSimpleAlgorithmForBlock(
00172     vtkInformationVector** inInfoVec,
00173     vtkInformationVector* outInfoVec,
00174     vtkInformation* inInfo,
00175     vtkInformation* outInfo,
00176     vtkInformation* request,
00177     vtkDataObject* dobj);
00178 
00179   bool ShouldIterateOverInput(vtkInformationVector** inInfoVec,
00180                               int& compositePort);
00181 
00182   virtual int InputTypeIsValid(int port, int index,
00183                                 vtkInformationVector **inInfoVec);
00184 
00185   vtkInformation* InformationCache;
00186 
00187   vtkInformation* GenericRequest;
00188   vtkInformation* DataObjectRequest;
00189   vtkInformation* InformationRequest;
00190   vtkInformation* UpdateExtentRequest;
00191   vtkInformation* DataRequest;
00192 
00193 
00194   virtual void ResetPipelineInformation(int port, vtkInformation*);
00195 
00197 
00204   vtkCompositeDataSet* CreateOutputCompositeDataSet(
00205     vtkCompositeDataSet* input, int compositePort);
00207 
00208   // Override this to handle UPDATE_COMPOSITE_INDICES().
00209   virtual void MarkOutputsGenerated(vtkInformation* request,
00210                                     vtkInformationVector** inInfoVec,
00211                                     vtkInformationVector* outInfoVec);
00212 
00213   int NeedToExecuteBasedOnCompositeIndices(vtkInformation* outInfo);
00214 
00215   // Because we sometimes have to swap between "simple" data types and composite
00216   // data types, we sometimes want to skip resetting the pipeline information.
00217   static vtkInformationIntegerKey* SUPPRESS_RESET_PI();
00218 
00219 private:
00220   vtkCompositeDataPipeline(const vtkCompositeDataPipeline&);  // Not implemented.
00221   void operator=(const vtkCompositeDataPipeline&);  // Not implemented.
00222 };
00223 
00224 #endif