dox/Filtering/vtkAlgorithm.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAlgorithm.h,v $
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 =========================================================================*/
00037 #ifndef __vtkAlgorithm_h
00038 #define __vtkAlgorithm_h
00039 
00040 #include "vtkObject.h"
00041 
00042 class vtkAbstractArray;
00043 class vtkAlgorithmInternals;
00044 class vtkAlgorithmOutput;
00045 class vtkDataArray;
00046 class vtkDataObject;
00047 class vtkExecutive;
00048 class vtkInformation;
00049 class vtkInformationInformationVectorKey;
00050 class vtkInformationIntegerKey;
00051 class vtkInformationStringKey;
00052 class vtkInformationStringVectorKey;
00053 class vtkInformationVector;
00054 
00055 class VTK_FILTERING_EXPORT vtkAlgorithm : public vtkObject
00056 {
00057 public:
00058   static vtkAlgorithm *New();
00059   vtkTypeRevisionMacro(vtkAlgorithm,vtkObject);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00061 
00064   int HasExecutive();
00065 
00068   vtkExecutive* GetExecutive();
00069 
00073   virtual void SetExecutive(vtkExecutive* executive);
00074 
00076 
00090   virtual int ProcessRequest(vtkInformation* request,
00091                              vtkInformationVector** inInfo,
00092                              vtkInformationVector* outInfo);
00094 
00096 
00099   virtual int
00100   ComputePipelineMTime(vtkInformation* request,
00101                        vtkInformationVector** inInfoVec,
00102                        vtkInformationVector* outInfoVec,
00103                        int requestFromOutputPort,
00104                        unsigned long* mtime);
00106 
00112   virtual int ModifyRequest(vtkInformation* request, int when);
00113 
00118   vtkInformation* GetInputPortInformation(int port);
00119 
00124   vtkInformation* GetOutputPortInformation(int port);
00125 
00127 
00128   vtkGetObjectMacro(Information, vtkInformation);
00129   virtual void SetInformation(vtkInformation*);
00131 
00133   int GetNumberOfInputPorts();
00134 
00136   int GetNumberOfOutputPorts();
00137 
00139 
00140   virtual void Register(vtkObjectBase* o);
00141   virtual void UnRegister(vtkObjectBase* o);
00143 
00145 
00147   vtkSetMacro(AbortExecute,int);
00148   vtkGetMacro(AbortExecute,int);
00149   vtkBooleanMacro(AbortExecute,int);
00151 
00153 
00154   vtkSetClampMacro(Progress,double,0.0,1.0);
00155   vtkGetMacro(Progress,double);
00157 
00161   void UpdateProgress(double amount);
00162 
00164 
00169   void SetProgressText(const char* ptext);
00170   vtkGetStringMacro(ProgressText);
00172 
00174 
00176   vtkGetMacro( ErrorCode, unsigned long );
00178 
00179   // left public for performance since it is used in inner loops
00180   int AbortExecute;
00181 
00183 
00184   static vtkInformationIntegerKey* INPUT_IS_OPTIONAL();
00185   static vtkInformationIntegerKey* INPUT_IS_REPEATABLE();
00186   static vtkInformationInformationVectorKey* INPUT_REQUIRED_FIELDS();
00187   static vtkInformationStringVectorKey* INPUT_REQUIRED_DATA_TYPE();
00188   static vtkInformationInformationVectorKey* INPUT_ARRAYS_TO_PROCESS();
00189   static vtkInformationIntegerKey* INPUT_PORT();
00190   static vtkInformationIntegerKey* INPUT_CONNECTION();
00192 
00193   
00195 
00201   void SetInputArrayToProcess(int idx, int port, int connection, 
00202                               int fieldAssociation, 
00203                               const char *name);
00204   void SetInputArrayToProcess(int idx, int port, int connection, 
00205                               int fieldAssociation, 
00206                               int fieldAttributeType);
00207   void SetInputArrayToProcess(int idx, vtkInformation *info);
00209 
00211 
00225   void SetInputArrayToProcess(int idx, int port, int connection, 
00226                               const char* fieldAssociation, 
00227                               const char* attributeTypeorName);
00229 
00231   vtkInformation *GetInputArrayInformation(int idx);
00232   
00233   // from here down are convenience methods that really are executive methods
00234   
00235   
00236   
00238   void RemoveAllInputs();
00239 
00242   vtkDataObject* GetOutputDataObject(int port);
00243   
00245 
00247   vtkDataObject *GetInputDataObject(int port,
00248                                     int connection);
00250   
00252 
00261   virtual void SetInputConnection(int port, vtkAlgorithmOutput* input);
00262   virtual void SetInputConnection(vtkAlgorithmOutput* input);
00264 
00266 
00271   virtual void AddInputConnection(int port, vtkAlgorithmOutput* input);
00272   virtual void AddInputConnection(vtkAlgorithmOutput* input);
00274 
00281   virtual void RemoveInputConnection(int port, vtkAlgorithmOutput* input);
00282 
00284 
00288   vtkAlgorithmOutput* GetOutputPort(int index);
00289   vtkAlgorithmOutput* GetOutputPort() {
00290     return this->GetOutputPort(0); }
00292 
00294   int GetNumberOfInputConnections(int port);
00295 
00297   int GetTotalNumberOfInputConnections();
00298 
00300   vtkAlgorithmOutput* GetInputConnection(int port, int index);
00301 
00303   virtual void Update();
00304 
00307   virtual void UpdateInformation();
00308 
00310   virtual void UpdateWholeExtent();
00311 
00314   void ConvertTotalInputToPortConnection(int ind, int& port, int& conn);
00315 
00316   //======================================================================
00317   //The following block of code is to support old style VTK applications. If
00318   //you are using these calls there are better ways to do it in the new
00319   //pipeline
00320   //======================================================================
00321   
00323 
00324   virtual void SetReleaseDataFlag(int);
00325   virtual int GetReleaseDataFlag();
00326   void ReleaseDataFlagOn();
00327   void ReleaseDataFlagOff();
00329 
00330   //========================================================================
00331   
00333 
00337   int UpdateExtentIsEmpty(vtkDataObject *output);
00338   int UpdateExtentIsEmpty(vtkInformation *pinfo, int extentType);
00340 
00343   static void SetDefaultExecutivePrototype(vtkExecutive* proto);
00344 
00348   virtual double ComputePriority();
00349 
00350 protected:
00351   vtkAlgorithm();
00352   ~vtkAlgorithm();
00353 
00354   // Keys used to indicate that input/output port information has been
00355   // filled.
00356   static vtkInformationIntegerKey* PORT_REQUIREMENTS_FILLED();
00357 
00358   // Arbitrary extra information associated with this algorithm
00359   vtkInformation* Information;
00360 
00364   virtual int FillInputPortInformation(int port, vtkInformation* info);
00365 
00369   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00370 
00372   virtual void SetNumberOfInputPorts(int n);
00373 
00375   virtual void SetNumberOfOutputPorts(int n);
00376 
00377   // Helper methods to check input/output port index ranges.
00378   int InputPortIndexInRange(int index, const char* action);
00379   int OutputPortIndexInRange(int index, const char* action);
00380 
00383   vtkDataArray *GetInputArrayToProcess(int idx,vtkInformationVector **inputVector);
00384 
00386 
00392   vtkDataArray *GetInputArrayToProcess(int idx,
00393                                        int connection,
00394                                        vtkInformationVector **inputVector);
00395   vtkDataArray *GetInputArrayToProcess(int idx, 
00396                                        vtkDataObject* input);
00398 
00399 
00402   vtkAbstractArray *GetInputAbstractArrayToProcess(int idx,vtkInformationVector **inputVector);
00403 
00405 
00411   vtkAbstractArray *GetInputAbstractArrayToProcess(int idx,
00412                                        int connection,
00413                                        vtkInformationVector **inputVector);
00414   vtkAbstractArray *GetInputAbstractArrayToProcess(int idx, 
00415                                        vtkDataObject* input);
00417 
00418 
00419   
00421 
00426   vtkInformation *GetInputArrayFieldInformation(int idx, 
00427                                                 vtkInformationVector **inputVector);
00429   
00430     
00435   virtual vtkExecutive* CreateDefaultExecutive();
00436 
00438 
00440   vtkSetMacro( ErrorCode, unsigned long );
00441   unsigned long ErrorCode;
00443 
00444   // Progress/Update handling
00445   double Progress;
00446   char  *ProgressText;
00447 
00448   // Garbage collection support.
00449   virtual void ReportReferences(vtkGarbageCollector*);
00450 
00451   // executive methods below
00452   
00454 
00458   virtual void SetNthInputConnection(int port, int index,
00459                                      vtkAlgorithmOutput* input);
00461 
00466   virtual void SetNumberOfInputConnections(int port, int n);
00467 
00468   static vtkExecutive* DefaultExecutivePrototype;
00469 
00470 private:
00471   vtkExecutive* Executive;
00472   vtkInformationVector* InputPortInformation;
00473   vtkInformationVector* OutputPortInformation;
00474   vtkAlgorithmInternals* AlgorithmInternal;
00475   static void ConnectionAdd(vtkAlgorithm* producer, int producerPort,
00476                             vtkAlgorithm* consumer, int consumerPort);
00477   static void ConnectionRemove(vtkAlgorithm* producer, int producerPort,
00478                                vtkAlgorithm* consumer, int consumerPort);
00479   static void ConnectionRemoveAllInput(vtkAlgorithm* consumer, int port);
00480   static void ConnectionRemoveAllOutput(vtkAlgorithm* producer, int port);
00481 
00482 private:
00483   vtkAlgorithm(const vtkAlgorithm&);  // Not implemented.
00484   void operator=(const vtkAlgorithm&);  // Not implemented.
00485 };
00486 
00487 #endif

Generated on Mon Oct 6 14:39:29 2008 for VTK by  doxygen 1.4.7