00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00034 #ifndef __vtkCommunicator_h
00035 #define __vtkCommunicator_h
00036
00037 #include "vtkObject.h"
00038
00039 class vtkBoundingBox;
00040 class vtkCharArray;
00041 class vtkDataArray;
00042 class vtkDataObject;
00043 class vtkDataSet;
00044 class vtkImageData;
00045 class vtkMultiBlockDataSet;
00046 class vtkMultiProcessStream;
00047 class vtkTemporalDataSet;
00048
00049 class VTK_PARALLEL_EXPORT vtkCommunicator : public vtkObject
00050 {
00051
00052 public:
00053
00054 vtkTypeMacro(vtkCommunicator, vtkObject);
00055 void PrintSelf(ostream& os, vtkIndent indent);
00056
00058
00061 virtual void SetNumberOfProcesses(int num);
00062 vtkGetMacro(NumberOfProcesses, int);
00064
00066
00067 vtkGetMacro(LocalProcessId, int);
00069
00070
00071
00072 enum Tags
00073 {
00074 BROADCAST_TAG = 10,
00075 GATHER_TAG = 11,
00076 GATHERV_TAG = 12,
00077 SCATTER_TAG = 13,
00078 SCATTERV_TAG = 14,
00079 REDUCE_TAG = 15,
00080 BARRIER_TAG = 16
00081 };
00082
00083 enum StandardOperations
00084 {
00085 MAX_OP,
00086 MIN_OP,
00087 SUM_OP,
00088 PRODUCT_OP,
00089 LOGICAL_AND_OP,
00090 BITWISE_AND_OP,
00091 LOGICAL_OR_OP,
00092 BITWISE_OR_OP,
00093 LOGICAL_XOR_OP,
00094 BITWISE_XOR_OP
00095 };
00096
00098
00100 class Operation
00101 {
00102 public:
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 virtual void Function(const void *A, void *B, vtkIdType length,
00113 int datatype) = 0;
00115
00118 virtual int Commutative() = 0;
00119
00120 virtual ~Operation() {}
00121 };
00122
00123
00124
00127 int Send(vtkDataObject* data, int remoteHandle, int tag);
00128
00131 int Send(vtkDataArray* data, int remoteHandle, int tag);
00132
00134
00138 virtual int SendVoidArray(const void *data, vtkIdType length, int type,
00139 int remoteHandle, int tag) = 0;
00141
00143
00144 int Send(const int* data, vtkIdType length, int remoteHandle, int tag) {
00145 return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag);
00146 }
00147 int Send(const unsigned int* data, vtkIdType length, int remoteHandle, int tag) {
00148 return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag);
00149 }
00150 int Send(const unsigned long* data, vtkIdType length,
00151 int remoteHandle, int tag) {
00152 return this->SendVoidArray(data, length,VTK_UNSIGNED_LONG,remoteHandle,tag);
00153 }
00154 int Send(const unsigned char* data, vtkIdType length,
00155 int remoteHandle, int tag) {
00156 return this->SendVoidArray(data, length,VTK_UNSIGNED_CHAR,remoteHandle,tag);
00157 }
00158 int Send(const char* data, vtkIdType length, int remoteHandle, int tag) {
00159 return this->SendVoidArray(data, length, VTK_CHAR, remoteHandle, tag);
00160 }
00161 int Send(const float* data, vtkIdType length, int remoteHandle, int tag) {
00162 return this->SendVoidArray(data, length, VTK_FLOAT, remoteHandle, tag);
00163 }
00164 int Send(const double* data, vtkIdType length, int remoteHandle, int tag) {
00165 return this->SendVoidArray(data, length, VTK_DOUBLE, remoteHandle, tag);
00166 }
00167 #ifdef VTK_USE_64BIT_IDS
00168 int Send(const vtkIdType* data, vtkIdType length, int remoteHandle, int tag) {
00169 return this->SendVoidArray(data, length, VTK_ID_TYPE, remoteHandle, tag);
00170 }
00171 #endif
00172
00173 int Send(const vtkMultiProcessStream& stream, int remoteId, int tag);
00174
00176
00177
00180 int Receive(vtkDataObject* data, int remoteHandle, int tag);
00181
00184 vtkDataObject *ReceiveDataObject(int remoteHandle, int tag);
00185
00188 int Receive(vtkDataArray* data, int remoteHandle, int tag);
00189
00191
00199 virtual int ReceiveVoidArray(void *data, vtkIdType maxlength, int type,
00200 int remoteHandle, int tag) = 0;
00202
00204
00205 int Receive(int* data, vtkIdType maxlength, int remoteHandle, int tag) {
00206 return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag);
00207 }
00208 int Receive(unsigned int* data, vtkIdType maxlength, int remoteHandle, int tag) {
00209 return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag);
00210 }
00211 int Receive(unsigned long* data, vtkIdType maxlength, int remoteHandle, int tag){
00212 return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_LONG, remoteHandle,
00213 tag);
00214 }
00215 int Receive(unsigned char* data, vtkIdType maxlength, int remoteHandle, int tag){
00216 return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_CHAR, remoteHandle,
00217 tag);
00218 }
00219 int Receive(char* data, vtkIdType maxlength, int remoteHandle, int tag) {
00220 return this->ReceiveVoidArray(data, maxlength, VTK_CHAR, remoteHandle, tag);
00221 }
00222 int Receive(float* data, vtkIdType maxlength, int remoteHandle, int tag) {
00223 return this->ReceiveVoidArray(data, maxlength, VTK_FLOAT, remoteHandle, tag);
00224 }
00225 int Receive(double* data, vtkIdType maxlength, int remoteHandle, int tag) {
00226 return this->ReceiveVoidArray(data, maxlength, VTK_DOUBLE, remoteHandle, tag);
00227 }
00228 #ifdef VTK_USE_64BIT_IDS
00229 int Receive(vtkIdType* data, vtkIdType maxlength, int remoteHandle, int tag) {
00230 return this->ReceiveVoidArray(data, maxlength, VTK_ID_TYPE, remoteHandle, tag);
00231 }
00232 #endif
00233
00234 int Receive(vtkMultiProcessStream& stream, int remoteId, int tag);
00235
00237
00239
00246 vtkGetMacro(Count, vtkIdType);
00248
00249
00250
00253 virtual void Barrier();
00254
00256
00259 int Broadcast(int *data, vtkIdType length, int srcProcessId) {
00260 return this->BroadcastVoidArray(data, length, VTK_INT, srcProcessId);
00261 }
00262 int Broadcast(unsigned int *data, vtkIdType length, int srcProcessId) {
00263 return this->BroadcastVoidArray(data, length, VTK_UNSIGNED_INT, srcProcessId);
00264 }
00265 int Broadcast(unsigned long *data, vtkIdType length, int srcProcessId) {
00266 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_LONG,srcProcessId);
00267 }
00268 int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) {
00269 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_CHAR,srcProcessId);
00270 }
00271 int Broadcast(char *data, vtkIdType length, int srcProcessId) {
00272 return this->BroadcastVoidArray(data, length, VTK_CHAR, srcProcessId);
00273 }
00274 int Broadcast(float *data, vtkIdType length, int srcProcessId) {
00275 return this->BroadcastVoidArray(data, length, VTK_FLOAT, srcProcessId);
00276 }
00277 int Broadcast(double *data, vtkIdType length, int srcProcessId) {
00278 return this->BroadcastVoidArray(data, length, VTK_DOUBLE, srcProcessId);
00279 }
00280 #ifdef VTK_USE_64BIT_IDS
00281 int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) {
00282 return this->BroadcastVoidArray(data, length, VTK_ID_TYPE, srcProcessId);
00283 }
00284 #endif
00285 int Broadcast(vtkDataObject *data, int srcProcessId);
00286 int Broadcast(vtkDataArray *data, int srcProcessId);
00287
00288 int Broadcast(vtkMultiProcessStream& stream, int srcProcessId);
00289
00291
00293
00301 int Gather(const int *sendBuffer, int *recvBuffer,
00302 vtkIdType length, int destProcessId) {
00303 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00304 VTK_INT, destProcessId);
00305 }
00306 int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00307 vtkIdType length, int destProcessId) {
00308 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00309 VTK_UNSIGNED_LONG, destProcessId);
00310 }
00311 int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00312 vtkIdType length, int destProcessId) {
00313 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00314 VTK_UNSIGNED_CHAR, destProcessId);
00315 }
00316 int Gather(const char *sendBuffer, char *recvBuffer,
00317 vtkIdType length, int destProcessId) {
00318 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00319 VTK_CHAR, destProcessId);
00320 }
00321 int Gather(const float *sendBuffer, float *recvBuffer,
00322 vtkIdType length, int destProcessId) {
00323 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00324 VTK_FLOAT, destProcessId);
00325 }
00326 int Gather(const double *sendBuffer, double *recvBuffer,
00327 vtkIdType length, int destProcessId) {
00328 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00329 VTK_DOUBLE, destProcessId);
00330 }
00331 #ifdef VTK_USE_64BIT_IDS
00332 int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00333 vtkIdType length, int destProcessId) {
00334 return this->GatherVoidArray(sendBuffer, recvBuffer, length,
00335 VTK_ID_TYPE, destProcessId);
00336 }
00337 #endif
00338 int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00339 int destProcessId);
00341
00343
00353 int GatherV(const int* sendBuffer, int* recvBuffer,
00354 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00355 int destProcessId) {
00356 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00357 sendLength, recvLengths,
00358 offsets, VTK_INT, destProcessId);
00359 }
00360 int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00361 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00362 int destProcessId) {
00363 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00364 sendLength, recvLengths,
00365 offsets, VTK_UNSIGNED_LONG, destProcessId);
00366 }
00367 int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00368 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00369 int destProcessId) {
00370 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00371 sendLength, recvLengths,
00372 offsets, VTK_UNSIGNED_CHAR, destProcessId);
00373 }
00374 int GatherV(const char* sendBuffer, char* recvBuffer,
00375 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00376 int destProcessId) {
00377 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00378 sendLength, recvLengths,
00379 offsets, VTK_CHAR, destProcessId);
00380 }
00381 int GatherV(const float* sendBuffer, float* recvBuffer,
00382 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00383 int destProcessId) {
00384 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00385 sendLength, recvLengths,
00386 offsets, VTK_FLOAT, destProcessId);
00387 }
00388 int GatherV(const double* sendBuffer, double* recvBuffer,
00389 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00390 int destProcessId) {
00391 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00392 sendLength, recvLengths,
00393 offsets, VTK_DOUBLE, destProcessId);
00394 }
00395 #ifdef VTK_USE_64BIT_IDS
00396 int GatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
00397 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
00398 int destProcessId) {
00399 return this->GatherVVoidArray(sendBuffer, recvBuffer,
00400 sendLength, recvLengths,
00401 offsets, VTK_ID_TYPE, destProcessId);
00402 }
00403 #endif
00404 int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00405 vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId);
00406 int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00407 int destProcessId);
00409
00411
00416 int Scatter(const int *sendBuffer, int *recvBuffer,
00417 vtkIdType length, int srcProcessId) {
00418 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00419 VTK_INT, srcProcessId);
00420 }
00421 int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00422 vtkIdType length, int srcProcessId) {
00423 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00424 VTK_UNSIGNED_LONG, srcProcessId);
00425 }
00426 int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00427 vtkIdType length, int srcProcessId) {
00428 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00429 VTK_UNSIGNED_CHAR, srcProcessId);
00430 }
00431 int Scatter(const char *sendBuffer, char *recvBuffer,
00432 vtkIdType length, int srcProcessId) {
00433 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00434 VTK_CHAR, srcProcessId);
00435 }
00436 int Scatter(const float *sendBuffer, float *recvBuffer,
00437 vtkIdType length, int srcProcessId) {
00438 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00439 VTK_FLOAT, srcProcessId);
00440 }
00441 int Scatter(const double *sendBuffer, double *recvBuffer,
00442 vtkIdType length, int srcProcessId) {
00443 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00444 VTK_DOUBLE, srcProcessId);
00445 }
00446 #ifdef VTK_USE_64BIT_IDS
00447 int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00448 vtkIdType length, int srcProcessId) {
00449 return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
00450 VTK_ID_TYPE, srcProcessId);
00451 }
00452 #endif
00453 int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00454 int srcProcessId);
00456
00458
00464 int ScatterV(const int *sendBuffer, int *recvBuffer,
00465 vtkIdType *sendLengths, vtkIdType *offsets,
00466 vtkIdType recvLength, int srcProcessId) {
00467 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00468 sendLengths, offsets, recvLength,
00469 VTK_INT, srcProcessId);
00470 }
00471 int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00472 vtkIdType *sendLengths, vtkIdType *offsets,
00473 vtkIdType recvLength, int srcProcessId) {
00474 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00475 sendLengths, offsets, recvLength,
00476 VTK_UNSIGNED_LONG, srcProcessId);
00477 }
00478 int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00479 vtkIdType *sendLengths, vtkIdType *offsets,
00480 vtkIdType recvLength, int srcProcessId) {
00481 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00482 sendLengths, offsets, recvLength,
00483 VTK_UNSIGNED_CHAR, srcProcessId);
00484 }
00485 int ScatterV(const char *sendBuffer, char *recvBuffer,
00486 vtkIdType *sendLengths, vtkIdType *offsets,
00487 vtkIdType recvLength, int srcProcessId) {
00488 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00489 sendLengths, offsets, recvLength,
00490 VTK_CHAR, srcProcessId);
00491 }
00492 int ScatterV(const float *sendBuffer, float *recvBuffer,
00493 vtkIdType *sendLengths, vtkIdType *offsets,
00494 vtkIdType recvLength, int srcProcessId) {
00495 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00496 sendLengths, offsets, recvLength,
00497 VTK_FLOAT, srcProcessId);
00498 }
00499 int ScatterV(const double *sendBuffer, double *recvBuffer,
00500 vtkIdType *sendLengths, vtkIdType *offsets,
00501 vtkIdType recvLength, int srcProcessId) {
00502 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00503 sendLengths, offsets, recvLength,
00504 VTK_DOUBLE, srcProcessId);
00505 }
00506 #ifdef VTK_USE_64BIT_IDS
00507 int ScatterV(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00508 vtkIdType *sendLengths, vtkIdType *offsets,
00509 vtkIdType recvLength, int srcProcessId) {
00510 return this->ScatterVVoidArray(sendBuffer, recvBuffer,
00511 sendLengths, offsets, recvLength,
00512 VTK_ID_TYPE, srcProcessId);
00513 }
00514 #endif
00515
00516
00518
00519 int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) {
00520 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_INT);
00521 }
00522 int AllGather(const unsigned long *sendBuffer,
00523 unsigned long *recvBuffer, vtkIdType length) {
00524 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
00525 VTK_UNSIGNED_LONG);
00526 }
00527 int AllGather(const unsigned char *sendBuffer,
00528 unsigned char *recvBuffer, vtkIdType length) {
00529 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
00530 VTK_UNSIGNED_CHAR);
00531 }
00532 int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) {
00533 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_CHAR);
00534 }
00535 int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) {
00536 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_FLOAT);
00537 }
00538 int AllGather(const double *sendBuffer,
00539 double *recvBuffer, vtkIdType length) {
00540 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_DOUBLE);
00541 }
00542 #ifdef VTK_USE_64BIT_IDS
00543 int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00544 vtkIdType length) {
00545 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
00546 VTK_ID_TYPE);
00547 }
00548 #endif
00549 int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer);
00551
00553
00554 int AllGatherV(const int* sendBuffer, int* recvBuffer,
00555 vtkIdType sendLength, vtkIdType* recvLengths,
00556 vtkIdType* offsets) {
00557 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00558 sendLength, recvLengths,
00559 offsets, VTK_INT);
00560 }
00561 int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
00562 vtkIdType sendLength, vtkIdType* recvLengths,
00563 vtkIdType* offsets) {
00564 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00565 sendLength, recvLengths,
00566 offsets, VTK_UNSIGNED_LONG);
00567 }
00568 int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
00569 vtkIdType sendLength, vtkIdType* recvLengths,
00570 vtkIdType* offsets) {
00571 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00572 sendLength, recvLengths,
00573 offsets, VTK_UNSIGNED_CHAR);
00574 }
00575 int AllGatherV(const char* sendBuffer, char* recvBuffer,
00576 vtkIdType sendLength, vtkIdType* recvLengths,
00577 vtkIdType* offsets) {
00578 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00579 sendLength, recvLengths,
00580 offsets, VTK_CHAR);
00581 }
00582 int AllGatherV(const float* sendBuffer, float* recvBuffer,
00583 vtkIdType sendLength, vtkIdType* recvLengths,
00584 vtkIdType* offsets) {
00585 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00586 sendLength, recvLengths,
00587 offsets, VTK_FLOAT);
00588 }
00589 int AllGatherV(const double* sendBuffer, double* recvBuffer,
00590 vtkIdType sendLength, vtkIdType* recvLengths,
00591 vtkIdType* offsets) {
00592 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00593 sendLength, recvLengths,
00594 offsets, VTK_DOUBLE);
00595 }
00596 #ifdef VTK_USE_64BIT_IDS
00597 int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
00598 vtkIdType sendLength, vtkIdType* recvLengths,
00599 vtkIdType* offsets) {
00600 return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
00601 sendLength, recvLengths,
00602 offsets, VTK_ID_TYPE);
00603 }
00604 #endif
00605 int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00606 vtkIdType *recvLengths, vtkIdType *offsets);
00607 int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer);
00609
00611
00614 int Reduce(const int *sendBuffer, int *recvBuffer,
00615 vtkIdType length, int operation, int destProcessId) {
00616 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00617 VTK_INT, operation, destProcessId);
00618 }
00619 int Reduce(const unsigned int *sendBuffer, unsigned int *recvBuffer,
00620 vtkIdType length, int operation, int destProcessId) {
00621 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00622 VTK_UNSIGNED_INT, operation, destProcessId);
00623 }
00624 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00625 vtkIdType length, int operation, int destProcessId) {
00626 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00627 VTK_UNSIGNED_LONG, operation, destProcessId);
00628 }
00629 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00630 vtkIdType length, int operation, int destProcessId) {
00631 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00632 VTK_UNSIGNED_CHAR, operation, destProcessId);
00633 }
00634 int Reduce(const char *sendBuffer, char *recvBuffer,
00635 vtkIdType length, int operation, int destProcessId) {
00636 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00637 VTK_CHAR, operation, destProcessId);
00638 }
00639 int Reduce(const float *sendBuffer, float *recvBuffer,
00640 vtkIdType length, int operation, int destProcessId) {
00641 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00642 VTK_FLOAT, operation, destProcessId);
00643 }
00644 int Reduce(const double *sendBuffer, double *recvBuffer,
00645 vtkIdType length, int operation, int destProcessId) {
00646 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00647 VTK_DOUBLE, operation, destProcessId);
00648 }
00649 #ifdef VTK_USE_64BIT_IDS
00650 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00651 vtkIdType length, int operation, int destProcessId) {
00652 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00653 VTK_ID_TYPE, operation, destProcessId);
00654 }
00655 #endif
00656 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00657 int operation, int destProcessId);
00659
00661
00664 int Reduce(const int *sendBuffer, int *recvBuffer,
00665 vtkIdType length, Operation *operation, int destProcessId) {
00666 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00667 VTK_INT, operation, destProcessId);
00668 }
00669 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00670 vtkIdType length, Operation *operation, int destProcessId) {
00671 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00672 VTK_UNSIGNED_LONG, operation, destProcessId);
00673 }
00674 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00675 vtkIdType length, Operation *operation, int destProcessId) {
00676 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00677 VTK_UNSIGNED_CHAR, operation, destProcessId);
00678 }
00679 int Reduce(const char *sendBuffer, char *recvBuffer,
00680 vtkIdType length, Operation *operation, int destProcessId) {
00681 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00682 VTK_CHAR, operation, destProcessId);
00683 }
00684 int Reduce(const float *sendBuffer, float *recvBuffer,
00685 vtkIdType length, Operation *operation, int destProcessId) {
00686 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00687 VTK_FLOAT, operation, destProcessId);
00688 }
00689 int Reduce(const double *sendBuffer, double *recvBuffer,
00690 vtkIdType length, Operation *operation, int destProcessId) {
00691 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00692 VTK_DOUBLE, operation, destProcessId);
00693 }
00694 #ifdef VTK_USE_64BIT_IDS
00695 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00696 vtkIdType length, Operation *operation, int destProcessId) {
00697 return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
00698 VTK_ID_TYPE, operation, destProcessId);
00699 }
00700 #endif
00701 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00702 Operation *operation, int destProcessId);
00704
00706
00708 int AllReduce(const int *sendBuffer, int *recvBuffer,
00709 vtkIdType length, int operation) {
00710 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00711 VTK_INT, operation);
00712 }
00713 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00714 vtkIdType length, int operation) {
00715 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00716 VTK_UNSIGNED_LONG, operation);
00717 }
00718 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00719 vtkIdType length, int operation) {
00720 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00721 VTK_UNSIGNED_CHAR, operation);
00722 }
00723 int AllReduce(const char *sendBuffer, char *recvBuffer,
00724 vtkIdType length, int operation) {
00725 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00726 VTK_CHAR, operation);
00727 }
00728 int AllReduce(const float *sendBuffer, float *recvBuffer,
00729 vtkIdType length, int operation) {
00730 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00731 VTK_FLOAT, operation);
00732 }
00733 int AllReduce(const double *sendBuffer, double *recvBuffer,
00734 vtkIdType length, int operation) {
00735 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00736 VTK_DOUBLE, operation);
00737 }
00738 #ifdef VTK_USE_64BIT_IDS
00739 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00740 vtkIdType length, int operation) {
00741 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00742 VTK_ID_TYPE, operation);
00743 }
00744 #endif
00745 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00746 int operation);
00747 int AllReduce(const int *sendBuffer, int *recvBuffer,
00748 vtkIdType length, Operation *operation) {
00749 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00750 VTK_INT, operation);
00751 }
00752 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
00753 vtkIdType length, Operation *operation) {
00754 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00755 VTK_UNSIGNED_LONG, operation);
00756 }
00757 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
00758 vtkIdType length, Operation *operation) {
00759 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00760 VTK_UNSIGNED_CHAR, operation);
00761 }
00762 int AllReduce(const char *sendBuffer, char *recvBuffer,
00763 vtkIdType length, Operation *operation) {
00764 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00765 VTK_CHAR, operation);
00766 }
00767 int AllReduce(const float *sendBuffer, float *recvBuffer,
00768 vtkIdType length, Operation *operation) {
00769 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00770 VTK_FLOAT, operation);
00771 }
00772 int AllReduce(const double *sendBuffer, double *recvBuffer,
00773 vtkIdType length, Operation *operation) {
00774 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00775 VTK_DOUBLE, operation);
00776 }
00777 #ifdef VTK_USE_64BIT_IDS
00778 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
00779 vtkIdType length, Operation *operation) {
00780 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
00781 VTK_ID_TYPE, operation);
00782 }
00783 #endif
00784 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
00785 Operation *operation);
00787
00789
00791 virtual int BroadcastVoidArray(void *data, vtkIdType length, int type,
00792 int srcProcessId);
00793 virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer,
00794 vtkIdType length, int type, int destProcessId);
00795 virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer,
00796 vtkIdType sendLength, vtkIdType *recvLengths,
00797 vtkIdType *offsets, int type, int destProcessId);
00798 virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer,
00799 vtkIdType length, int type, int srcProcessId);
00800 virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer,
00801 vtkIdType *sendLengths, vtkIdType *offsets,
00802 vtkIdType recvLength, int type,
00803 int srcProcessId);
00804 virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer,
00805 vtkIdType length, int type);
00806 virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer,
00807 vtkIdType sendLength, vtkIdType *recvLengths,
00808 vtkIdType *offsets, int type);
00809 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00810 vtkIdType length, int type,
00811 int operation, int destProcessId);
00812 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00813 vtkIdType length, int type,
00814 Operation *operation, int destProcessId);
00815 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00816 vtkIdType length, int type,
00817 int operation);
00818 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00819 vtkIdType length, int type,
00820 Operation *operation);
00822
00823 static void SetUseCopy(int useCopy);
00824
00825
00827
00835 virtual int ComputeGlobalBounds(int processorId, int numProcesses,
00836 vtkBoundingBox *bounds,
00837 int *rightHasBounds = 0,
00838 int *leftHasBounds = 0,
00839 int hasBoundsTag = 288402,
00840 int localBoundsTag = 288403,
00841 int globalBoundsTag = 288404);
00842
00844
00846
00849 static int GetParentProcessor(int pid);
00850 static int GetLeftChildProcessor(int pid);
00852
00854
00857 static int MarshalDataObject(vtkDataObject *object, vtkCharArray *buffer);
00858 static int UnMarshalDataObject(vtkCharArray *buffer, vtkDataObject *object);
00860
00861 protected:
00862
00863 int WriteDataArray(vtkDataArray *object);
00864 int ReadDataArray(vtkDataArray *object);
00865
00866 vtkCommunicator();
00867 ~vtkCommunicator();
00868
00869
00870 int SendElementalDataObject(vtkDataObject* data, int remoteHandle, int tag);
00871 int SendMultiBlockDataSet(vtkMultiBlockDataSet* data, int remoteHandle, int tag);
00872 int SendTemporalDataSet(vtkTemporalDataSet* data, int remoteHandle, int tag);
00873 int ReceiveDataObject(vtkDataObject* data,
00874 int remoteHandle, int tag, int type=-1);
00875 int ReceiveElementalDataObject(vtkDataObject* data,
00876 int remoteHandle, int tag);
00877 int ReceiveMultiBlockDataSet(
00878 vtkMultiBlockDataSet* data, int remoteHandle, int tag);
00879 int ReceiveTemporalDataSet(
00880 vtkTemporalDataSet* data, int remoteHandle, int tag);
00881
00882 int MaximumNumberOfProcesses;
00883 int NumberOfProcesses;
00884
00885 int LocalProcessId;
00886
00887 static int UseCopy;
00888
00889 vtkIdType Count;
00890
00891 private:
00892 vtkCommunicator(const vtkCommunicator&);
00893 void operator=(const vtkCommunicator&);
00894 };
00895
00896 #endif // __vtkCommunicator_h
00897
00898