00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00037 #ifndef __vtkMultiProcessController_h
00038 #define __vtkMultiProcessController_h
00039
00040 #include "vtkObject.h"
00041
00042 #include "vtkCommunicator.h"
00043
00044 class vtkCollection;
00045 class vtkDataObject;
00046 class vtkDataSet;
00047 class vtkImageData;
00048 class vtkMultiProcessController;
00049 class vtkMultiProcessStream;
00050 class vtkOutputWindow;
00051 class vtkProcessGroup;
00052 class vtkProcess;
00053
00054
00055
00056 typedef void (*vtkProcessFunctionType)(vtkMultiProcessController *controller,
00057 void *userData);
00058
00059
00060 typedef void (*vtkRMIFunctionType)(void *localArg,
00061 void *remoteArg, int remoteArgLength,
00062 int remoteProcessId);
00063
00064
00065
00066 class VTK_PARALLEL_EXPORT vtkMultiProcessController : public vtkObject
00067 {
00068 public:
00069 vtkTypeRevisionMacro(vtkMultiProcessController,vtkObject);
00070 void PrintSelf(ostream& os, vtkIndent indent);
00071
00075 virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv))=0;
00076
00078
00081 virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv),
00082 int initializedExternally)=0;
00084
00087 virtual void Finalize()=0;
00088
00092 virtual void Finalize(int finalizedExternally)=0;
00093
00095
00098 void SetNumberOfProcesses(int num);
00099 int GetNumberOfProcesses();
00101
00102
00106 void SetSingleMethod(vtkProcessFunctionType, void *data);
00107
00109
00112 void SetSingleProcessObject(vtkProcess *p);
00113
00115
00119 virtual void SingleMethodExecute() = 0;
00120
00121
00123
00127 void SetMultipleMethod(int index, vtkProcessFunctionType, void *data);
00128
00130
00134 virtual void MultipleMethodExecute() = 0;
00135
00137 int GetLocalProcessId();
00138
00143 static vtkMultiProcessController *GetGlobalController();
00144
00147 virtual void CreateOutputWindow() = 0;
00148
00150
00160 virtual vtkMultiProcessController *CreateSubController(
00161 vtkProcessGroup *group);
00163
00165
00174 virtual vtkMultiProcessController *PartitionController(int localColor,
00175 int localKey);
00177
00178
00179
00190 unsigned long AddRMI(vtkRMIFunctionType, void *localArg, int tag);
00191
00193 int RemoveFirstRMI(int tag);
00194
00197 int RemoveRMI(unsigned long id);
00198
00200
00201 void RemoveRMI(vtkRMIFunctionType f, void *arg, int tag)
00202 {f = f; arg = arg; tag = tag; vtkErrorMacro("RemoveRMI Not Implemented Yet");};
00203
00205
00207 void TriggerRMI(int remoteProcessId, void *arg, int argLength, int tag);
00208
00211 void TriggerBreakRMIs();
00212
00214
00215 void TriggerRMI(int remoteProcessId, const char *arg, int tag)
00216 { this->TriggerRMI(remoteProcessId, (void*)arg,
00217 static_cast<int>(strlen(arg))+1, tag); }
00219
00221
00222 void TriggerRMI(int remoteProcessId, int tag)
00223 { this->TriggerRMI(remoteProcessId, NULL, 0, tag); }
00225
00227
00233 void TriggerRMIOnAllChildren(void *arg, int argLength, int tag);
00234 void TriggerRMIOnAllChildren(const char *arg, int tag)
00235 {
00236 this->TriggerRMIOnAllChildren(
00237 (void*)arg, static_cast<int>(strlen(arg))+1, tag);
00238 }
00239 void TriggerRMIOnAllChildren(int tag)
00240 {
00241 this->TriggerRMIOnAllChildren(NULL, 0, tag);
00242 }
00244
00246
00253 int ProcessRMIs(int reportErrors, int dont_loop = 0);
00254 int ProcessRMIs();
00256
00258
00261 vtkSetMacro(BreakFlag, int);
00262 vtkGetMacro(BreakFlag, int);
00264
00266
00268 vtkGetObjectMacro(Communicator, vtkCommunicator);
00270
00272
00273 static int GetBreakRMITag() { return BREAK_RMI_TAG; }
00274 static int GetRMITag() { return RMI_TAG; }
00275 static int GetRMIArgTag() { return RMI_ARG_TAG; }
00277
00278
00279
00280 enum Errors
00281 {
00282 RMI_NO_ERROR,
00283 RMI_TAG_ERROR,
00284 RMI_ARG_ERROR
00285 };
00286
00287 enum Consts
00288 {
00289 ANY_SOURCE = -1,
00290 INVALID_SOURCE = -2
00291 };
00292
00293 enum Tags
00294 {
00295 RMI_TAG = 1,
00296 RMI_ARG_TAG = 2,
00297 BREAK_RMI_TAG = 3,
00298 XML_WRITER_DATA_INFO = 4
00299 };
00300
00301
00302
00304 void Barrier();
00305
00306 static void SetGlobalController(vtkMultiProcessController *controller);
00307
00308
00309
00311
00316 int Send(const int* data, vtkIdType length, int remoteProcessId, int tag);
00317 int Send(const unsigned int* data, vtkIdType length, int remoteProcessId, int tag);
00318 int Send(const unsigned long* data, vtkIdType length, int remoteProcessId,
00319 int tag);
00320 int Send(const char* data, vtkIdType length, int remoteProcessId, int tag);
00321 int Send(const unsigned char* data, vtkIdType length, int remoteProcessId, int tag);
00322 int Send(const float* data, vtkIdType length, int remoteProcessId, int tag);
00323 int Send(const double* data, vtkIdType length, int remoteProcessId, int tag);
00324 #ifdef VTK_USE_64BIT_IDS
00325 int Send(const vtkIdType* data, vtkIdType length, int remoteProcessId, int tag);
00327 #endif
00328 int Send(vtkDataObject *data, int remoteId, int tag);
00329 int Send(vtkDataArray *data, int remoteId, int tag);
00330
00331
00337 int Send(const vtkMultiProcessStream& stream, int remoteId, int tag);
00338
00339
00341
00349 int Receive(int* data, vtkIdType maxlength, int remoteProcessId, int tag);
00350 int Receive(unsigned int* data, vtkIdType maxlength, int remoteProcessId, int tag);
00351 int Receive(unsigned long* data, vtkIdType maxlength, int remoteProcessId,
00352 int tag);
00353 int Receive(char* data, vtkIdType maxlength, int remoteProcessId, int tag);
00354 int Receive(unsigned char* data, vtkIdType maxlength, int remoteProcessId, int tag);
00355 int Receive(float* data, vtkIdType maxlength, int remoteProcessId, int tag);
00356 int Receive(double* data, vtkIdType maxlength, int remoteProcessId, int tag);
00357 #ifdef VTK_USE_64BIT_IDS
00358 int Receive(vtkIdType* data, vtkIdType maxlength, int remoteProcessId, int tag);
00360 #endif
00361 int Receive(vtkDataObject* data, int remoteId, int tag);
00362 int Receive(vtkDataArray* data, int remoteId, int tag);
00363
00365 int Receive(vtkMultiProcessStream& stream, int remoteId, int tag);
00366
00367 vtkDataObject *ReceiveDataObject(int remoteId, int tag);
00368
00376 vtkIdType GetCount();
00377
00378
00379
00380
00382
00385 int Broadcast(int *data, vtkIdType length, int srcProcessId) {
00386 return this->Communicator->Broadcast(data, length, srcProcessId);
00387 }
00388 int Broadcast(unsigned long *data, vtkIdType length, int srcProcessId) {
00389 return this->Communicator->Broadcast(data, length, srcProcessId);
00390 }
00391 int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) {
00392 return this->Communicator->Broadcast(data, length, srcProcessId);
00393 }
00394 int Broadcast(char *data, vtkIdType length, int srcProcessId) {
00395 return this->Communicator->Broadcast(data, length, srcProcessId);
00396 }
00397 int Broadcast(float *data, vtkIdType length, int srcProcessId) {
00398 return this->Communicator->Broadcast(data, length, srcProcessId);
00399 }
00400 int Broadcast(double *data, vtkIdType length, int srcProcessId) {
00401 return this->Communicator->Broadcast(data, length, srcProcessId);
00402 }
00403 #ifdef VTK_USE_64BIT_IDS
00404 int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) {
00405 return this->Communicator->Broadcast(data, length, srcProcessId);
00406 }
00408 #endif
00409 int Broadcast(vtkDataObject *data, int srcProcessId) {
00410 return this->Communicator->Broadcast(data, srcProcessId);
00411 }
00412 int Broadcast(vtkDataArray *data, int srcProcessId) {
00413 return this->Communicator->Broadcast(data, srcProcessId);
00414 }
00415
00416 int Broadcast(vtkMultiProcessStream& stream, int srcProcessId) {
00417 return this->Communicator->Broadcast(stream, srcProcessId);
00418 }
00419
00420
00422
00430 int Gather(const int *sendBuffer, int *recvBuffer,
00431 vtkIdType length, int destProcessId) {
00432 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00433 destProcessId);
00434 }
00435 int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00436 vtkIdType length, int destProcessId) {
00437 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00438 destProcessId);
00439 }
00440 int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00441 vtkIdType length, int destProcessId) {
00442 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00443 destProcessId);
00444 }
00445 int Gather(const char *sendBuffer, char *recvBuffer,
00446 vtkIdType length, int destProcessId) {
00447 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00448 destProcessId);
00449 }
00450 int Gather(const float *sendBuffer, float *recvBuffer,
00451 vtkIdType length, int destProcessId) {
00452 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00453 destProcessId);
00454 }
00455 int Gather(const double *sendBuffer, double *recvBuffer,
00456 vtkIdType length, int destProcessId) {
00457 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00458 destProcessId);
00459 }
00460 #ifdef VTK_USE_64BIT_IDS
00461 int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00462 vtkIdType length, int destProcessId) {
00463 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00464 destProcessId);
00465 }
00467 #endif
00468 int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00469 int destProcessId) {
00470 return this->Communicator->Gather(sendBuffer, recvBuffer, destProcessId);
00471 }
00472
00474
00484 int GatherV(const int* sendBuffer, int* recvBuffer,
00485 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00486 int destProcessId) {
00487 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00488 sendLength, recvLengths,
00489 offsets, destProcessId);
00490 }
00491 int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00492 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00493 int destProcessId) {
00494 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00495 sendLength, recvLengths,
00496 offsets, destProcessId);
00497 }
00498 int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00499 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00500 int destProcessId) {
00501 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00502 sendLength, recvLengths,
00503 offsets, destProcessId);
00504 }
00505 int GatherV(const char* sendBuffer, char* recvBuffer,
00506 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00507 int destProcessId) {
00508 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00509 sendLength, recvLengths,
00510 offsets, destProcessId);
00511 }
00512 int GatherV(const float* sendBuffer, float* recvBuffer,
00513 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00514 int destProcessId) {
00515 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00516 sendLength, recvLengths,
00517 offsets, destProcessId);
00518 }
00519 int GatherV(const double* sendBuffer, double* recvBuffer,
00520 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00521 int destProcessId) {
00522 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00523 sendLength, recvLengths,
00524 offsets, destProcessId);
00525 }
00526 #ifdef VTK_USE_64BIT_IDS
00527 int GatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
00528 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00529 int destProcessId) {
00530 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00531 sendLength, recvLengths,
00532 offsets, destProcessId);
00533 }
00535 #endif
00536
00538
00543 int Scatter(const int *sendBuffer, int *recvBuffer,
00544 vtkIdType length, int srcProcessId) {
00545 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00546 srcProcessId);
00547 }
00548 int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00549 vtkIdType length, int srcProcessId) {
00550 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00551 srcProcessId);
00552 }
00553 int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00554 vtkIdType length, int srcProcessId) {
00555 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00556 srcProcessId);
00557 }
00558 int Scatter(const char *sendBuffer, char *recvBuffer,
00559 vtkIdType length, int srcProcessId) {
00560 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00561 srcProcessId);
00562 }
00563 int Scatter(const float *sendBuffer, float *recvBuffer,
00564 vtkIdType length, int srcProcessId) {
00565 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00566 srcProcessId);
00567 }
00568 int Scatter(const double *sendBuffer, double *recvBuffer,
00569 vtkIdType length, int srcProcessId) {
00570 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00571 srcProcessId);
00572 }
00573 #ifdef VTK_USE_64BIT_IDS
00574 int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00575 vtkIdType length, int srcProcessId) {
00576 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00577 srcProcessId);
00578 }
00580 #endif
00581 int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00582 int srcProcessId) {
00583 return this->Communicator->Scatter(sendBuffer, recvBuffer, srcProcessId);
00584 }
00585
00587
00593 int ScatterV(const int *sendBuffer, int *recvBuffer,
00594 vtkIdType *sendLengths, vtkIdType *offsets,
00595 vtkIdType recvLength, int srcProcessId) {
00596 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00597 sendLengths, offsets, recvLength,
00598 srcProcessId);
00599 }
00600 int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00601 vtkIdType *sendLengths, vtkIdType *offsets,
00602 vtkIdType recvLength, int srcProcessId) {
00603 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00604 sendLengths, offsets, recvLength,
00605 srcProcessId);
00606 }
00607 int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00608 vtkIdType *sendLengths, vtkIdType *offsets,
00609 vtkIdType recvLength, int srcProcessId) {
00610 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00611 sendLengths, offsets, recvLength,
00612 srcProcessId);
00613 }
00614 int ScatterV(const char *sendBuffer, char *recvBuffer,
00615 vtkIdType *sendLengths, vtkIdType *offsets,
00616 vtkIdType recvLength, int srcProcessId) {
00617 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00618 sendLengths, offsets, recvLength,
00619 srcProcessId);
00620 }
00621 int ScatterV(const float *sendBuffer, float *recvBuffer,
00622 vtkIdType *sendLengths, vtkIdType *offsets,
00623 vtkIdType recvLength, int srcProcessId) {
00624 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00625 sendLengths, offsets, recvLength,
00626 srcProcessId);
00627 }
00628 int ScatterV(const double *sendBuffer, double *recvBuffer,
00629 vtkIdType *sendLengths, vtkIdType *offsets,
00630 vtkIdType recvLength, int srcProcessId) {
00631 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00632 sendLengths, offsets, recvLength,
00633 srcProcessId);
00634 }
00635 #ifdef VTK_USE_64BIT_IDS
00636 int ScatterV(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00637 vtkIdType *sendLengths, vtkIdType *offsets,
00638 vtkIdType recvLength, int srcProcessId) {
00639 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00640 sendLengths, offsets, recvLength,
00641 srcProcessId);
00642 }
00644 #endif
00645
00647
00648 int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) {
00649 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00650 }
00651 int AllGather(const unsigned long *sendBuffer,
00652 unsigned long *recvBuffer, vtkIdType length) {
00653 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00654 }
00655 int AllGather(const unsigned char *sendBuffer,
00656 unsigned char *recvBuffer, vtkIdType length) {
00657 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00658 }
00659 int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) {
00660 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00661 }
00662 int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) {
00663 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00664 }
00665 int AllGather(const double *sendBuffer,
00666 double *recvBuffer, vtkIdType length) {
00667 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00668 }
00669 #ifdef VTK_USE_64BIT_IDS
00670 int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00671 vtkIdType length) {
00672 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00673 }
00675 #endif
00676 int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer) {
00677 return this->Communicator->AllGather(sendBuffer, recvBuffer);
00678 }
00679
00681
00682 int AllGatherV(const int* sendBuffer, int* recvBuffer,
00683 vtkIdType sendLength, vtkIdType* recvLengths,
00684 vtkIdType* offsets) {
00685 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00686 sendLength, recvLengths,
00687 offsets);
00688 }
00689 int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00690 vtkIdType sendLength, vtkIdType* recvLengths,
00691 vtkIdType* offsets) {
00692 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00693 sendLength, recvLengths,
00694 offsets);
00695 }
00696 int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00697 vtkIdType sendLength, vtkIdType* recvLengths,
00698 vtkIdType* offsets) {
00699 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00700 sendLength, recvLengths,
00701 offsets);
00702 }
00703 int AllGatherV(const char* sendBuffer, char* recvBuffer,
00704 vtkIdType sendLength, vtkIdType* recvLengths,
00705 vtkIdType* offsets) {
00706 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00707 sendLength, recvLengths,
00708 offsets);
00709 }
00710 int AllGatherV(const float* sendBuffer, float* recvBuffer,
00711 vtkIdType sendLength, vtkIdType* recvLengths,
00712 vtkIdType* offsets) {
00713 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00714 sendLength, recvLengths,
00715 offsets);
00716 }
00717 int AllGatherV(const double* sendBuffer, double* recvBuffer,
00718 vtkIdType sendLength, vtkIdType* recvLengths,
00719 vtkIdType* offsets) {
00720 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00721 sendLength, recvLengths,
00722 offsets);
00723 }
00724 #ifdef VTK_USE_64BIT_IDS
00725 int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
00726 vtkIdType sendLength, vtkIdType* recvLengths,
00727 vtkIdType* offsets) {
00728 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00729 sendLength, recvLengths,
00730 offsets);
00731 }
00733 #endif
00734
00736
00739 int Reduce(const int *sendBuffer, int *recvBuffer,
00740 vtkIdType length, int operation, int destProcessId) {
00741 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00742 operation, destProcessId);
00743 }
00744 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00745 vtkIdType length, int operation, int destProcessId) {
00746 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00747 operation, destProcessId);
00748 }
00749 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00750 vtkIdType length, int operation, int destProcessId) {
00751 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00752 operation, destProcessId);
00753 }
00754 int Reduce(const char *sendBuffer, char *recvBuffer,
00755 vtkIdType length, int operation, int destProcessId) {
00756 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00757 operation, destProcessId);
00758 }
00759 int Reduce(const float *sendBuffer, float *recvBuffer,
00760 vtkIdType length, int operation, int destProcessId) {
00761 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00762 operation, destProcessId);
00763 }
00764 int Reduce(const double *sendBuffer, double *recvBuffer,
00765 vtkIdType length, int operation, int destProcessId) {
00766 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00767 operation, destProcessId);
00768 }
00769 #ifdef VTK_USE_64BIT_IDS
00770 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00771 vtkIdType length, int operation, int destProcessId) {
00772 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00773 operation, destProcessId);
00774 }
00776 #endif
00777 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00778 int operation, int destProcessId) {
00779 return this->Communicator->Reduce(sendBuffer, recvBuffer,
00780 operation, destProcessId);
00781 }
00782
00783
00785
00788 int Reduce(const int *sendBuffer, int *recvBuffer,
00789 vtkIdType length, vtkCommunicator::Operation *operation,
00790 int destProcessId) {
00791 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00792 operation, destProcessId);
00793 }
00794 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00795 vtkIdType length, vtkCommunicator::Operation *operation,
00796 int destProcessId) {
00797 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00798 operation, destProcessId);
00799 }
00800 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00801 vtkIdType length, vtkCommunicator::Operation *operation,
00802 int destProcessId) {
00803 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00804 operation, destProcessId);
00805 }
00806 int Reduce(const char *sendBuffer, char *recvBuffer,
00807 vtkIdType length, vtkCommunicator::Operation *operation,
00808 int destProcessId) {
00809 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00810 operation, destProcessId);
00811 }
00812 int Reduce(const float *sendBuffer, float *recvBuffer,
00813 vtkIdType length, vtkCommunicator::Operation *operation,
00814 int destProcessId) {
00815 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00816 operation, destProcessId);
00817 }
00818 int Reduce(const double *sendBuffer, double *recvBuffer,
00819 vtkIdType length, vtkCommunicator::Operation *operation,
00820 int destProcessId) {
00821 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00822 operation, destProcessId);
00823 }
00824 #ifdef VTK_USE_64BIT_IDS
00825 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00826 vtkIdType length, vtkCommunicator::Operation *operation,
00827 int destProcessId) {
00828 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00829 operation, destProcessId);
00830 }
00832 #endif
00833 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00834 vtkCommunicator::Operation *operation, int destProcessId) {
00835 return this->Communicator->Reduce(sendBuffer, recvBuffer,
00836 operation, destProcessId);
00837 }
00838
00839
00841
00843 int AllReduce(const int *sendBuffer, int *recvBuffer,
00844 vtkIdType length, int operation) {
00845 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00846 operation);
00847 }
00848 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00849 vtkIdType length, int operation) {
00850 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00851 operation);
00852 }
00853 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00854 vtkIdType length, int operation) {
00855 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00856 operation);
00857 }
00858 int AllReduce(const char *sendBuffer, char *recvBuffer,
00859 vtkIdType length, int operation) {
00860 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00861 operation);
00862 }
00863 int AllReduce(const float *sendBuffer, float *recvBuffer,
00864 vtkIdType length, int operation) {
00865 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00866 operation);
00867 }
00868 int AllReduce(const double *sendBuffer, double *recvBuffer,
00869 vtkIdType length, int operation) {
00870 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00871 operation);
00872 }
00873 #ifdef VTK_USE_64BIT_IDS
00874 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00875 vtkIdType length, int operation) {
00876 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00877 operation);
00878 }
00880 #endif
00881 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00882 int operation) {
00883 return this->Communicator->AllReduce(sendBuffer, recvBuffer, operation);
00884 }
00885
00886 int AllReduce(const int *sendBuffer, int *recvBuffer,
00887 vtkIdType length, vtkCommunicator::Operation *operation) {
00888 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00889 operation);
00890 }
00891 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00892 vtkIdType length, vtkCommunicator::Operation *operation) {
00893 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00894 operation);
00895 }
00896 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00897 vtkIdType length, vtkCommunicator::Operation *operation) {
00898 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00899 operation);
00900 }
00901 int AllReduce(const char *sendBuffer, char *recvBuffer,
00902 vtkIdType length, vtkCommunicator::Operation *operation) {
00903 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00904 operation);
00905 }
00906 int AllReduce(const float *sendBuffer, float *recvBuffer,
00907 vtkIdType length, vtkCommunicator::Operation *operation) {
00908 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00909 operation);
00910 }
00911 int AllReduce(const double *sendBuffer, double *recvBuffer,
00912 vtkIdType length, vtkCommunicator::Operation *operation) {
00913 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00914 operation);
00915 }
00916 #ifdef VTK_USE_64BIT_IDS
00917 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00918 vtkIdType length, vtkCommunicator::Operation *operation) {
00919 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00920 operation);
00921 }
00922 #endif
00923 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00924 vtkCommunicator::Operation *operation) {
00925 return this->Communicator->AllReduce(sendBuffer, recvBuffer, operation);
00926 }
00927
00928
00929
00930
00931 protected:
00932 vtkMultiProcessController();
00933 ~vtkMultiProcessController();
00934
00936
00939 virtual void TriggerRMIInternal(int remoteProcessId,
00940 void* arg, int argLength, int rmiTag, bool propagate);
00942
00943 vtkProcessFunctionType SingleMethod;
00944 void *SingleData;
00945
00946 void GetMultipleMethod(int index, vtkProcessFunctionType &func, void *&data);
00947
00948 vtkCollection *RMIs;
00949
00950
00951
00952 int BreakFlag;
00953
00954 void ProcessRMI(int remoteProcessId, void *arg, int argLength, int rmiTag);
00955
00956
00957
00958 virtual vtkMultiProcessController *GetLocalController();
00959
00960
00961
00962 int ForceDeepCopy;
00963
00964 vtkOutputWindow* OutputWindow;
00965
00966
00967
00968
00969 vtkCommunicator* Communicator;
00970
00971
00972
00973
00974
00975
00976
00977
00978 vtkCommunicator* RMICommunicator;
00979
00980 private:
00981 vtkMultiProcessController(const vtkMultiProcessController&);
00982 void operator=(const vtkMultiProcessController&);
00983
00984 unsigned long RMICount;
00985
00986
00987 class vtkInternal;
00988 vtkInternal *Internal;
00989
00990 };
00991
00992
00993 inline int vtkMultiProcessController::Send(vtkDataObject *data,
00994 int remoteProcessId, int tag)
00995 {
00996 if (this->Communicator)
00997 {
00998 return this->Communicator->Send(data, remoteProcessId, tag);
00999 }
01000 else
01001 {
01002 return 0;
01003 }
01004 }
01005
01006 inline int vtkMultiProcessController::Send(vtkDataArray *data,
01007 int remoteProcessId, int tag)
01008 {
01009 if (this->Communicator)
01010 {
01011 return this->Communicator->Send(data, remoteProcessId, tag);
01012 }
01013 else
01014 {
01015 return 0;
01016 }
01017 }
01018
01019 inline int vtkMultiProcessController::Send(const int* data, vtkIdType length,
01020 int remoteProcessId, int tag)
01021 {
01022 if (this->Communicator)
01023 {
01024 return this->Communicator->Send(data, length, remoteProcessId, tag);
01025 }
01026 else
01027 {
01028 return 0;
01029 }
01030 }
01031
01032 inline int vtkMultiProcessController::Send(const unsigned int* data, vtkIdType length,
01033 int remoteProcessId, int tag)
01034 {
01035 if (this->Communicator)
01036 {
01037 return this->Communicator->Send(data, length, remoteProcessId, tag);
01038 }
01039 else
01040 {
01041 return 0;
01042 }
01043 }
01044
01045 inline int vtkMultiProcessController::Send(const unsigned long* data,
01046 vtkIdType length,
01047 int remoteProcessId,
01048 int tag)
01049 {
01050 if (this->Communicator)
01051 {
01052 return this->Communicator->Send(data, length, remoteProcessId, tag);
01053 }
01054 else
01055 {
01056 return 0;
01057 }
01058 }
01059
01060 inline int vtkMultiProcessController::Send(const char* data, vtkIdType length,
01061 int remoteProcessId, int tag)
01062 {
01063 if (this->Communicator)
01064 {
01065 return this->Communicator->Send(data, length, remoteProcessId, tag);
01066 }
01067 else
01068 {
01069 return 0;
01070 }
01071 }
01072
01073 inline int vtkMultiProcessController::Send(const unsigned char* data,
01074 vtkIdType length,
01075 int remoteProcessId, int tag)
01076 {
01077 if (this->Communicator)
01078 {
01079 return this->Communicator->Send(data, length, remoteProcessId, tag);
01080 }
01081 else
01082 {
01083 return 0;
01084 }
01085 }
01086
01087 inline int vtkMultiProcessController::Send(const float* data, vtkIdType length,
01088 int remoteProcessId, int tag)
01089 {
01090 if (this->Communicator)
01091 {
01092 return this->Communicator->Send(data, length, remoteProcessId, tag);
01093 }
01094 else
01095 {
01096 return 0;
01097 }
01098 }
01099
01100 inline int vtkMultiProcessController::Send(const double* data, vtkIdType length,
01101 int remoteProcessId, int tag)
01102 {
01103 if (this->Communicator)
01104 {
01105 return this->Communicator->Send(data, length, remoteProcessId, tag);
01106 }
01107 else
01108 {
01109 return 0;
01110 }
01111 }
01112
01113 #ifdef VTK_USE_64BIT_IDS
01114 inline int vtkMultiProcessController::Send(const vtkIdType* data,
01115 vtkIdType length,
01116 int remoteProcessId, int tag)
01117 {
01118 if (this->Communicator)
01119 {
01120 return this->Communicator->Send(data, length, remoteProcessId, tag);
01121 }
01122 else
01123 {
01124 return 0;
01125 }
01126 }
01127 #endif
01128
01129 inline int vtkMultiProcessController::Send(const vtkMultiProcessStream& stream,
01130 int remoteId, int tag)
01131 {
01132 if (this->Communicator)
01133 {
01134 return this->Communicator->Send(stream, remoteId, tag);
01135 }
01136 return 0;
01137 }
01138
01139 inline int vtkMultiProcessController::Receive(vtkDataObject* data,
01140 int remoteProcessId, int tag)
01141 {
01142 if (this->Communicator)
01143 {
01144 return this->Communicator->Receive(data, remoteProcessId, tag);
01145 }
01146 else
01147 {
01148 return 0;
01149 }
01150 }
01151
01152 inline vtkDataObject* vtkMultiProcessController::ReceiveDataObject(
01153 int remoteProcessId, int tag)
01154 {
01155 if (this->Communicator)
01156 {
01157 return this->Communicator->ReceiveDataObject(remoteProcessId, tag);
01158 }
01159 else
01160 {
01161 return 0;
01162 }
01163 }
01164
01165 inline int vtkMultiProcessController::Receive(vtkDataArray* data,
01166 int remoteProcessId, int tag)
01167 {
01168 if (this->Communicator)
01169 {
01170 return this->Communicator->Receive(data, remoteProcessId, tag);
01171 }
01172 else
01173 {
01174 return 0;
01175 }
01176 }
01177
01178 inline int vtkMultiProcessController::Receive(int* data, vtkIdType length,
01179 int remoteProcessId, int tag)
01180 {
01181 if (this->Communicator)
01182 {
01183 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01184 }
01185 else
01186 {
01187 return 0;
01188 }
01189 }
01190
01191 inline int vtkMultiProcessController::Receive(unsigned int* data, vtkIdType length,
01192 int remoteProcessId, int tag)
01193 {
01194 if (this->Communicator)
01195 {
01196 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01197 }
01198 else
01199 {
01200 return 0;
01201 }
01202 }
01203
01204 inline int vtkMultiProcessController::Receive(unsigned long* data,
01205 vtkIdType length,
01206 int remoteProcessId,
01207 int tag)
01208 {
01209 if (this->Communicator)
01210 {
01211 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01212 }
01213 else
01214 {
01215 return 0;
01216 }
01217 }
01218
01219 inline int vtkMultiProcessController::Receive(char* data, vtkIdType length,
01220 int remoteProcessId, int tag)
01221 {
01222 if (this->Communicator)
01223 {
01224 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01225 }
01226 else
01227 {
01228 return 0;
01229 }
01230 }
01231
01232 inline int vtkMultiProcessController::Receive(unsigned char* data,
01233 vtkIdType length,
01234 int remoteProcessId, int tag)
01235 {
01236 if (this->Communicator)
01237 {
01238 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01239 }
01240 else
01241 {
01242 return 0;
01243 }
01244 }
01245
01246 inline int vtkMultiProcessController::Receive(float* data, vtkIdType length,
01247 int remoteProcessId, int tag)
01248 {
01249 if (this->Communicator)
01250 {
01251 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01252 }
01253 else
01254 {
01255 return 0;
01256 }
01257 }
01258
01259 inline int vtkMultiProcessController::Receive(double* data, vtkIdType length,
01260 int remoteProcessId, int tag)
01261 {
01262 if (this->Communicator)
01263 {
01264 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01265 }
01266 else
01267 {
01268 return 0;
01269 }
01270 }
01271
01272 #ifdef VTK_USE_64BIT_IDS
01273 inline int vtkMultiProcessController::Receive(vtkIdType* data,
01274 vtkIdType length,
01275 int remoteProcessId, int tag)
01276 {
01277 if (this->Communicator)
01278 {
01279 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01280 }
01281 else
01282 {
01283 return 0;
01284 }
01285 }
01286 #endif
01287
01288
01289 inline int vtkMultiProcessController::Receive(vtkMultiProcessStream& stream,
01290 int remoteId, int tag)
01291 {
01292 if (this->Communicator)
01293 {
01294 return this->Communicator->Receive(stream, remoteId, tag);
01295 }
01296 return 0;
01297 }
01298
01299 inline void vtkMultiProcessController::Barrier()
01300 {
01301 if (this->Communicator)
01302 {
01303 this->Communicator->Barrier();
01304 }
01305 }
01306
01307 inline vtkIdType vtkMultiProcessController::GetCount()
01308 {
01309 if (this->Communicator)
01310 {
01311 return this->Communicator->GetCount();
01312 }
01313 return 0;
01314 }
01315
01316 #endif