VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCommunicator.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00034 #ifndef __vtkCommunicator_h 00035 #define __vtkCommunicator_h 00036 00037 #include "vtkParallelCoreModule.h" // For export macro 00038 #include "vtkObject.h" 00039 00040 class vtkBoundingBox; 00041 class vtkCharArray; 00042 class vtkDataArray; 00043 class vtkDataObject; 00044 class vtkDataSet; 00045 class vtkImageData; 00046 class vtkMultiBlockDataSet; 00047 class vtkMultiProcessStream; 00048 00049 class VTKPARALLELCORE_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 //BTX 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: 00104 00105 00114 virtual void Function(const void *A, void *B, vtkIdType length, 00115 int datatype) = 0; 00117 00120 virtual int Commutative() = 0; 00121 00122 virtual ~Operation() {} 00123 }; 00124 00125 //ETX 00126 00129 int Send(vtkDataObject* data, int remoteHandle, int tag); 00130 00133 int Send(vtkDataArray* data, int remoteHandle, int tag); 00134 00136 00140 virtual int SendVoidArray(const void *data, vtkIdType length, int type, 00141 int remoteHandle, int tag) = 0; 00143 00145 00146 int Send(const int* data, vtkIdType length, int remoteHandle, int tag) { 00147 return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag); 00148 } 00149 int Send(const unsigned int* data, vtkIdType length, int remoteHandle, int tag) { 00150 return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag); 00151 } 00152 int Send(const unsigned long* data, vtkIdType length, 00153 int remoteHandle, int tag) { 00154 return this->SendVoidArray(data, length,VTK_UNSIGNED_LONG,remoteHandle,tag); 00155 } 00156 int Send(const unsigned char* data, vtkIdType length, 00157 int remoteHandle, int tag) { 00158 return this->SendVoidArray(data, length,VTK_UNSIGNED_CHAR,remoteHandle,tag); 00159 } 00160 int Send(const char* data, vtkIdType length, int remoteHandle, int tag) { 00161 return this->SendVoidArray(data, length, VTK_CHAR, remoteHandle, tag); 00162 } 00163 int Send(const float* data, vtkIdType length, int remoteHandle, int tag) { 00164 return this->SendVoidArray(data, length, VTK_FLOAT, remoteHandle, tag); 00165 } 00166 int Send(const double* data, vtkIdType length, int remoteHandle, int tag) { 00167 return this->SendVoidArray(data, length, VTK_DOUBLE, remoteHandle, tag); 00168 } 00169 #ifdef VTK_USE_64BIT_IDS 00170 int Send(const vtkIdType* data, vtkIdType length, int remoteHandle, int tag) { 00171 return this->SendVoidArray(data, length, VTK_ID_TYPE, remoteHandle, tag); 00172 } 00173 #endif 00174 //BTX 00175 int Send(const vtkMultiProcessStream& stream, int remoteId, int tag); 00176 //ETX 00178 00179 00182 int Receive(vtkDataObject* data, int remoteHandle, int tag); 00183 00186 vtkDataObject *ReceiveDataObject(int remoteHandle, int tag); 00187 00190 int Receive(vtkDataArray* data, int remoteHandle, int tag); 00191 00193 00201 virtual int ReceiveVoidArray(void *data, vtkIdType maxlength, int type, 00202 int remoteHandle, int tag) = 0; 00204 00206 00207 int Receive(int* data, vtkIdType maxlength, int remoteHandle, int tag) { 00208 return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag); 00209 } 00210 int Receive(unsigned int* data, vtkIdType maxlength, int remoteHandle, int tag) { 00211 return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag); 00212 } 00213 int Receive(unsigned long* data, vtkIdType maxlength, int remoteHandle, int tag){ 00214 return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_LONG, remoteHandle, 00215 tag); 00216 } 00217 int Receive(unsigned char* data, vtkIdType maxlength, int remoteHandle, int tag){ 00218 return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_CHAR, remoteHandle, 00219 tag); 00220 } 00221 int Receive(char* data, vtkIdType maxlength, int remoteHandle, int tag) { 00222 return this->ReceiveVoidArray(data, maxlength, VTK_CHAR, remoteHandle, tag); 00223 } 00224 int Receive(float* data, vtkIdType maxlength, int remoteHandle, int tag) { 00225 return this->ReceiveVoidArray(data, maxlength, VTK_FLOAT, remoteHandle, tag); 00226 } 00227 int Receive(double* data, vtkIdType maxlength, int remoteHandle, int tag) { 00228 return this->ReceiveVoidArray(data, maxlength, VTK_DOUBLE, remoteHandle, tag); 00229 } 00230 #ifdef VTK_USE_64BIT_IDS 00231 int Receive(vtkIdType* data, vtkIdType maxlength, int remoteHandle, int tag) { 00232 return this->ReceiveVoidArray(data, maxlength, VTK_ID_TYPE, remoteHandle, tag); 00233 } 00234 #endif 00235 //BTX 00236 int Receive(vtkMultiProcessStream& stream, int remoteId, int tag); 00237 //ETX 00239 00241 00248 vtkGetMacro(Count, vtkIdType); 00250 00251 //---------------------- Collective Operations ---------------------- 00252 00255 virtual void Barrier(); 00256 00258 00261 int Broadcast(int *data, vtkIdType length, int srcProcessId) { 00262 return this->BroadcastVoidArray(data, length, VTK_INT, srcProcessId); 00263 } 00264 int Broadcast(unsigned int *data, vtkIdType length, int srcProcessId) { 00265 return this->BroadcastVoidArray(data, length, VTK_UNSIGNED_INT, srcProcessId); 00266 } 00267 int Broadcast(unsigned long *data, vtkIdType length, int srcProcessId) { 00268 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_LONG,srcProcessId); 00269 } 00270 int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) { 00271 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_CHAR,srcProcessId); 00272 } 00273 int Broadcast(char *data, vtkIdType length, int srcProcessId) { 00274 return this->BroadcastVoidArray(data, length, VTK_CHAR, srcProcessId); 00275 } 00276 int Broadcast(float *data, vtkIdType length, int srcProcessId) { 00277 return this->BroadcastVoidArray(data, length, VTK_FLOAT, srcProcessId); 00278 } 00279 int Broadcast(double *data, vtkIdType length, int srcProcessId) { 00280 return this->BroadcastVoidArray(data, length, VTK_DOUBLE, srcProcessId); 00281 } 00282 #ifdef VTK_USE_64BIT_IDS 00283 int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) { 00284 return this->BroadcastVoidArray(data, length, VTK_ID_TYPE, srcProcessId); 00285 } 00286 #endif 00287 int Broadcast(vtkDataObject *data, int srcProcessId); 00288 int Broadcast(vtkDataArray *data, int srcProcessId); 00289 //BTX 00290 int Broadcast(vtkMultiProcessStream& stream, int srcProcessId); 00291 //ETX 00293 00295 00303 int Gather(const int *sendBuffer, int *recvBuffer, 00304 vtkIdType length, int destProcessId) { 00305 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00306 VTK_INT, destProcessId); 00307 } 00308 int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00309 vtkIdType length, int destProcessId) { 00310 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00311 VTK_UNSIGNED_LONG, destProcessId); 00312 } 00313 int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00314 vtkIdType length, int destProcessId) { 00315 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00316 VTK_UNSIGNED_CHAR, destProcessId); 00317 } 00318 int Gather(const char *sendBuffer, char *recvBuffer, 00319 vtkIdType length, int destProcessId) { 00320 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00321 VTK_CHAR, destProcessId); 00322 } 00323 int Gather(const float *sendBuffer, float *recvBuffer, 00324 vtkIdType length, int destProcessId) { 00325 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00326 VTK_FLOAT, destProcessId); 00327 } 00328 int Gather(const double *sendBuffer, double *recvBuffer, 00329 vtkIdType length, int destProcessId) { 00330 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00331 VTK_DOUBLE, destProcessId); 00332 } 00333 #ifdef VTK_USE_64BIT_IDS 00334 int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00335 vtkIdType length, int destProcessId) { 00336 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00337 VTK_ID_TYPE, destProcessId); 00338 } 00339 #endif 00340 int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00341 int destProcessId); 00343 00345 00355 int GatherV(const int* sendBuffer, int* recvBuffer, 00356 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00357 int destProcessId) { 00358 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00359 sendLength, recvLengths, 00360 offsets, VTK_INT, destProcessId); 00361 } 00362 int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer, 00363 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00364 int destProcessId) { 00365 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00366 sendLength, recvLengths, 00367 offsets, VTK_UNSIGNED_LONG, destProcessId); 00368 } 00369 int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer, 00370 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00371 int destProcessId) { 00372 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00373 sendLength, recvLengths, 00374 offsets, VTK_UNSIGNED_CHAR, destProcessId); 00375 } 00376 int GatherV(const char* sendBuffer, char* recvBuffer, 00377 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00378 int destProcessId) { 00379 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00380 sendLength, recvLengths, 00381 offsets, VTK_CHAR, destProcessId); 00382 } 00383 int GatherV(const float* sendBuffer, float* recvBuffer, 00384 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00385 int destProcessId) { 00386 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00387 sendLength, recvLengths, 00388 offsets, VTK_FLOAT, destProcessId); 00389 } 00390 int GatherV(const double* sendBuffer, double* recvBuffer, 00391 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00392 int destProcessId) { 00393 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00394 sendLength, recvLengths, 00395 offsets, VTK_DOUBLE, destProcessId); 00396 } 00397 #ifdef VTK_USE_64BIT_IDS 00398 int GatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer, 00399 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00400 int destProcessId) { 00401 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00402 sendLength, recvLengths, 00403 offsets, VTK_ID_TYPE, destProcessId); 00404 } 00405 #endif 00406 int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00407 vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId); 00408 int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00409 int destProcessId); 00411 00413 00418 int Scatter(const int *sendBuffer, int *recvBuffer, 00419 vtkIdType length, int srcProcessId) { 00420 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00421 VTK_INT, srcProcessId); 00422 } 00423 int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00424 vtkIdType length, int srcProcessId) { 00425 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00426 VTK_UNSIGNED_LONG, srcProcessId); 00427 } 00428 int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00429 vtkIdType length, int srcProcessId) { 00430 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00431 VTK_UNSIGNED_CHAR, srcProcessId); 00432 } 00433 int Scatter(const char *sendBuffer, char *recvBuffer, 00434 vtkIdType length, int srcProcessId) { 00435 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00436 VTK_CHAR, srcProcessId); 00437 } 00438 int Scatter(const float *sendBuffer, float *recvBuffer, 00439 vtkIdType length, int srcProcessId) { 00440 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00441 VTK_FLOAT, srcProcessId); 00442 } 00443 int Scatter(const double *sendBuffer, double *recvBuffer, 00444 vtkIdType length, int srcProcessId) { 00445 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00446 VTK_DOUBLE, srcProcessId); 00447 } 00448 #ifdef VTK_USE_64BIT_IDS 00449 int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00450 vtkIdType length, int srcProcessId) { 00451 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00452 VTK_ID_TYPE, srcProcessId); 00453 } 00454 #endif 00455 int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00456 int srcProcessId); 00458 00460 00466 int ScatterV(const int *sendBuffer, int *recvBuffer, 00467 vtkIdType *sendLengths, vtkIdType *offsets, 00468 vtkIdType recvLength, int srcProcessId) { 00469 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00470 sendLengths, offsets, recvLength, 00471 VTK_INT, srcProcessId); 00472 } 00473 int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00474 vtkIdType *sendLengths, vtkIdType *offsets, 00475 vtkIdType recvLength, int srcProcessId) { 00476 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00477 sendLengths, offsets, recvLength, 00478 VTK_UNSIGNED_LONG, srcProcessId); 00479 } 00480 int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00481 vtkIdType *sendLengths, vtkIdType *offsets, 00482 vtkIdType recvLength, int srcProcessId) { 00483 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00484 sendLengths, offsets, recvLength, 00485 VTK_UNSIGNED_CHAR, srcProcessId); 00486 } 00487 int ScatterV(const char *sendBuffer, char *recvBuffer, 00488 vtkIdType *sendLengths, vtkIdType *offsets, 00489 vtkIdType recvLength, int srcProcessId) { 00490 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00491 sendLengths, offsets, recvLength, 00492 VTK_CHAR, srcProcessId); 00493 } 00494 int ScatterV(const float *sendBuffer, float *recvBuffer, 00495 vtkIdType *sendLengths, vtkIdType *offsets, 00496 vtkIdType recvLength, int srcProcessId) { 00497 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00498 sendLengths, offsets, recvLength, 00499 VTK_FLOAT, srcProcessId); 00500 } 00501 int ScatterV(const double *sendBuffer, double *recvBuffer, 00502 vtkIdType *sendLengths, vtkIdType *offsets, 00503 vtkIdType recvLength, int srcProcessId) { 00504 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00505 sendLengths, offsets, recvLength, 00506 VTK_DOUBLE, srcProcessId); 00507 } 00508 #ifdef VTK_USE_64BIT_IDS 00509 int ScatterV(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00510 vtkIdType *sendLengths, vtkIdType *offsets, 00511 vtkIdType recvLength, int srcProcessId) { 00512 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00513 sendLengths, offsets, recvLength, 00514 VTK_ID_TYPE, srcProcessId); 00515 } 00516 #endif 00517 00518 00520 00521 int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) { 00522 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_INT); 00523 } 00524 int AllGather(const unsigned long *sendBuffer, 00525 unsigned long *recvBuffer, vtkIdType length) { 00526 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00527 VTK_UNSIGNED_LONG); 00528 } 00529 int AllGather(const unsigned char *sendBuffer, 00530 unsigned char *recvBuffer, vtkIdType length) { 00531 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00532 VTK_UNSIGNED_CHAR); 00533 } 00534 int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) { 00535 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_CHAR); 00536 } 00537 int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) { 00538 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_FLOAT); 00539 } 00540 int AllGather(const double *sendBuffer, 00541 double *recvBuffer, vtkIdType length) { 00542 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_DOUBLE); 00543 } 00544 #ifdef VTK_USE_64BIT_IDS 00545 int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00546 vtkIdType length) { 00547 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00548 VTK_ID_TYPE); 00549 } 00550 #endif 00551 int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer); 00553 00555 00556 int AllGatherV(const int* sendBuffer, int* recvBuffer, 00557 vtkIdType sendLength, vtkIdType* recvLengths, 00558 vtkIdType* offsets) { 00559 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00560 sendLength, recvLengths, 00561 offsets, VTK_INT); 00562 } 00563 int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer, 00564 vtkIdType sendLength, vtkIdType* recvLengths, 00565 vtkIdType* offsets) { 00566 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00567 sendLength, recvLengths, 00568 offsets, VTK_UNSIGNED_LONG); 00569 } 00570 int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer, 00571 vtkIdType sendLength, vtkIdType* recvLengths, 00572 vtkIdType* offsets) { 00573 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00574 sendLength, recvLengths, 00575 offsets, VTK_UNSIGNED_CHAR); 00576 } 00577 int AllGatherV(const char* sendBuffer, char* recvBuffer, 00578 vtkIdType sendLength, vtkIdType* recvLengths, 00579 vtkIdType* offsets) { 00580 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00581 sendLength, recvLengths, 00582 offsets, VTK_CHAR); 00583 } 00584 int AllGatherV(const float* sendBuffer, float* recvBuffer, 00585 vtkIdType sendLength, vtkIdType* recvLengths, 00586 vtkIdType* offsets) { 00587 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00588 sendLength, recvLengths, 00589 offsets, VTK_FLOAT); 00590 } 00591 int AllGatherV(const double* sendBuffer, double* recvBuffer, 00592 vtkIdType sendLength, vtkIdType* recvLengths, 00593 vtkIdType* offsets) { 00594 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00595 sendLength, recvLengths, 00596 offsets, VTK_DOUBLE); 00597 } 00598 #ifdef VTK_USE_64BIT_IDS 00599 int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer, 00600 vtkIdType sendLength, vtkIdType* recvLengths, 00601 vtkIdType* offsets) { 00602 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00603 sendLength, recvLengths, 00604 offsets, VTK_ID_TYPE); 00605 } 00606 #endif 00607 int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00608 vtkIdType *recvLengths, vtkIdType *offsets); 00609 int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer); 00611 00613 00616 int Reduce(const int *sendBuffer, int *recvBuffer, 00617 vtkIdType length, int operation, int destProcessId) { 00618 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00619 VTK_INT, operation, destProcessId); 00620 } 00621 int Reduce(const unsigned int *sendBuffer, unsigned int *recvBuffer, 00622 vtkIdType length, int operation, int destProcessId) { 00623 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00624 VTK_UNSIGNED_INT, operation, destProcessId); 00625 } 00626 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00627 vtkIdType length, int operation, int destProcessId) { 00628 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00629 VTK_UNSIGNED_LONG, operation, destProcessId); 00630 } 00631 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00632 vtkIdType length, int operation, int destProcessId) { 00633 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00634 VTK_UNSIGNED_CHAR, operation, destProcessId); 00635 } 00636 int Reduce(const char *sendBuffer, char *recvBuffer, 00637 vtkIdType length, int operation, int destProcessId) { 00638 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00639 VTK_CHAR, operation, destProcessId); 00640 } 00641 int Reduce(const float *sendBuffer, float *recvBuffer, 00642 vtkIdType length, int operation, int destProcessId) { 00643 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00644 VTK_FLOAT, operation, destProcessId); 00645 } 00646 int Reduce(const double *sendBuffer, double *recvBuffer, 00647 vtkIdType length, int operation, int destProcessId) { 00648 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00649 VTK_DOUBLE, operation, destProcessId); 00650 } 00651 #ifdef VTK_USE_64BIT_IDS 00652 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00653 vtkIdType length, int operation, int destProcessId) { 00654 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00655 VTK_ID_TYPE, operation, destProcessId); 00656 } 00657 #endif 00658 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00659 int operation, int destProcessId); 00661 00663 00666 int Reduce(const int *sendBuffer, int *recvBuffer, 00667 vtkIdType length, Operation *operation, int destProcessId) { 00668 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00669 VTK_INT, operation, destProcessId); 00670 } 00671 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00672 vtkIdType length, Operation *operation, int destProcessId) { 00673 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00674 VTK_UNSIGNED_LONG, operation, destProcessId); 00675 } 00676 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00677 vtkIdType length, Operation *operation, int destProcessId) { 00678 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00679 VTK_UNSIGNED_CHAR, operation, destProcessId); 00680 } 00681 int Reduce(const char *sendBuffer, char *recvBuffer, 00682 vtkIdType length, Operation *operation, int destProcessId) { 00683 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00684 VTK_CHAR, operation, destProcessId); 00685 } 00686 int Reduce(const float *sendBuffer, float *recvBuffer, 00687 vtkIdType length, Operation *operation, int destProcessId) { 00688 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00689 VTK_FLOAT, operation, destProcessId); 00690 } 00691 int Reduce(const double *sendBuffer, double *recvBuffer, 00692 vtkIdType length, Operation *operation, int destProcessId) { 00693 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00694 VTK_DOUBLE, operation, destProcessId); 00695 } 00696 #ifdef VTK_USE_64BIT_IDS 00697 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00698 vtkIdType length, Operation *operation, int destProcessId) { 00699 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00700 VTK_ID_TYPE, operation, destProcessId); 00701 } 00702 #endif 00703 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00704 Operation *operation, int destProcessId); 00706 00708 00710 int AllReduce(const int *sendBuffer, int *recvBuffer, 00711 vtkIdType length, int operation) { 00712 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00713 VTK_INT, operation); 00714 } 00715 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00716 vtkIdType length, int operation) { 00717 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00718 VTK_UNSIGNED_LONG, operation); 00719 } 00720 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00721 vtkIdType length, int operation) { 00722 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00723 VTK_UNSIGNED_CHAR, operation); 00724 } 00725 int AllReduce(const char *sendBuffer, char *recvBuffer, 00726 vtkIdType length, int operation) { 00727 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00728 VTK_CHAR, operation); 00729 } 00730 int AllReduce(const float *sendBuffer, float *recvBuffer, 00731 vtkIdType length, int operation) { 00732 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00733 VTK_FLOAT, operation); 00734 } 00735 int AllReduce(const double *sendBuffer, double *recvBuffer, 00736 vtkIdType length, int operation) { 00737 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00738 VTK_DOUBLE, operation); 00739 } 00740 #ifdef VTK_USE_64BIT_IDS 00741 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00742 vtkIdType length, int operation) { 00743 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00744 VTK_ID_TYPE, operation); 00745 } 00746 #endif 00747 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00748 int operation); 00749 int AllReduce(const int *sendBuffer, int *recvBuffer, 00750 vtkIdType length, Operation *operation) { 00751 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00752 VTK_INT, operation); 00753 } 00754 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00755 vtkIdType length, Operation *operation) { 00756 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00757 VTK_UNSIGNED_LONG, operation); 00758 } 00759 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00760 vtkIdType length, Operation *operation) { 00761 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00762 VTK_UNSIGNED_CHAR, operation); 00763 } 00764 int AllReduce(const char *sendBuffer, char *recvBuffer, 00765 vtkIdType length, Operation *operation) { 00766 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00767 VTK_CHAR, operation); 00768 } 00769 int AllReduce(const float *sendBuffer, float *recvBuffer, 00770 vtkIdType length, Operation *operation) { 00771 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00772 VTK_FLOAT, operation); 00773 } 00774 int AllReduce(const double *sendBuffer, double *recvBuffer, 00775 vtkIdType length, Operation *operation) { 00776 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00777 VTK_DOUBLE, operation); 00778 } 00779 #ifdef VTK_USE_64BIT_IDS 00780 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00781 vtkIdType length, Operation *operation) { 00782 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00783 VTK_ID_TYPE, operation); 00784 } 00785 #endif 00786 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00787 Operation *operation); 00789 00791 00793 virtual int BroadcastVoidArray(void *data, vtkIdType length, int type, 00794 int srcProcessId); 00795 virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer, 00796 vtkIdType length, int type, int destProcessId); 00797 virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer, 00798 vtkIdType sendLength, vtkIdType *recvLengths, 00799 vtkIdType *offsets, int type, int destProcessId); 00800 virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer, 00801 vtkIdType length, int type, int srcProcessId); 00802 virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer, 00803 vtkIdType *sendLengths, vtkIdType *offsets, 00804 vtkIdType recvLength, int type, 00805 int srcProcessId); 00806 virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer, 00807 vtkIdType length, int type); 00808 virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer, 00809 vtkIdType sendLength, vtkIdType *recvLengths, 00810 vtkIdType *offsets, int type); 00811 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00812 vtkIdType length, int type, 00813 int operation, int destProcessId); 00814 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00815 vtkIdType length, int type, 00816 Operation *operation, int destProcessId); 00817 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00818 vtkIdType length, int type, 00819 int operation); 00820 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00821 vtkIdType length, int type, 00822 Operation *operation); 00824 00825 static void SetUseCopy(int useCopy); 00826 00827 //BTX 00829 00837 virtual int ComputeGlobalBounds(int processorId, int numProcesses, 00838 vtkBoundingBox *bounds, 00839 int *rightHasBounds = 0, 00840 int *leftHasBounds = 0, 00841 int hasBoundsTag = 288402, 00842 int localBoundsTag = 288403, 00843 int globalBoundsTag = 288404); 00844 //ETX 00846 00848 00851 static int GetParentProcessor(int pid); 00852 static int GetLeftChildProcessor(int pid); 00854 00856 00859 static int MarshalDataObject(vtkDataObject *object, vtkCharArray *buffer); 00860 static int UnMarshalDataObject(vtkCharArray *buffer, vtkDataObject *object); 00862 00863 protected: 00864 00865 int WriteDataArray(vtkDataArray *object); 00866 int ReadDataArray(vtkDataArray *object); 00867 00868 vtkCommunicator(); 00869 ~vtkCommunicator(); 00870 00871 // Internal methods called by Send/Receive(vtkDataObject *... ) above. 00872 int SendElementalDataObject(vtkDataObject* data, int remoteHandle, int tag); 00873 int SendMultiBlockDataSet(vtkMultiBlockDataSet* data, int remoteHandle, int tag); 00874 int ReceiveDataObject(vtkDataObject* data, 00875 int remoteHandle, int tag, int type=-1); 00876 int ReceiveElementalDataObject(vtkDataObject* data, 00877 int remoteHandle, int tag); 00878 int ReceiveMultiBlockDataSet( 00879 vtkMultiBlockDataSet* data, int remoteHandle, int tag); 00880 00881 int MaximumNumberOfProcesses; 00882 int NumberOfProcesses; 00883 00884 int LocalProcessId; 00885 00886 static int UseCopy; 00887 00888 vtkIdType Count; 00889 00890 private: 00891 vtkCommunicator(const vtkCommunicator&); // Not implemented. 00892 void operator=(const vtkCommunicator&); // Not implemented. 00893 }; 00894 00895 #endif // __vtkCommunicator_h 00896 00897