00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
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
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
00318
00319
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
00345 protected:
00346 vtkAlgorithm();
00347 ~vtkAlgorithm();
00348
00349
00350
00351 static vtkInformationIntegerKey* PORT_REQUIREMENTS_FILLED();
00352
00353
00354 vtkInformation* Information;
00355
00359 virtual int FillInputPortInformation(int port, vtkInformation* info);
00360
00364 virtual int FillOutputPortInformation(int port, vtkInformation* info);
00365
00367 virtual void SetNumberOfInputPorts(int n);
00368
00370 virtual void SetNumberOfOutputPorts(int n);
00371
00372
00373 int InputPortIndexInRange(int index, const char* action);
00374 int OutputPortIndexInRange(int index, const char* action);
00375
00378 vtkDataArray *GetInputArrayToProcess(int idx,vtkInformationVector **inputVector);
00379
00381
00387 vtkDataArray *GetInputArrayToProcess(int idx,
00388 int connection,
00389 vtkInformationVector **inputVector);
00390 vtkDataArray *GetInputArrayToProcess(int idx,
00391 vtkDataObject* input);
00393
00394
00397 vtkAbstractArray *GetInputAbstractArrayToProcess(int idx,vtkInformationVector **inputVector);
00398
00400
00406 vtkAbstractArray *GetInputAbstractArrayToProcess(int idx,
00407 int connection,
00408 vtkInformationVector **inputVector);
00409 vtkAbstractArray *GetInputAbstractArrayToProcess(int idx,
00410 vtkDataObject* input);
00412
00413
00414
00416
00421 vtkInformation *GetInputArrayFieldInformation(int idx,
00422 vtkInformationVector **inputVector);
00424
00425
00430 virtual vtkExecutive* CreateDefaultExecutive();
00431
00433
00435 vtkSetMacro( ErrorCode, unsigned long );
00436 unsigned long ErrorCode;
00438
00439
00440 double Progress;
00441 char *ProgressText;
00442
00443
00444 virtual void ReportReferences(vtkGarbageCollector*);
00445
00446
00447
00449
00453 virtual void SetNthInputConnection(int port, int index,
00454 vtkAlgorithmOutput* input);
00456
00461 virtual void SetNumberOfInputConnections(int port, int n);
00462
00463 static vtkExecutive* DefaultExecutivePrototype;
00464
00465 private:
00466 vtkExecutive* Executive;
00467 vtkInformationVector* InputPortInformation;
00468 vtkInformationVector* OutputPortInformation;
00469 vtkAlgorithmInternals* AlgorithmInternal;
00470 static void ConnectionAdd(vtkAlgorithm* producer, int producerPort,
00471 vtkAlgorithm* consumer, int consumerPort);
00472 static void ConnectionRemove(vtkAlgorithm* producer, int producerPort,
00473 vtkAlgorithm* consumer, int consumerPort);
00474 static void ConnectionRemoveAllInput(vtkAlgorithm* consumer, int port);
00475 static void ConnectionRemoveAllOutput(vtkAlgorithm* producer, int port);
00476
00477 private:
00478 vtkAlgorithm(const vtkAlgorithm&);
00479 void operator=(const vtkAlgorithm&);
00480 };
00481
00482 #endif