Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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 =========================================================================*/
00034 #ifndef __vtkAlgorithm_h
00035 #define __vtkAlgorithm_h
00036 
00037 #include "vtkObject.h"
00038 
00039 class vtkAlgorithmInternals;
00040 class vtkAlgorithmOutput;
00041 class vtkDataArray;
00042 class vtkDataObject;
00043 class vtkExecutive;
00044 class vtkInformation;
00045 class vtkInformationInformationVectorKey;
00046 class vtkInformationIntegerKey;
00047 class vtkInformationStringKey;
00048 class vtkInformationVector;
00049 
00050 class VTK_FILTERING_EXPORT vtkAlgorithm : public vtkObject
00051 {
00052 public:
00053   static vtkAlgorithm *New();
00054   vtkTypeRevisionMacro(vtkAlgorithm,vtkObject);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056 
00059   int HasExecutive();
00060 
00063   vtkExecutive* GetExecutive();
00064 
00068   virtual void SetExecutive(vtkExecutive* executive);
00069 
00071 
00085   virtual int ProcessRequest(vtkInformation* request,
00086                              vtkInformationVector** inInfo,
00087                              vtkInformationVector* outInfo);
00089 
00091 
00094   virtual int
00095   ComputePipelineMTime(vtkInformation* request,
00096                        vtkInformationVector** inInfoVec,
00097                        vtkInformationVector* outInfoVec,
00098                        int requestFromOutputPort,
00099                        unsigned long* mtime);
00101 
00107   virtual int ModifyRequest(vtkInformation* request, int when);
00108 
00113   vtkInformation* GetInputPortInformation(int port);
00114 
00119   vtkInformation* GetOutputPortInformation(int port);
00120 
00122 
00123   vtkGetObjectMacro(Information, vtkInformation);
00124   virtual void SetInformation(vtkInformation*);
00126 
00128   int GetNumberOfInputPorts();
00129 
00131   int GetNumberOfOutputPorts();
00132 
00134 
00135   virtual void Register(vtkObjectBase* o);
00136   virtual void UnRegister(vtkObjectBase* o);
00138 
00140 
00142   vtkSetMacro(AbortExecute,int);
00143   vtkGetMacro(AbortExecute,int);
00144   vtkBooleanMacro(AbortExecute,int);
00146 
00148 
00149   vtkSetClampMacro(Progress,double,0.0,1.0);
00150   vtkGetMacro(Progress,double);
00152 
00156   void UpdateProgress(double amount);
00157 
00159 
00161   vtkSetStringMacro(ProgressText);
00162   vtkGetStringMacro(ProgressText);
00164 
00166 
00168   vtkGetMacro( ErrorCode, unsigned long );
00170 
00171   // left public for performance since it is used in inner loops
00172   int AbortExecute;
00173 
00175 
00176   static vtkInformationIntegerKey* INPUT_IS_OPTIONAL();
00177   static vtkInformationIntegerKey* INPUT_IS_REPEATABLE();
00178   static vtkInformationInformationVectorKey* INPUT_REQUIRED_FIELDS();
00179   static vtkInformationStringKey* INPUT_REQUIRED_DATA_TYPE();
00180   static vtkInformationInformationVectorKey* INPUT_ARRAYS_TO_PROCESS();
00181   static vtkInformationIntegerKey* INPUT_PORT();
00182   static vtkInformationIntegerKey* INPUT_CONNECTION();
00184 
00185   
00187 
00193   void SetInputArrayToProcess(int idx, int port, int connection, 
00194                               int fieldAssociation, 
00195                               const char *name);
00196   void SetInputArrayToProcess(int idx, int port, int connection, 
00197                               int fieldAssociation, 
00198                               int fieldAttributeType);
00199   void SetInputArrayToProcess(int idx, vtkInformation *info);
00201 
00203 
00217   void SetInputArrayToProcess(int idx, int port, int connection, 
00218                               const char* fieldAssociation, 
00219                               const char* attributeTypeorName);
00221 
00223   vtkInformation *GetInputArrayInformation(int idx);
00224   
00225   // from here down are convenience methods that really are executive methods
00226   
00227   
00228   
00230   void RemoveAllInputs();
00231 
00234   vtkDataObject* GetOutputDataObject(int port);
00235 
00237 
00246   virtual void SetInputConnection(int port, vtkAlgorithmOutput* input);
00247   virtual void SetInputConnection(vtkAlgorithmOutput* input);
00249 
00251 
00256   virtual void AddInputConnection(int port, vtkAlgorithmOutput* input);
00257   virtual void AddInputConnection(vtkAlgorithmOutput* input);
00259 
00266   virtual void RemoveInputConnection(int port, vtkAlgorithmOutput* input);
00267 
00269 
00273   vtkAlgorithmOutput* GetOutputPort(int index);
00274   vtkAlgorithmOutput* GetOutputPort() {
00275     return this->GetOutputPort(0); }
00277 
00279   int GetNumberOfInputConnections(int port);
00280 
00282   int GetTotalNumberOfInputConnections();
00283 
00285   vtkAlgorithmOutput* GetInputConnection(int port, int index);
00286 
00288   virtual void Update();
00289 
00292   virtual void UpdateInformation();
00293 
00295   virtual void UpdateWholeExtent();
00296 
00299   void ConvertTotalInputToPortConnection(int ind, int& port, int& conn);
00300 
00301   //======================================================================
00302   //The following block of code is to support old style VTK applications. If
00303   //you are using these calls there are better ways to do it in the new
00304   //pipeline
00305   //======================================================================
00306   
00308 
00309   virtual void SetReleaseDataFlag(int);
00310   virtual int GetReleaseDataFlag();
00311   void ReleaseDataFlagOn();
00312   void ReleaseDataFlagOff();
00314 
00315   //========================================================================
00316   
00318 
00322   int UpdateExtentIsEmpty(vtkDataObject *output);
00323   int UpdateExtentIsEmpty(vtkInformation *pinfo, int extentType);
00325 
00326 protected:
00327   vtkAlgorithm();
00328   ~vtkAlgorithm();
00329 
00330   // Keys used to indicate that input/output port information has been
00331   // filled.
00332   static vtkInformationIntegerKey* PORT_REQUIREMENTS_FILLED();
00333 
00334   // Arbitrary extra information associated with this algorithm
00335   vtkInformation* Information;
00336 
00340   virtual int FillInputPortInformation(int port, vtkInformation* info);
00341 
00345   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00346 
00348   virtual void SetNumberOfInputPorts(int n);
00349 
00351   virtual void SetNumberOfOutputPorts(int n);
00352 
00353   // Helper methods to check input/output port index ranges.
00354   int InputPortIndexInRange(int index, const char* action);
00355   int OutputPortIndexInRange(int index, const char* action);
00356 
00359   vtkDataArray *GetInputArrayToProcess(int idx,vtkInformationVector **inputVector);
00360 
00362 
00368   vtkDataArray *GetInputArrayToProcess(int idx,
00369                                        int connection,
00370                                        vtkInformationVector **inputVector);
00372 
00374 
00379   vtkInformation *GetInputArrayFieldInformation(int idx, 
00380                                                 vtkInformationVector **inputVector);
00382   
00383     
00386   static void SetDefaultExecutivePrototype(vtkExecutive* proto);
00387 
00392   virtual vtkExecutive* CreateDefaultExecutive();
00393 
00395 
00397   vtkSetMacro( ErrorCode, unsigned long );
00398   unsigned long ErrorCode;
00400 
00401   // Progress/Update handling
00402   double Progress;
00403   char  *ProgressText;
00404 
00405   // Garbage collection support.
00406   virtual void ReportReferences(vtkGarbageCollector*);
00407 
00408   // executive methods below
00409   
00411 
00415   virtual void SetNthInputConnection(int port, int index,
00416                                      vtkAlgorithmOutput* input);
00418 
00423   virtual void SetNumberOfInputConnections(int port, int n);
00424 
00425   static vtkExecutive* DefaultExecutivePrototype;
00426 
00427 private:
00428   vtkExecutive* Executive;
00429   vtkInformationVector* InputPortInformation;
00430   vtkInformationVector* OutputPortInformation;
00431   vtkAlgorithmInternals* AlgorithmInternal;
00432   static void ConnectionAdd(vtkAlgorithm* producer, int producerPort,
00433                             vtkAlgorithm* consumer, int consumerPort);
00434   static void ConnectionRemove(vtkAlgorithm* producer, int producerPort,
00435                                vtkAlgorithm* consumer, int consumerPort);
00436   static void ConnectionRemoveAllInput(vtkAlgorithm* consumer, int port);
00437   static void ConnectionRemoveAllOutput(vtkAlgorithm* producer, int port);
00438 
00439 private:
00440   vtkAlgorithm(const vtkAlgorithm&);  // Not implemented.
00441   void operator=(const vtkAlgorithm&);  // Not implemented.
00442 };
00443 
00444 #endif

Generated on Mon Jan 21 23:07:18 2008 for VTK by  doxygen 1.4.3-20050530