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