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
00053
00054
00055 typedef void (*vtkProcessFunctionType)(vtkMultiProcessController *controller,
00056 void *userData);
00057
00058
00059 typedef void (*vtkRMIFunctionType)(void *localArg,
00060 void *remoteArg, int remoteArgLength,
00061 int remoteProcessId);
00062
00063
00064
00065 class VTK_PARALLEL_EXPORT vtkMultiProcessController : public vtkObject
00066 {
00067 public:
00068 vtkTypeRevisionMacro(vtkMultiProcessController,vtkObject);
00069 void PrintSelf(ostream& os, vtkIndent indent);
00070
00074 virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv))=0;
00075
00077
00080 virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv),
00081 int initializedExternally)=0;
00083
00086 virtual void Finalize()=0;
00087
00091 virtual void Finalize(int finalizedExternally)=0;
00092
00094
00097 void SetNumberOfProcesses(int num);
00098 int GetNumberOfProcesses();
00100
00101
00103
00106 void SetSingleMethod(vtkProcessFunctionType, void *data);
00107
00109
00113 virtual void SingleMethodExecute() = 0;
00114
00115
00117
00121 void SetMultipleMethod(int index, vtkProcessFunctionType, void *data);
00122
00124
00128 virtual void MultipleMethodExecute() = 0;
00129
00131 int GetLocalProcessId();
00132
00137 static vtkMultiProcessController *GetGlobalController();
00138
00141 virtual void CreateOutputWindow() = 0;
00142
00144
00154 virtual vtkMultiProcessController *CreateSubController(
00155 vtkProcessGroup *group);
00157
00158
00159
00170 unsigned long AddRMI(vtkRMIFunctionType, void *localArg, int tag);
00171
00173 int RemoveFirstRMI(int tag);
00174
00177 int RemoveRMI(unsigned long id);
00178
00180
00181 void RemoveRMI(vtkRMIFunctionType f, void *arg, int tag)
00182 {f = f; arg = arg; tag = tag; vtkErrorMacro("RemoveRMI Not Implemented Yet");};
00183
00185
00187 void TriggerRMI(int remoteProcessId, void *arg, int argLength, int tag);
00188
00191 void TriggerBreakRMIs();
00192
00194
00195 void TriggerRMI(int remoteProcessId, const char *arg, int tag)
00196 { this->TriggerRMI(remoteProcessId, (void*)arg,
00197 static_cast<int>(strlen(arg))+1, tag); }
00199
00201
00202 void TriggerRMI(int remoteProcessId, int tag)
00203 { this->TriggerRMI(remoteProcessId, NULL, 0, tag); }
00205
00207
00213 void TriggerRMIOnAllChildren(void *arg, int argLength, int tag);
00214 void TriggerRMIOnAllChildren(const char *arg, int tag)
00215 {
00216 this->TriggerRMIOnAllChildren(
00217 (void*)arg, static_cast<int>(strlen(arg))+1, tag);
00218 }
00219 void TriggerRMIOnAllChildren(int tag)
00220 {
00221 this->TriggerRMIOnAllChildren(NULL, 0, tag);
00222 }
00224
00226
00233 int ProcessRMIs(int reportErrors, int dont_loop = 0);
00234 int ProcessRMIs();
00236
00238
00241 vtkSetMacro(BreakFlag, int);
00242 vtkGetMacro(BreakFlag, int);
00244
00246
00248 vtkGetObjectMacro(Communicator, vtkCommunicator);
00250
00252
00253 static int GetBreakRMITag() { return BREAK_RMI_TAG; }
00254 static int GetRMITag() { return RMI_TAG; }
00255 static int GetRMIArgTag() { return RMI_ARG_TAG; }
00257
00258
00259
00260 enum Errors
00261 {
00262 RMI_NO_ERROR,
00263 RMI_TAG_ERROR,
00264 RMI_ARG_ERROR
00265 };
00266
00267 enum Consts
00268 {
00269 MAX_PROCESSES = 8192,
00270 ANY_SOURCE = -1,
00271 INVALID_SOURCE = -2
00272 };
00273
00274 enum Tags
00275 {
00276 RMI_TAG = 1,
00277 RMI_ARG_TAG = 2,
00278 BREAK_RMI_TAG = 3,
00279 XML_WRITER_DATA_INFO = 4
00280 };
00281
00282
00283
00285 void Barrier();
00286
00287 static void SetGlobalController(vtkMultiProcessController *controller);
00288
00289
00290
00292
00294 int Send(const int* data, vtkIdType length, int remoteProcessId, int tag);
00295 int Send(const unsigned int* data, vtkIdType length, int remoteProcessId, int tag);
00296 int Send(const unsigned long* data, vtkIdType length, int remoteProcessId,
00297 int tag);
00298 int Send(const char* data, vtkIdType length, int remoteProcessId, int tag);
00299 int Send(const unsigned char* data, vtkIdType length, int remoteProcessId, int tag);
00300 int Send(const float* data, vtkIdType length, int remoteProcessId, int tag);
00301 int Send(const double* data, vtkIdType length, int remoteProcessId, int tag);
00302 #ifdef VTK_USE_64BIT_IDS
00303 int Send(const vtkIdType* data, vtkIdType length, int remoteProcessId, int tag);
00305 #endif
00306 int Send(vtkDataObject *data, int remoteId, int tag);
00307 int Send(vtkDataArray *data, int remoteId, int tag);
00308
00309
00315 int Send(const vtkMultiProcessStream& stream, int remoteId, int tag);
00316
00317
00319
00327 int Receive(int* data, vtkIdType maxlength, int remoteProcessId, int tag);
00328 int Receive(unsigned int* data, vtkIdType maxlength, int remoteProcessId, int tag);
00329 int Receive(unsigned long* data, vtkIdType maxlength, int remoteProcessId,
00330 int tag);
00331 int Receive(char* data, vtkIdType maxlength, int remoteProcessId, int tag);
00332 int Receive(unsigned char* data, vtkIdType maxlength, int remoteProcessId, int tag);
00333 int Receive(float* data, vtkIdType maxlength, int remoteProcessId, int tag);
00334 int Receive(double* data, vtkIdType maxlength, int remoteProcessId, int tag);
00335 #ifdef VTK_USE_64BIT_IDS
00336 int Receive(vtkIdType* data, vtkIdType maxlength, int remoteProcessId, int tag);
00338 #endif
00339 int Receive(vtkDataObject* data, int remoteId, int tag);
00340 int Receive(vtkDataArray* data, int remoteId, int tag);
00341
00343 int Receive(vtkMultiProcessStream& stream, int remoteId, int tag);
00344
00345 vtkDataObject *ReceiveDataObject(int remoteId, int tag);
00346
00354 vtkIdType GetCount();
00355
00356
00357
00358
00360
00363 int Broadcast(int *data, vtkIdType length, int srcProcessId) {
00364 return this->Communicator->Broadcast(data, length, srcProcessId);
00365 }
00366 int Broadcast(unsigned long *data, vtkIdType length, int srcProcessId) {
00367 return this->Communicator->Broadcast(data, length, srcProcessId);
00368 }
00369 int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) {
00370 return this->Communicator->Broadcast(data, length, srcProcessId);
00371 }
00372 int Broadcast(char *data, vtkIdType length, int srcProcessId) {
00373 return this->Communicator->Broadcast(data, length, srcProcessId);
00374 }
00375 int Broadcast(float *data, vtkIdType length, int srcProcessId) {
00376 return this->Communicator->Broadcast(data, length, srcProcessId);
00377 }
00378 int Broadcast(double *data, vtkIdType length, int srcProcessId) {
00379 return this->Communicator->Broadcast(data, length, srcProcessId);
00380 }
00381 #ifdef VTK_USE_64BIT_IDS
00382 int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) {
00383 return this->Communicator->Broadcast(data, length, srcProcessId);
00384 }
00386 #endif
00387 int Broadcast(vtkDataObject *data, int srcProcessId) {
00388 return this->Communicator->Broadcast(data, srcProcessId);
00389 }
00390 int Broadcast(vtkDataArray *data, int srcProcessId) {
00391 return this->Communicator->Broadcast(data, srcProcessId);
00392 }
00393
00394 int Broadcast(vtkMultiProcessStream& stream, int srcProcessId) {
00395 return this->Communicator->Broadcast(stream, srcProcessId);
00396 }
00397
00398
00400
00408 int Gather(const int *sendBuffer, int *recvBuffer,
00409 vtkIdType length, int destProcessId) {
00410 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00411 destProcessId);
00412 }
00413 int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00414 vtkIdType length, int destProcessId) {
00415 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00416 destProcessId);
00417 }
00418 int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00419 vtkIdType length, int destProcessId) {
00420 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00421 destProcessId);
00422 }
00423 int Gather(const char *sendBuffer, char *recvBuffer,
00424 vtkIdType length, int destProcessId) {
00425 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00426 destProcessId);
00427 }
00428 int Gather(const float *sendBuffer, float *recvBuffer,
00429 vtkIdType length, int destProcessId) {
00430 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00431 destProcessId);
00432 }
00433 int Gather(const double *sendBuffer, double *recvBuffer,
00434 vtkIdType length, int destProcessId) {
00435 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00436 destProcessId);
00437 }
00438 #ifdef VTK_USE_64BIT_IDS
00439 int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00440 vtkIdType length, int destProcessId) {
00441 return this->Communicator->Gather(sendBuffer, recvBuffer, length,
00442 destProcessId);
00443 }
00445 #endif
00446 int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00447 int destProcessId) {
00448 return this->Communicator->Gather(sendBuffer, recvBuffer, destProcessId);
00449 }
00450
00452
00462 int GatherV(const int* sendBuffer, int* recvBuffer,
00463 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00464 int destProcessId) {
00465 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00466 sendLength, recvLengths,
00467 offsets, destProcessId);
00468 }
00469 int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00470 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00471 int destProcessId) {
00472 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00473 sendLength, recvLengths,
00474 offsets, destProcessId);
00475 }
00476 int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00477 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00478 int destProcessId) {
00479 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00480 sendLength, recvLengths,
00481 offsets, destProcessId);
00482 }
00483 int GatherV(const char* sendBuffer, char* recvBuffer,
00484 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00485 int destProcessId) {
00486 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00487 sendLength, recvLengths,
00488 offsets, destProcessId);
00489 }
00490 int GatherV(const float* sendBuffer, float* recvBuffer,
00491 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00492 int destProcessId) {
00493 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00494 sendLength, recvLengths,
00495 offsets, destProcessId);
00496 }
00497 int GatherV(const double* sendBuffer, double* recvBuffer,
00498 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00499 int destProcessId) {
00500 return this->Communicator->GatherV(sendBuffer, recvBuffer,
00501 sendLength, recvLengths,
00502 offsets, destProcessId);
00503 }
00504 #ifdef VTK_USE_64BIT_IDS
00505 int GatherV(const vtkIdType* sendBuffer, vtkIdType* 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 }
00513 #endif
00514
00516
00521 int Scatter(const int *sendBuffer, int *recvBuffer,
00522 vtkIdType length, int srcProcessId) {
00523 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00524 srcProcessId);
00525 }
00526 int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00527 vtkIdType length, int srcProcessId) {
00528 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00529 srcProcessId);
00530 }
00531 int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00532 vtkIdType length, int srcProcessId) {
00533 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00534 srcProcessId);
00535 }
00536 int Scatter(const char *sendBuffer, char *recvBuffer,
00537 vtkIdType length, int srcProcessId) {
00538 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00539 srcProcessId);
00540 }
00541 int Scatter(const float *sendBuffer, float *recvBuffer,
00542 vtkIdType length, int srcProcessId) {
00543 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00544 srcProcessId);
00545 }
00546 int Scatter(const double *sendBuffer, double *recvBuffer,
00547 vtkIdType length, int srcProcessId) {
00548 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00549 srcProcessId);
00550 }
00551 #ifdef VTK_USE_64BIT_IDS
00552 int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00553 vtkIdType length, int srcProcessId) {
00554 return this->Communicator->Scatter(sendBuffer, recvBuffer, length,
00555 srcProcessId);
00556 }
00558 #endif
00559 int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00560 int srcProcessId) {
00561 return this->Communicator->Scatter(sendBuffer, recvBuffer, srcProcessId);
00562 }
00563
00565
00571 int ScatterV(const int *sendBuffer, int *recvBuffer,
00572 vtkIdType *sendLengths, vtkIdType *offsets,
00573 vtkIdType recvLength, int srcProcessId) {
00574 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00575 sendLengths, offsets, recvLength,
00576 srcProcessId);
00577 }
00578 int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00579 vtkIdType *sendLengths, vtkIdType *offsets,
00580 vtkIdType recvLength, int srcProcessId) {
00581 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00582 sendLengths, offsets, recvLength,
00583 srcProcessId);
00584 }
00585 int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00586 vtkIdType *sendLengths, vtkIdType *offsets,
00587 vtkIdType recvLength, int srcProcessId) {
00588 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00589 sendLengths, offsets, recvLength,
00590 srcProcessId);
00591 }
00592 int ScatterV(const char *sendBuffer, char *recvBuffer,
00593 vtkIdType *sendLengths, vtkIdType *offsets,
00594 vtkIdType recvLength, int srcProcessId) {
00595 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00596 sendLengths, offsets, recvLength,
00597 srcProcessId);
00598 }
00599 int ScatterV(const float *sendBuffer, float *recvBuffer,
00600 vtkIdType *sendLengths, vtkIdType *offsets,
00601 vtkIdType recvLength, int srcProcessId) {
00602 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00603 sendLengths, offsets, recvLength,
00604 srcProcessId);
00605 }
00606 int ScatterV(const double *sendBuffer, double *recvBuffer,
00607 vtkIdType *sendLengths, vtkIdType *offsets,
00608 vtkIdType recvLength, int srcProcessId) {
00609 return this->Communicator->ScatterV(sendBuffer, recvBuffer,
00610 sendLengths, offsets, recvLength,
00611 srcProcessId);
00612 }
00613 #ifdef VTK_USE_64BIT_IDS
00614 int ScatterV(const vtkIdType *sendBuffer, vtkIdType *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 }
00622 #endif
00623
00625
00626 int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) {
00627 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00628 }
00629 int AllGather(const unsigned long *sendBuffer,
00630 unsigned long *recvBuffer, vtkIdType length) {
00631 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00632 }
00633 int AllGather(const unsigned char *sendBuffer,
00634 unsigned char *recvBuffer, vtkIdType length) {
00635 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00636 }
00637 int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) {
00638 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00639 }
00640 int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) {
00641 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00642 }
00643 int AllGather(const double *sendBuffer,
00644 double *recvBuffer, vtkIdType length) {
00645 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00646 }
00647 #ifdef VTK_USE_64BIT_IDS
00648 int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00649 vtkIdType length) {
00650 return this->Communicator->AllGather(sendBuffer, recvBuffer, length);
00651 }
00653 #endif
00654 int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer) {
00655 return this->Communicator->AllGather(sendBuffer, recvBuffer);
00656 }
00657
00659
00660 int AllGatherV(const int* sendBuffer, int* recvBuffer,
00661 vtkIdType sendLength, vtkIdType* recvLengths,
00662 vtkIdType* offsets) {
00663 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00664 sendLength, recvLengths,
00665 offsets);
00666 }
00667 int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00668 vtkIdType sendLength, vtkIdType* recvLengths,
00669 vtkIdType* offsets) {
00670 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00671 sendLength, recvLengths,
00672 offsets);
00673 }
00674 int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00675 vtkIdType sendLength, vtkIdType* recvLengths,
00676 vtkIdType* offsets) {
00677 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00678 sendLength, recvLengths,
00679 offsets);
00680 }
00681 int AllGatherV(const char* sendBuffer, char* recvBuffer,
00682 vtkIdType sendLength, vtkIdType* recvLengths,
00683 vtkIdType* offsets) {
00684 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00685 sendLength, recvLengths,
00686 offsets);
00687 }
00688 int AllGatherV(const float* sendBuffer, float* recvBuffer,
00689 vtkIdType sendLength, vtkIdType* recvLengths,
00690 vtkIdType* offsets) {
00691 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00692 sendLength, recvLengths,
00693 offsets);
00694 }
00695 int AllGatherV(const double* sendBuffer, double* recvBuffer,
00696 vtkIdType sendLength, vtkIdType* recvLengths,
00697 vtkIdType* offsets) {
00698 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00699 sendLength, recvLengths,
00700 offsets);
00701 }
00702 #ifdef VTK_USE_64BIT_IDS
00703 int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
00704 vtkIdType sendLength, vtkIdType* recvLengths,
00705 vtkIdType* offsets) {
00706 return this->Communicator->AllGatherV(sendBuffer, recvBuffer,
00707 sendLength, recvLengths,
00708 offsets);
00709 }
00711 #endif
00712
00714
00717 int Reduce(const int *sendBuffer, int *recvBuffer,
00718 vtkIdType length, int operation, int destProcessId) {
00719 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00720 operation, destProcessId);
00721 }
00722 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00723 vtkIdType length, int operation, int destProcessId) {
00724 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00725 operation, destProcessId);
00726 }
00727 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00728 vtkIdType length, int operation, int destProcessId) {
00729 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00730 operation, destProcessId);
00731 }
00732 int Reduce(const char *sendBuffer, char *recvBuffer,
00733 vtkIdType length, int operation, int destProcessId) {
00734 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00735 operation, destProcessId);
00736 }
00737 int Reduce(const float *sendBuffer, float *recvBuffer,
00738 vtkIdType length, int operation, int destProcessId) {
00739 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00740 operation, destProcessId);
00741 }
00742 int Reduce(const double *sendBuffer, double *recvBuffer,
00743 vtkIdType length, int operation, int destProcessId) {
00744 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00745 operation, destProcessId);
00746 }
00747 #ifdef VTK_USE_64BIT_IDS
00748 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00749 vtkIdType length, int operation, int destProcessId) {
00750 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00751 operation, destProcessId);
00752 }
00754 #endif
00755 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00756 int operation, int destProcessId) {
00757 return this->Communicator->Reduce(sendBuffer, recvBuffer,
00758 operation, destProcessId);
00759 }
00760
00761
00763
00766 int Reduce(const int *sendBuffer, int *recvBuffer,
00767 vtkIdType length, vtkCommunicator::Operation *operation,
00768 int destProcessId) {
00769 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00770 operation, destProcessId);
00771 }
00772 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00773 vtkIdType length, vtkCommunicator::Operation *operation,
00774 int destProcessId) {
00775 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00776 operation, destProcessId);
00777 }
00778 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00779 vtkIdType length, vtkCommunicator::Operation *operation,
00780 int destProcessId) {
00781 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00782 operation, destProcessId);
00783 }
00784 int Reduce(const char *sendBuffer, char *recvBuffer,
00785 vtkIdType length, vtkCommunicator::Operation *operation,
00786 int destProcessId) {
00787 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00788 operation, destProcessId);
00789 }
00790 int Reduce(const float *sendBuffer, float *recvBuffer,
00791 vtkIdType length, vtkCommunicator::Operation *operation,
00792 int destProcessId) {
00793 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00794 operation, destProcessId);
00795 }
00796 int Reduce(const double *sendBuffer, double *recvBuffer,
00797 vtkIdType length, vtkCommunicator::Operation *operation,
00798 int destProcessId) {
00799 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00800 operation, destProcessId);
00801 }
00802 #ifdef VTK_USE_64BIT_IDS
00803 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00804 vtkIdType length, vtkCommunicator::Operation *operation,
00805 int destProcessId) {
00806 return this->Communicator->Reduce(sendBuffer, recvBuffer, length,
00807 operation, destProcessId);
00808 }
00810 #endif
00811 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00812 vtkCommunicator::Operation *operation, int destProcessId) {
00813 return this->Communicator->Reduce(sendBuffer, recvBuffer,
00814 operation, destProcessId);
00815 }
00816
00817
00819
00821 int AllReduce(const int *sendBuffer, int *recvBuffer,
00822 vtkIdType length, int operation) {
00823 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00824 operation);
00825 }
00826 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00827 vtkIdType length, int operation) {
00828 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00829 operation);
00830 }
00831 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00832 vtkIdType length, int operation) {
00833 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00834 operation);
00835 }
00836 int AllReduce(const char *sendBuffer, char *recvBuffer,
00837 vtkIdType length, int operation) {
00838 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00839 operation);
00840 }
00841 int AllReduce(const float *sendBuffer, float *recvBuffer,
00842 vtkIdType length, int operation) {
00843 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00844 operation);
00845 }
00846 int AllReduce(const double *sendBuffer, double *recvBuffer,
00847 vtkIdType length, int operation) {
00848 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00849 operation);
00850 }
00851 #ifdef VTK_USE_64BIT_IDS
00852 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00853 vtkIdType length, int operation) {
00854 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00855 operation);
00856 }
00858 #endif
00859 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00860 int operation) {
00861 return this->Communicator->AllReduce(sendBuffer, recvBuffer, operation);
00862 }
00863
00864 int AllReduce(const int *sendBuffer, int *recvBuffer,
00865 vtkIdType length, vtkCommunicator::Operation *operation) {
00866 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00867 operation);
00868 }
00869 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00870 vtkIdType length, vtkCommunicator::Operation *operation) {
00871 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00872 operation);
00873 }
00874 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00875 vtkIdType length, vtkCommunicator::Operation *operation) {
00876 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00877 operation);
00878 }
00879 int AllReduce(const char *sendBuffer, char *recvBuffer,
00880 vtkIdType length, vtkCommunicator::Operation *operation) {
00881 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00882 operation);
00883 }
00884 int AllReduce(const float *sendBuffer, float *recvBuffer,
00885 vtkIdType length, vtkCommunicator::Operation *operation) {
00886 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00887 operation);
00888 }
00889 int AllReduce(const double *sendBuffer, double *recvBuffer,
00890 vtkIdType length, vtkCommunicator::Operation *operation) {
00891 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00892 operation);
00893 }
00894 #ifdef VTK_USE_64BIT_IDS
00895 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00896 vtkIdType length, vtkCommunicator::Operation *operation) {
00897 return this->Communicator->AllReduce(sendBuffer, recvBuffer, length,
00898 operation);
00899 }
00900 #endif
00901 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00902 vtkCommunicator::Operation *operation) {
00903 return this->Communicator->AllReduce(sendBuffer, recvBuffer, operation);
00904 }
00905
00906
00907
00908
00909 protected:
00910 vtkMultiProcessController();
00911 ~vtkMultiProcessController();
00912
00914
00917 virtual void TriggerRMIInternal(int remoteProcessId,
00918 void* arg, int argLength, int rmiTag, bool propagate);
00920
00921 vtkProcessFunctionType SingleMethod;
00922 void *SingleData;
00923 vtkProcessFunctionType MultipleMethod[MAX_PROCESSES];
00924 void *MultipleData[MAX_PROCESSES];
00925
00926 vtkCollection *RMIs;
00927
00928
00929
00930 int BreakFlag;
00931
00932 void ProcessRMI(int remoteProcessId, void *arg, int argLength, int rmiTag);
00933
00934
00935
00936 virtual vtkMultiProcessController *GetLocalController();
00937
00938
00939
00940 int ForceDeepCopy;
00941
00942 vtkOutputWindow* OutputWindow;
00943
00944
00945
00946
00947 vtkCommunicator* Communicator;
00948
00949
00950
00951
00952
00953
00954
00955
00956 vtkCommunicator* RMICommunicator;
00957
00958 private:
00959 vtkMultiProcessController(const vtkMultiProcessController&);
00960 void operator=(const vtkMultiProcessController&);
00961
00962 unsigned long RMICount;
00963 };
00964
00965
00966 inline int vtkMultiProcessController::Send(vtkDataObject *data,
00967 int remoteProcessId, int tag)
00968 {
00969 if (this->Communicator)
00970 {
00971 return this->Communicator->Send(data, remoteProcessId, tag);
00972 }
00973 else
00974 {
00975 return 0;
00976 }
00977 }
00978
00979 inline int vtkMultiProcessController::Send(vtkDataArray *data,
00980 int remoteProcessId, int tag)
00981 {
00982 if (this->Communicator)
00983 {
00984 return this->Communicator->Send(data, remoteProcessId, tag);
00985 }
00986 else
00987 {
00988 return 0;
00989 }
00990 }
00991
00992 inline int vtkMultiProcessController::Send(const int* data, vtkIdType length,
00993 int remoteProcessId, int tag)
00994 {
00995 if (this->Communicator)
00996 {
00997 return this->Communicator->Send(data, length, remoteProcessId, tag);
00998 }
00999 else
01000 {
01001 return 0;
01002 }
01003 }
01004
01005 inline int vtkMultiProcessController::Send(const unsigned int* data, vtkIdType length,
01006 int remoteProcessId, int tag)
01007 {
01008 if (this->Communicator)
01009 {
01010 return this->Communicator->Send(data, length, remoteProcessId, tag);
01011 }
01012 else
01013 {
01014 return 0;
01015 }
01016 }
01017
01018 inline int vtkMultiProcessController::Send(const unsigned long* data,
01019 vtkIdType length,
01020 int remoteProcessId,
01021 int tag)
01022 {
01023 if (this->Communicator)
01024 {
01025 return this->Communicator->Send(data, length, remoteProcessId, tag);
01026 }
01027 else
01028 {
01029 return 0;
01030 }
01031 }
01032
01033 inline int vtkMultiProcessController::Send(const char* data, vtkIdType length,
01034 int remoteProcessId, int tag)
01035 {
01036 if (this->Communicator)
01037 {
01038 return this->Communicator->Send(data, length, remoteProcessId, tag);
01039 }
01040 else
01041 {
01042 return 0;
01043 }
01044 }
01045
01046 inline int vtkMultiProcessController::Send(const unsigned char* data,
01047 vtkIdType length,
01048 int remoteProcessId, 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 float* 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 double* data, vtkIdType length,
01074 int remoteProcessId, int tag)
01075 {
01076 if (this->Communicator)
01077 {
01078 return this->Communicator->Send(data, length, remoteProcessId, tag);
01079 }
01080 else
01081 {
01082 return 0;
01083 }
01084 }
01085
01086 #ifdef VTK_USE_64BIT_IDS
01087 inline int vtkMultiProcessController::Send(const vtkIdType* data,
01088 vtkIdType length,
01089 int remoteProcessId, int tag)
01090 {
01091 if (this->Communicator)
01092 {
01093 return this->Communicator->Send(data, length, remoteProcessId, tag);
01094 }
01095 else
01096 {
01097 return 0;
01098 }
01099 }
01100 #endif
01101
01102 inline int vtkMultiProcessController::Send(const vtkMultiProcessStream& stream,
01103 int remoteId, int tag)
01104 {
01105 if (this->Communicator)
01106 {
01107 return this->Communicator->Send(stream, remoteId, tag);
01108 }
01109 return 0;
01110 }
01111
01112 inline int vtkMultiProcessController::Receive(vtkDataObject* data,
01113 int remoteProcessId, int tag)
01114 {
01115 if (this->Communicator)
01116 {
01117 return this->Communicator->Receive(data, remoteProcessId, tag);
01118 }
01119 else
01120 {
01121 return 0;
01122 }
01123 }
01124
01125 inline vtkDataObject* vtkMultiProcessController::ReceiveDataObject(
01126 int remoteProcessId, int tag)
01127 {
01128 if (this->Communicator)
01129 {
01130 return this->Communicator->ReceiveDataObject(remoteProcessId, tag);
01131 }
01132 else
01133 {
01134 return 0;
01135 }
01136 }
01137
01138 inline int vtkMultiProcessController::Receive(vtkDataArray* data,
01139 int remoteProcessId, int tag)
01140 {
01141 if (this->Communicator)
01142 {
01143 return this->Communicator->Receive(data, remoteProcessId, tag);
01144 }
01145 else
01146 {
01147 return 0;
01148 }
01149 }
01150
01151 inline int vtkMultiProcessController::Receive(int* data, vtkIdType length,
01152 int remoteProcessId, int tag)
01153 {
01154 if (this->Communicator)
01155 {
01156 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01157 }
01158 else
01159 {
01160 return 0;
01161 }
01162 }
01163
01164 inline int vtkMultiProcessController::Receive(unsigned int* data, vtkIdType length,
01165 int remoteProcessId, int tag)
01166 {
01167 if (this->Communicator)
01168 {
01169 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01170 }
01171 else
01172 {
01173 return 0;
01174 }
01175 }
01176
01177 inline int vtkMultiProcessController::Receive(unsigned long* data,
01178 vtkIdType length,
01179 int remoteProcessId,
01180 int tag)
01181 {
01182 if (this->Communicator)
01183 {
01184 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01185 }
01186 else
01187 {
01188 return 0;
01189 }
01190 }
01191
01192 inline int vtkMultiProcessController::Receive(char* data, vtkIdType length,
01193 int remoteProcessId, int tag)
01194 {
01195 if (this->Communicator)
01196 {
01197 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01198 }
01199 else
01200 {
01201 return 0;
01202 }
01203 }
01204
01205 inline int vtkMultiProcessController::Receive(unsigned char* data,
01206 vtkIdType length,
01207 int remoteProcessId, 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(float* 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(double* data, vtkIdType length,
01233 int remoteProcessId, int tag)
01234 {
01235 if (this->Communicator)
01236 {
01237 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01238 }
01239 else
01240 {
01241 return 0;
01242 }
01243 }
01244
01245 #ifdef VTK_USE_64BIT_IDS
01246 inline int vtkMultiProcessController::Receive(vtkIdType* data,
01247 vtkIdType length,
01248 int remoteProcessId, int tag)
01249 {
01250 if (this->Communicator)
01251 {
01252 return this->Communicator->Receive(data, length, remoteProcessId, tag);
01253 }
01254 else
01255 {
01256 return 0;
01257 }
01258 }
01259 #endif
01260
01261
01262 inline int vtkMultiProcessController::Receive(vtkMultiProcessStream& stream,
01263 int remoteId, int tag)
01264 {
01265 if (this->Communicator)
01266 {
01267 return this->Communicator->Receive(stream, remoteId, tag);
01268 }
01269 return 0;
01270 }
01271
01272 inline void vtkMultiProcessController::Barrier()
01273 {
01274 if (this->Communicator)
01275 {
01276 this->Communicator->Barrier();
01277 }
01278 }
01279
01280 inline vtkIdType vtkMultiProcessController::GetCount()
01281 {
01282 if (this->Communicator)
01283 {
01284 return this->Communicator->GetCount();
01285 }
01286 return 0;
01287 }
01288
01289 #endif