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 "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 //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: 00103 // Description: 00104 // Subclasses must overload this method, which performs the actual 00105 // operations. The methods should first do a reintepret cast of the arrays 00106 // to the type suggestsed by \c datatype (which will be one of the VTK type 00107 // identifiers like VTK_INT, etc.). Both arrays are considered top be 00108 // length entries. The method should perform the operation A*B (where * is 00109 // a placeholder for whatever operation is actually performed) and store the 00110 // result in B. The operation is assumed to be associative. Commutativity 00111 // is specified by the Commutative method. 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 //ETX 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 } 00172 #endif 00173 //BTX 00174 int Send(const vtkMultiProcessStream& stream, int remoteId, int tag); 00175 //ETX 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 } 00233 #endif 00234 //BTX 00235 int Receive(vtkMultiProcessStream& stream, int remoteId, int tag); 00236 //ETX 00237 00239 00246 vtkGetMacro(Count, vtkIdType); 00248 00249 //---------------------- Collective Operations ---------------------- 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 long *data, vtkIdType length, int srcProcessId) { 00263 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_LONG,srcProcessId); 00264 } 00265 int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) { 00266 return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_CHAR,srcProcessId); 00267 } 00268 int Broadcast(char *data, vtkIdType length, int srcProcessId) { 00269 return this->BroadcastVoidArray(data, length, VTK_CHAR, srcProcessId); 00270 } 00271 int Broadcast(float *data, vtkIdType length, int srcProcessId) { 00272 return this->BroadcastVoidArray(data, length, VTK_FLOAT, srcProcessId); 00273 } 00274 int Broadcast(double *data, vtkIdType length, int srcProcessId) { 00275 return this->BroadcastVoidArray(data, length, VTK_DOUBLE, srcProcessId); 00276 } 00277 #ifdef VTK_USE_64BIT_IDS 00278 int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) { 00279 return this->BroadcastVoidArray(data, length, VTK_ID_TYPE, srcProcessId); 00280 } 00282 #endif 00283 int Broadcast(vtkDataObject *data, int srcProcessId); 00284 int Broadcast(vtkDataArray *data, int srcProcessId); 00285 //BTX 00286 int Broadcast(vtkMultiProcessStream& stream, int srcProcessId); 00287 //ETX 00288 00290 00298 int Gather(const int *sendBuffer, int *recvBuffer, 00299 vtkIdType length, int destProcessId) { 00300 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00301 VTK_INT, destProcessId); 00302 } 00303 int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00304 vtkIdType length, int destProcessId) { 00305 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00306 VTK_UNSIGNED_LONG, destProcessId); 00307 } 00308 int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00309 vtkIdType length, int destProcessId) { 00310 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00311 VTK_UNSIGNED_CHAR, destProcessId); 00312 } 00313 int Gather(const char *sendBuffer, char *recvBuffer, 00314 vtkIdType length, int destProcessId) { 00315 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00316 VTK_CHAR, destProcessId); 00317 } 00318 int Gather(const float *sendBuffer, float *recvBuffer, 00319 vtkIdType length, int destProcessId) { 00320 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00321 VTK_FLOAT, destProcessId); 00322 } 00323 int Gather(const double *sendBuffer, double *recvBuffer, 00324 vtkIdType length, int destProcessId) { 00325 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00326 VTK_DOUBLE, destProcessId); 00327 } 00328 #ifdef VTK_USE_64BIT_IDS 00329 int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00330 vtkIdType length, int destProcessId) { 00331 return this->GatherVoidArray(sendBuffer, recvBuffer, length, 00332 VTK_ID_TYPE, destProcessId); 00333 } 00335 #endif 00336 int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00337 int destProcessId); 00338 00340 00350 int GatherV(const int* sendBuffer, int* recvBuffer, 00351 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00352 int destProcessId) { 00353 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00354 sendLength, recvLengths, 00355 offsets, VTK_INT, destProcessId); 00356 } 00357 int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer, 00358 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00359 int destProcessId) { 00360 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00361 sendLength, recvLengths, 00362 offsets, VTK_UNSIGNED_LONG, destProcessId); 00363 } 00364 int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer, 00365 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00366 int destProcessId) { 00367 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00368 sendLength, recvLengths, 00369 offsets, VTK_UNSIGNED_CHAR, destProcessId); 00370 } 00371 int GatherV(const char* sendBuffer, char* recvBuffer, 00372 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00373 int destProcessId) { 00374 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00375 sendLength, recvLengths, 00376 offsets, VTK_CHAR, destProcessId); 00377 } 00378 int GatherV(const float* sendBuffer, float* recvBuffer, 00379 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00380 int destProcessId) { 00381 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00382 sendLength, recvLengths, 00383 offsets, VTK_FLOAT, destProcessId); 00384 } 00385 int GatherV(const double* sendBuffer, double* recvBuffer, 00386 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00387 int destProcessId) { 00388 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00389 sendLength, recvLengths, 00390 offsets, VTK_DOUBLE, destProcessId); 00391 } 00392 #ifdef VTK_USE_64BIT_IDS 00393 int GatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer, 00394 vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets, 00395 int destProcessId) { 00396 return this->GatherVVoidArray(sendBuffer, recvBuffer, 00397 sendLength, recvLengths, 00398 offsets, VTK_ID_TYPE, destProcessId); 00399 } 00401 #endif 00402 00404 00409 int Scatter(const int *sendBuffer, int *recvBuffer, 00410 vtkIdType length, int srcProcessId) { 00411 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00412 VTK_INT, srcProcessId); 00413 } 00414 int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00415 vtkIdType length, int srcProcessId) { 00416 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00417 VTK_UNSIGNED_LONG, srcProcessId); 00418 } 00419 int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00420 vtkIdType length, int srcProcessId) { 00421 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00422 VTK_UNSIGNED_CHAR, srcProcessId); 00423 } 00424 int Scatter(const char *sendBuffer, char *recvBuffer, 00425 vtkIdType length, int srcProcessId) { 00426 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00427 VTK_CHAR, srcProcessId); 00428 } 00429 int Scatter(const float *sendBuffer, float *recvBuffer, 00430 vtkIdType length, int srcProcessId) { 00431 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00432 VTK_FLOAT, srcProcessId); 00433 } 00434 int Scatter(const double *sendBuffer, double *recvBuffer, 00435 vtkIdType length, int srcProcessId) { 00436 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00437 VTK_DOUBLE, srcProcessId); 00438 } 00439 #ifdef VTK_USE_64BIT_IDS 00440 int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00441 vtkIdType length, int srcProcessId) { 00442 return this->ScatterVoidArray(sendBuffer, recvBuffer, length, 00443 VTK_ID_TYPE, srcProcessId); 00444 } 00446 #endif 00447 int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00448 int srcProcessId); 00449 00451 00457 int ScatterV(const int *sendBuffer, int *recvBuffer, 00458 vtkIdType *sendLengths, vtkIdType *offsets, 00459 vtkIdType recvLength, int srcProcessId) { 00460 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00461 sendLengths, offsets, recvLength, 00462 VTK_INT, srcProcessId); 00463 } 00464 int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00465 vtkIdType *sendLengths, vtkIdType *offsets, 00466 vtkIdType recvLength, int srcProcessId) { 00467 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00468 sendLengths, offsets, recvLength, 00469 VTK_UNSIGNED_LONG, srcProcessId); 00470 } 00471 int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00472 vtkIdType *sendLengths, vtkIdType *offsets, 00473 vtkIdType recvLength, int srcProcessId) { 00474 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00475 sendLengths, offsets, recvLength, 00476 VTK_UNSIGNED_CHAR, srcProcessId); 00477 } 00478 int ScatterV(const char *sendBuffer, char *recvBuffer, 00479 vtkIdType *sendLengths, vtkIdType *offsets, 00480 vtkIdType recvLength, int srcProcessId) { 00481 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00482 sendLengths, offsets, recvLength, 00483 VTK_CHAR, srcProcessId); 00484 } 00485 int ScatterV(const float *sendBuffer, float *recvBuffer, 00486 vtkIdType *sendLengths, vtkIdType *offsets, 00487 vtkIdType recvLength, int srcProcessId) { 00488 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00489 sendLengths, offsets, recvLength, 00490 VTK_FLOAT, srcProcessId); 00491 } 00492 int ScatterV(const double *sendBuffer, double *recvBuffer, 00493 vtkIdType *sendLengths, vtkIdType *offsets, 00494 vtkIdType recvLength, int srcProcessId) { 00495 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00496 sendLengths, offsets, recvLength, 00497 VTK_DOUBLE, srcProcessId); 00498 } 00499 #ifdef VTK_USE_64BIT_IDS 00500 int ScatterV(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00501 vtkIdType *sendLengths, vtkIdType *offsets, 00502 vtkIdType recvLength, int srcProcessId) { 00503 return this->ScatterVVoidArray(sendBuffer, recvBuffer, 00504 sendLengths, offsets, recvLength, 00505 VTK_ID_TYPE, srcProcessId); 00506 } 00508 #endif 00509 00511 00512 int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) { 00513 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_INT); 00514 } 00515 int AllGather(const unsigned long *sendBuffer, 00516 unsigned long *recvBuffer, vtkIdType length) { 00517 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00518 VTK_UNSIGNED_LONG); 00519 } 00520 int AllGather(const unsigned char *sendBuffer, 00521 unsigned char *recvBuffer, vtkIdType length) { 00522 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00523 VTK_UNSIGNED_CHAR); 00524 } 00525 int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) { 00526 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_CHAR); 00527 } 00528 int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) { 00529 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_FLOAT); 00530 } 00531 int AllGather(const double *sendBuffer, 00532 double *recvBuffer, vtkIdType length) { 00533 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_DOUBLE); 00534 } 00535 #ifdef VTK_USE_64BIT_IDS 00536 int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00537 vtkIdType length) { 00538 return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, 00539 VTK_ID_TYPE); 00540 } 00542 #endif 00543 int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer); 00544 00546 00547 int AllGatherV(const int* sendBuffer, int* recvBuffer, 00548 vtkIdType sendLength, vtkIdType* recvLengths, 00549 vtkIdType* offsets) { 00550 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00551 sendLength, recvLengths, 00552 offsets, VTK_INT); 00553 } 00554 int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer, 00555 vtkIdType sendLength, vtkIdType* recvLengths, 00556 vtkIdType* offsets) { 00557 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00558 sendLength, recvLengths, 00559 offsets, VTK_UNSIGNED_LONG); 00560 } 00561 int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer, 00562 vtkIdType sendLength, vtkIdType* recvLengths, 00563 vtkIdType* offsets) { 00564 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00565 sendLength, recvLengths, 00566 offsets, VTK_UNSIGNED_CHAR); 00567 } 00568 int AllGatherV(const char* sendBuffer, char* recvBuffer, 00569 vtkIdType sendLength, vtkIdType* recvLengths, 00570 vtkIdType* offsets) { 00571 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00572 sendLength, recvLengths, 00573 offsets, VTK_CHAR); 00574 } 00575 int AllGatherV(const float* sendBuffer, float* recvBuffer, 00576 vtkIdType sendLength, vtkIdType* recvLengths, 00577 vtkIdType* offsets) { 00578 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00579 sendLength, recvLengths, 00580 offsets, VTK_FLOAT); 00581 } 00582 int AllGatherV(const double* sendBuffer, double* recvBuffer, 00583 vtkIdType sendLength, vtkIdType* recvLengths, 00584 vtkIdType* offsets) { 00585 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00586 sendLength, recvLengths, 00587 offsets, VTK_DOUBLE); 00588 } 00589 #ifdef VTK_USE_64BIT_IDS 00590 int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer, 00591 vtkIdType sendLength, vtkIdType* recvLengths, 00592 vtkIdType* offsets) { 00593 return this->AllGatherVVoidArray(sendBuffer, recvBuffer, 00594 sendLength, recvLengths, 00595 offsets, VTK_ID_TYPE); 00596 } 00598 #endif 00599 00601 00604 int Reduce(const int *sendBuffer, int *recvBuffer, 00605 vtkIdType length, int operation, int destProcessId) { 00606 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00607 VTK_INT, operation, destProcessId); 00608 } 00609 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00610 vtkIdType length, int operation, int destProcessId) { 00611 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00612 VTK_UNSIGNED_LONG, operation, destProcessId); 00613 } 00614 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00615 vtkIdType length, int operation, int destProcessId) { 00616 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00617 VTK_UNSIGNED_CHAR, operation, destProcessId); 00618 } 00619 int Reduce(const char *sendBuffer, char *recvBuffer, 00620 vtkIdType length, int operation, int destProcessId) { 00621 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00622 VTK_CHAR, operation, destProcessId); 00623 } 00624 int Reduce(const float *sendBuffer, float *recvBuffer, 00625 vtkIdType length, int operation, int destProcessId) { 00626 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00627 VTK_FLOAT, operation, destProcessId); 00628 } 00629 int Reduce(const double *sendBuffer, double *recvBuffer, 00630 vtkIdType length, int operation, int destProcessId) { 00631 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00632 VTK_DOUBLE, operation, destProcessId); 00633 } 00634 #ifdef VTK_USE_64BIT_IDS 00635 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00636 vtkIdType length, int operation, int destProcessId) { 00637 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00638 VTK_ID_TYPE, operation, destProcessId); 00639 } 00641 #endif 00642 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00643 int operation, int destProcessId); 00644 00646 00649 int Reduce(const int *sendBuffer, int *recvBuffer, 00650 vtkIdType length, Operation *operation, int destProcessId) { 00651 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00652 VTK_INT, operation, destProcessId); 00653 } 00654 int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00655 vtkIdType length, Operation *operation, int destProcessId) { 00656 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00657 VTK_UNSIGNED_LONG, operation, destProcessId); 00658 } 00659 int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00660 vtkIdType length, Operation *operation, int destProcessId) { 00661 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00662 VTK_UNSIGNED_CHAR, operation, destProcessId); 00663 } 00664 int Reduce(const char *sendBuffer, char *recvBuffer, 00665 vtkIdType length, Operation *operation, int destProcessId) { 00666 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00667 VTK_CHAR, operation, destProcessId); 00668 } 00669 int Reduce(const float *sendBuffer, float *recvBuffer, 00670 vtkIdType length, Operation *operation, int destProcessId) { 00671 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00672 VTK_FLOAT, operation, destProcessId); 00673 } 00674 int Reduce(const double *sendBuffer, double *recvBuffer, 00675 vtkIdType length, Operation *operation, int destProcessId) { 00676 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00677 VTK_DOUBLE, operation, destProcessId); 00678 } 00679 #ifdef VTK_USE_64BIT_IDS 00680 int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00681 vtkIdType length, Operation *operation, int destProcessId) { 00682 return this->ReduceVoidArray(sendBuffer, recvBuffer, length, 00683 VTK_ID_TYPE, operation, destProcessId); 00684 } 00686 #endif 00687 int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00688 Operation *operation, int destProcessId); 00689 00691 00693 int AllReduce(const int *sendBuffer, int *recvBuffer, 00694 vtkIdType length, int operation) { 00695 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00696 VTK_INT, operation); 00697 } 00698 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00699 vtkIdType length, int operation) { 00700 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00701 VTK_UNSIGNED_LONG, operation); 00702 } 00703 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00704 vtkIdType length, int operation) { 00705 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00706 VTK_UNSIGNED_CHAR, operation); 00707 } 00708 int AllReduce(const char *sendBuffer, char *recvBuffer, 00709 vtkIdType length, int operation) { 00710 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00711 VTK_CHAR, operation); 00712 } 00713 int AllReduce(const float *sendBuffer, float *recvBuffer, 00714 vtkIdType length, int operation) { 00715 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00716 VTK_FLOAT, operation); 00717 } 00718 int AllReduce(const double *sendBuffer, double *recvBuffer, 00719 vtkIdType length, int operation) { 00720 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00721 VTK_DOUBLE, operation); 00722 } 00723 #ifdef VTK_USE_64BIT_IDS 00724 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00725 vtkIdType length, int operation) { 00726 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00727 VTK_ID_TYPE, operation); 00728 } 00730 #endif 00731 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00732 int operation); 00733 int AllReduce(const int *sendBuffer, int *recvBuffer, 00734 vtkIdType length, Operation *operation) { 00735 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00736 VTK_INT, operation); 00737 } 00738 int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer, 00739 vtkIdType length, Operation *operation) { 00740 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00741 VTK_UNSIGNED_LONG, operation); 00742 } 00743 int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer, 00744 vtkIdType length, Operation *operation) { 00745 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00746 VTK_UNSIGNED_CHAR, operation); 00747 } 00748 int AllReduce(const char *sendBuffer, char *recvBuffer, 00749 vtkIdType length, Operation *operation) { 00750 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00751 VTK_CHAR, operation); 00752 } 00753 int AllReduce(const float *sendBuffer, float *recvBuffer, 00754 vtkIdType length, Operation *operation) { 00755 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00756 VTK_FLOAT, operation); 00757 } 00758 int AllReduce(const double *sendBuffer, double *recvBuffer, 00759 vtkIdType length, Operation *operation) { 00760 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00761 VTK_DOUBLE, operation); 00762 } 00763 #ifdef VTK_USE_64BIT_IDS 00764 int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer, 00765 vtkIdType length, Operation *operation) { 00766 return this->AllReduceVoidArray(sendBuffer, recvBuffer, length, 00767 VTK_ID_TYPE, operation); 00768 } 00769 #endif 00770 int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer, 00771 Operation *operation); 00772 00774 00776 virtual int BroadcastVoidArray(void *data, vtkIdType length, int type, 00777 int srcProcessId); 00778 virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer, 00779 vtkIdType length, int type, int destProcessId); 00780 virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer, 00781 vtkIdType sendLength, vtkIdType *recvLengths, 00782 vtkIdType *offsets, int type, int destProcessId); 00783 virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer, 00784 vtkIdType length, int type, int srcProcessId); 00785 virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer, 00786 vtkIdType *sendLengths, vtkIdType *offsets, 00787 vtkIdType recvLength, int type, 00788 int srcProcessId); 00789 virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer, 00790 vtkIdType length, int type); 00791 virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer, 00792 vtkIdType sendLength, vtkIdType *recvLengths, 00793 vtkIdType *offsets, int type); 00794 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00795 vtkIdType length, int type, 00796 int operation, int destProcessId); 00797 virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00798 vtkIdType length, int type, 00799 Operation *operation, int destProcessId); 00800 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00801 vtkIdType length, int type, 00802 int operation); 00803 virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, 00804 vtkIdType length, int type, 00805 Operation *operation); 00807 00808 static void SetUseCopy(int useCopy); 00809 00811 00819 virtual int ComputeGlobalBounds(int processorId, int numProcesses, 00820 vtkBoundingBox *bounds, 00821 int *rightHasBounds = 0, 00822 int *leftHasBounds = 0, 00823 int hasBoundsTag = 288402, 00824 int localBoundsTag = 288403, 00825 int globalBoundsTag = 288404); 00827 //ETX 00828 00830 00833 static int GetParentProcessor(int pid); 00834 static int GetLeftChildProcessor(int pid); 00836 00838 00841 static int MarshalDataObject(vtkDataObject *object, vtkCharArray *buffer); 00842 static int UnMarshalDataObject(vtkCharArray *buffer, vtkDataObject *object); 00844 00845 protected: 00846 00847 int WriteDataArray(vtkDataArray *object); 00848 int ReadDataArray(vtkDataArray *object); 00849 00850 vtkCommunicator(); 00851 ~vtkCommunicator(); 00852 00853 // Internal methods called by Send/Receive(vtkDataObject *... ) above. 00854 int SendElementalDataObject(vtkDataObject* data, int remoteHandle, int tag); 00855 int SendMultiBlockDataSet(vtkMultiBlockDataSet* data, int remoteHandle, int tag); 00856 int SendTemporalDataSet(vtkTemporalDataSet* data, int remoteHandle, int tag); 00857 int ReceiveDataObject(vtkDataObject* data, 00858 int remoteHandle, int tag, int type=-1); 00859 int ReceiveElementalDataObject(vtkDataObject* data, 00860 int remoteHandle, int tag); 00861 int ReceiveMultiBlockDataSet( 00862 vtkMultiBlockDataSet* data, int remoteHandle, int tag); 00863 int ReceiveTemporalDataSet( 00864 vtkTemporalDataSet* data, int remoteHandle, int tag); 00865 00866 int MaximumNumberOfProcesses; 00867 int NumberOfProcesses; 00868 00869 int LocalProcessId; 00870 00871 static int UseCopy; 00872 00873 vtkIdType Count; 00874 00875 private: 00876 vtkCommunicator(const vtkCommunicator&); // Not implemented. 00877 void operator=(const vtkCommunicator&); // Not implemented. 00878 }; 00879 00880 #endif // __vtkCommunicator_h 00881 00882