00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
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
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
00303
00304
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
00331
00332 static vtkInformationIntegerKey* PORT_REQUIREMENTS_FILLED();
00333
00334
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
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
00402 double Progress;
00403 char *ProgressText;
00404
00405
00406 virtual void ReportReferences(vtkGarbageCollector*);
00407
00408
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&);
00441 void operator=(const vtkAlgorithm&);
00442 };
00443
00444 #endif