VTK
vtkCommunicator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCommunicator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
34 #ifndef __vtkCommunicator_h
35 #define __vtkCommunicator_h
36 
37 #include "vtkObject.h"
38 
39 class vtkBoundingBox;
40 class vtkCharArray;
41 class vtkDataArray;
42 class vtkDataObject;
43 class vtkDataSet;
44 class vtkImageData;
47 class vtkTemporalDataSet;
48 
50 {
51 
52 public:
53 
54  vtkTypeMacro(vtkCommunicator, vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58 
61  virtual void SetNumberOfProcesses(int num);
62  vtkGetMacro(NumberOfProcesses, int);
64 
66 
67  vtkGetMacro(LocalProcessId, int);
69 
70 //BTX
71 
72  enum Tags
73  {
74  BROADCAST_TAG = 10,
75  GATHER_TAG = 11,
76  GATHERV_TAG = 12,
77  SCATTER_TAG = 13,
78  SCATTERV_TAG = 14,
79  REDUCE_TAG = 15,
80  BARRIER_TAG = 16
81  };
82 
84  {
94  BITWISE_XOR_OP
95  };
96 
98 
100  class Operation
101  {
102  public:
103  // Description:
104  // Subclasses must overload this method, which performs the actual
105  // operations. The methods should first do a reintepret cast of the arrays
106  // to the type suggestsed by \c datatype (which will be one of the VTK type
107  // identifiers like VTK_INT, etc.). Both arrays are considered top be
108  // length entries. The method should perform the operation A*B (where * is
109  // a placeholder for whatever operation is actually performed) and store the
110  // result in B. The operation is assumed to be associative. Commutativity
111  // is specified by the Commutative method.
112  virtual void Function(const void *A, void *B, vtkIdType length,
113  int datatype) = 0;
115 
118  virtual int Commutative() = 0;
119 
120  virtual ~Operation() {}
121  };
122 
123 //ETX
124 
127  int Send(vtkDataObject* data, int remoteHandle, int tag);
128 
131  int Send(vtkDataArray* data, int remoteHandle, int tag);
132 
134 
138  virtual int SendVoidArray(const void *data, vtkIdType length, int type,
139  int remoteHandle, int tag) = 0;
141 
143 
144  int Send(const int* data, vtkIdType length, int remoteHandle, int tag) {
145  return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag);
146  }
147  int Send(const unsigned int* data, vtkIdType length, int remoteHandle, int tag) {
148  return this->SendVoidArray(data, length, VTK_INT, remoteHandle, tag);
149  }
150  int Send(const unsigned long* data, vtkIdType length,
151  int remoteHandle, int tag) {
152  return this->SendVoidArray(data, length,VTK_UNSIGNED_LONG,remoteHandle,tag);
153  }
154  int Send(const unsigned char* data, vtkIdType length,
155  int remoteHandle, int tag) {
156  return this->SendVoidArray(data, length,VTK_UNSIGNED_CHAR,remoteHandle,tag);
157  }
158  int Send(const char* data, vtkIdType length, int remoteHandle, int tag) {
159  return this->SendVoidArray(data, length, VTK_CHAR, remoteHandle, tag);
160  }
161  int Send(const float* data, vtkIdType length, int remoteHandle, int tag) {
162  return this->SendVoidArray(data, length, VTK_FLOAT, remoteHandle, tag);
163  }
164  int Send(const double* data, vtkIdType length, int remoteHandle, int tag) {
165  return this->SendVoidArray(data, length, VTK_DOUBLE, remoteHandle, tag);
166  }
167 #ifdef VTK_USE_64BIT_IDS
168  int Send(const vtkIdType* data, vtkIdType length, int remoteHandle, int tag) {
169  return this->SendVoidArray(data, length, VTK_ID_TYPE, remoteHandle, tag);
170  }
171 #endif
172 //BTX
173  int Send(const vtkMultiProcessStream& stream, int remoteId, int tag);
174 //ETX
176 
177 
180  int Receive(vtkDataObject* data, int remoteHandle, int tag);
181 
184  vtkDataObject *ReceiveDataObject(int remoteHandle, int tag);
185 
188  int Receive(vtkDataArray* data, int remoteHandle, int tag);
189 
191 
199  virtual int ReceiveVoidArray(void *data, vtkIdType maxlength, int type,
200  int remoteHandle, int tag) = 0;
202 
204 
205  int Receive(int* data, vtkIdType maxlength, int remoteHandle, int tag) {
206  return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag);
207  }
208  int Receive(unsigned int* data, vtkIdType maxlength, int remoteHandle, int tag) {
209  return this->ReceiveVoidArray(data, maxlength, VTK_INT, remoteHandle, tag);
210  }
211  int Receive(unsigned long* data, vtkIdType maxlength, int remoteHandle, int tag){
212  return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_LONG, remoteHandle,
213  tag);
214  }
215  int Receive(unsigned char* data, vtkIdType maxlength, int remoteHandle, int tag){
216  return this->ReceiveVoidArray(data, maxlength, VTK_UNSIGNED_CHAR, remoteHandle,
217  tag);
218  }
219  int Receive(char* data, vtkIdType maxlength, int remoteHandle, int tag) {
220  return this->ReceiveVoidArray(data, maxlength, VTK_CHAR, remoteHandle, tag);
221  }
222  int Receive(float* data, vtkIdType maxlength, int remoteHandle, int tag) {
223  return this->ReceiveVoidArray(data, maxlength, VTK_FLOAT, remoteHandle, tag);
224  }
225  int Receive(double* data, vtkIdType maxlength, int remoteHandle, int tag) {
226  return this->ReceiveVoidArray(data, maxlength, VTK_DOUBLE, remoteHandle, tag);
227  }
228 #ifdef VTK_USE_64BIT_IDS
229  int Receive(vtkIdType* data, vtkIdType maxlength, int remoteHandle, int tag) {
230  return this->ReceiveVoidArray(data, maxlength, VTK_ID_TYPE, remoteHandle, tag);
231  }
232 #endif
233 //BTX
234  int Receive(vtkMultiProcessStream& stream, int remoteId, int tag);
235 //ETX
237 
239 
246  vtkGetMacro(Count, vtkIdType);
248 
249  //---------------------- Collective Operations ----------------------
250 
253  virtual void Barrier();
254 
256 
259  int Broadcast(int *data, vtkIdType length, int srcProcessId) {
260  return this->BroadcastVoidArray(data, length, VTK_INT, srcProcessId);
261  }
262  int Broadcast(unsigned int *data, vtkIdType length, int srcProcessId) {
263  return this->BroadcastVoidArray(data, length, VTK_UNSIGNED_INT, srcProcessId);
264  }
265  int Broadcast(unsigned long *data, vtkIdType length, int srcProcessId) {
266  return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_LONG,srcProcessId);
267  }
268  int Broadcast(unsigned char *data, vtkIdType length, int srcProcessId) {
269  return this->BroadcastVoidArray(data,length,VTK_UNSIGNED_CHAR,srcProcessId);
270  }
271  int Broadcast(char *data, vtkIdType length, int srcProcessId) {
272  return this->BroadcastVoidArray(data, length, VTK_CHAR, srcProcessId);
273  }
274  int Broadcast(float *data, vtkIdType length, int srcProcessId) {
275  return this->BroadcastVoidArray(data, length, VTK_FLOAT, srcProcessId);
276  }
277  int Broadcast(double *data, vtkIdType length, int srcProcessId) {
278  return this->BroadcastVoidArray(data, length, VTK_DOUBLE, srcProcessId);
279  }
280 #ifdef VTK_USE_64BIT_IDS
281  int Broadcast(vtkIdType *data, vtkIdType length, int srcProcessId) {
282  return this->BroadcastVoidArray(data, length, VTK_ID_TYPE, srcProcessId);
283  }
284 #endif
285  int Broadcast(vtkDataObject *data, int srcProcessId);
286  int Broadcast(vtkDataArray *data, int srcProcessId);
287 //BTX
288  int Broadcast(vtkMultiProcessStream& stream, int srcProcessId);
289 //ETX
291 
293 
301  int Gather(const int *sendBuffer, int *recvBuffer,
302  vtkIdType length, int destProcessId) {
303  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
304  VTK_INT, destProcessId);
305  }
306  int Gather(const unsigned long *sendBuffer, unsigned long *recvBuffer,
307  vtkIdType length, int destProcessId) {
308  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
309  VTK_UNSIGNED_LONG, destProcessId);
310  }
311  int Gather(const unsigned char *sendBuffer, unsigned char *recvBuffer,
312  vtkIdType length, int destProcessId) {
313  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
314  VTK_UNSIGNED_CHAR, destProcessId);
315  }
316  int Gather(const char *sendBuffer, char *recvBuffer,
317  vtkIdType length, int destProcessId) {
318  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
319  VTK_CHAR, destProcessId);
320  }
321  int Gather(const float *sendBuffer, float *recvBuffer,
322  vtkIdType length, int destProcessId) {
323  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
324  VTK_FLOAT, destProcessId);
325  }
326  int Gather(const double *sendBuffer, double *recvBuffer,
327  vtkIdType length, int destProcessId) {
328  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
329  VTK_DOUBLE, destProcessId);
330  }
331 #ifdef VTK_USE_64BIT_IDS
332  int Gather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
333  vtkIdType length, int destProcessId) {
334  return this->GatherVoidArray(sendBuffer, recvBuffer, length,
335  VTK_ID_TYPE, destProcessId);
336  }
337 #endif
338  int Gather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
339  int destProcessId);
341 
343 
353  int GatherV(const int* sendBuffer, int* recvBuffer,
354  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
355  int destProcessId) {
356  return this->GatherVVoidArray(sendBuffer, recvBuffer,
357  sendLength, recvLengths,
358  offsets, VTK_INT, destProcessId);
359  }
360  int GatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
361  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
362  int destProcessId) {
363  return this->GatherVVoidArray(sendBuffer, recvBuffer,
364  sendLength, recvLengths,
365  offsets, VTK_UNSIGNED_LONG, destProcessId);
366  }
367  int GatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
368  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
369  int destProcessId) {
370  return this->GatherVVoidArray(sendBuffer, recvBuffer,
371  sendLength, recvLengths,
372  offsets, VTK_UNSIGNED_CHAR, destProcessId);
373  }
374  int GatherV(const char* sendBuffer, char* recvBuffer,
375  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
376  int destProcessId) {
377  return this->GatherVVoidArray(sendBuffer, recvBuffer,
378  sendLength, recvLengths,
379  offsets, VTK_CHAR, destProcessId);
380  }
381  int GatherV(const float* sendBuffer, float* recvBuffer,
382  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
383  int destProcessId) {
384  return this->GatherVVoidArray(sendBuffer, recvBuffer,
385  sendLength, recvLengths,
386  offsets, VTK_FLOAT, destProcessId);
387  }
388  int GatherV(const double* sendBuffer, double* recvBuffer,
389  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
390  int destProcessId) {
391  return this->GatherVVoidArray(sendBuffer, recvBuffer,
392  sendLength, recvLengths,
393  offsets, VTK_DOUBLE, destProcessId);
394  }
395 #ifdef VTK_USE_64BIT_IDS
396  int GatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
397  vtkIdType sendLength, vtkIdType* recvLengths, vtkIdType* offsets,
398  int destProcessId) {
399  return this->GatherVVoidArray(sendBuffer, recvBuffer,
400  sendLength, recvLengths,
401  offsets, VTK_ID_TYPE, destProcessId);
402  }
403 #endif
404  int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
405  vtkIdType *recvLengths, vtkIdType *offsets, int destProcessId);
406  int GatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
407  int destProcessId);
409 
411 
416  int Scatter(const int *sendBuffer, int *recvBuffer,
417  vtkIdType length, int srcProcessId) {
418  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
419  VTK_INT, srcProcessId);
420  }
421  int Scatter(const unsigned long *sendBuffer, unsigned long *recvBuffer,
422  vtkIdType length, int srcProcessId) {
423  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
424  VTK_UNSIGNED_LONG, srcProcessId);
425  }
426  int Scatter(const unsigned char *sendBuffer, unsigned char *recvBuffer,
427  vtkIdType length, int srcProcessId) {
428  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
429  VTK_UNSIGNED_CHAR, srcProcessId);
430  }
431  int Scatter(const char *sendBuffer, char *recvBuffer,
432  vtkIdType length, int srcProcessId) {
433  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
434  VTK_CHAR, srcProcessId);
435  }
436  int Scatter(const float *sendBuffer, float *recvBuffer,
437  vtkIdType length, int srcProcessId) {
438  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
439  VTK_FLOAT, srcProcessId);
440  }
441  int Scatter(const double *sendBuffer, double *recvBuffer,
442  vtkIdType length, int srcProcessId) {
443  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
444  VTK_DOUBLE, srcProcessId);
445  }
446 #ifdef VTK_USE_64BIT_IDS
447  int Scatter(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
448  vtkIdType length, int srcProcessId) {
449  return this->ScatterVoidArray(sendBuffer, recvBuffer, length,
450  VTK_ID_TYPE, srcProcessId);
451  }
452 #endif
453  int Scatter(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
454  int srcProcessId);
456 
458 
464  int ScatterV(const int *sendBuffer, int *recvBuffer,
465  vtkIdType *sendLengths, vtkIdType *offsets,
466  vtkIdType recvLength, int srcProcessId) {
467  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
468  sendLengths, offsets, recvLength,
469  VTK_INT, srcProcessId);
470  }
471  int ScatterV(const unsigned long *sendBuffer, unsigned long *recvBuffer,
472  vtkIdType *sendLengths, vtkIdType *offsets,
473  vtkIdType recvLength, int srcProcessId) {
474  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
475  sendLengths, offsets, recvLength,
476  VTK_UNSIGNED_LONG, srcProcessId);
477  }
478  int ScatterV(const unsigned char *sendBuffer, unsigned char *recvBuffer,
479  vtkIdType *sendLengths, vtkIdType *offsets,
480  vtkIdType recvLength, int srcProcessId) {
481  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
482  sendLengths, offsets, recvLength,
483  VTK_UNSIGNED_CHAR, srcProcessId);
484  }
485  int ScatterV(const char *sendBuffer, char *recvBuffer,
486  vtkIdType *sendLengths, vtkIdType *offsets,
487  vtkIdType recvLength, int srcProcessId) {
488  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
489  sendLengths, offsets, recvLength,
490  VTK_CHAR, srcProcessId);
491  }
492  int ScatterV(const float *sendBuffer, float *recvBuffer,
493  vtkIdType *sendLengths, vtkIdType *offsets,
494  vtkIdType recvLength, int srcProcessId) {
495  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
496  sendLengths, offsets, recvLength,
497  VTK_FLOAT, srcProcessId);
498  }
499  int ScatterV(const double *sendBuffer, double *recvBuffer,
500  vtkIdType *sendLengths, vtkIdType *offsets,
501  vtkIdType recvLength, int srcProcessId) {
502  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
503  sendLengths, offsets, recvLength,
504  VTK_DOUBLE, srcProcessId);
505  }
506 #ifdef VTK_USE_64BIT_IDS
507  int ScatterV(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
508  vtkIdType *sendLengths, vtkIdType *offsets,
509  vtkIdType recvLength, int srcProcessId) {
510  return this->ScatterVVoidArray(sendBuffer, recvBuffer,
511  sendLengths, offsets, recvLength,
512  VTK_ID_TYPE, srcProcessId);
513  }
514 #endif
515 
516 
518 
519  int AllGather(const int *sendBuffer, int *recvBuffer, vtkIdType length) {
520  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_INT);
521  }
522  int AllGather(const unsigned long *sendBuffer,
523  unsigned long *recvBuffer, vtkIdType length) {
524  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
526  }
527  int AllGather(const unsigned char *sendBuffer,
528  unsigned char *recvBuffer, vtkIdType length) {
529  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
531  }
532  int AllGather(const char *sendBuffer, char *recvBuffer, vtkIdType length) {
533  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_CHAR);
534  }
535  int AllGather(const float *sendBuffer, float *recvBuffer, vtkIdType length) {
536  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_FLOAT);
537  }
538  int AllGather(const double *sendBuffer,
539  double *recvBuffer, vtkIdType length) {
540  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length, VTK_DOUBLE);
541  }
542 #ifdef VTK_USE_64BIT_IDS
543  int AllGather(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
544  vtkIdType length) {
545  return this->AllGatherVoidArray(sendBuffer, recvBuffer, length,
546  VTK_ID_TYPE);
547  }
548 #endif
549  int AllGather(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer);
551 
553 
554  int AllGatherV(const int* sendBuffer, int* recvBuffer,
555  vtkIdType sendLength, vtkIdType* recvLengths,
556  vtkIdType* offsets) {
557  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
558  sendLength, recvLengths,
559  offsets, VTK_INT);
560  }
561  int AllGatherV(const unsigned long* sendBuffer, unsigned long* recvBuffer,
562  vtkIdType sendLength, vtkIdType* recvLengths,
563  vtkIdType* offsets) {
564  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
565  sendLength, recvLengths,
566  offsets, VTK_UNSIGNED_LONG);
567  }
568  int AllGatherV(const unsigned char* sendBuffer, unsigned char* recvBuffer,
569  vtkIdType sendLength, vtkIdType* recvLengths,
570  vtkIdType* offsets) {
571  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
572  sendLength, recvLengths,
573  offsets, VTK_UNSIGNED_CHAR);
574  }
575  int AllGatherV(const char* sendBuffer, char* recvBuffer,
576  vtkIdType sendLength, vtkIdType* recvLengths,
577  vtkIdType* offsets) {
578  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
579  sendLength, recvLengths,
580  offsets, VTK_CHAR);
581  }
582  int AllGatherV(const float* sendBuffer, float* recvBuffer,
583  vtkIdType sendLength, vtkIdType* recvLengths,
584  vtkIdType* offsets) {
585  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
586  sendLength, recvLengths,
587  offsets, VTK_FLOAT);
588  }
589  int AllGatherV(const double* sendBuffer, double* recvBuffer,
590  vtkIdType sendLength, vtkIdType* recvLengths,
591  vtkIdType* offsets) {
592  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
593  sendLength, recvLengths,
594  offsets, VTK_DOUBLE);
595  }
596 #ifdef VTK_USE_64BIT_IDS
597  int AllGatherV(const vtkIdType* sendBuffer, vtkIdType* recvBuffer,
598  vtkIdType sendLength, vtkIdType* recvLengths,
599  vtkIdType* offsets) {
600  return this->AllGatherVVoidArray(sendBuffer, recvBuffer,
601  sendLength, recvLengths,
602  offsets, VTK_ID_TYPE);
603  }
604 #endif
605  int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
606  vtkIdType *recvLengths, vtkIdType *offsets);
607  int AllGatherV(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer);
609 
611 
614  int Reduce(const int *sendBuffer, int *recvBuffer,
615  vtkIdType length, int operation, int destProcessId) {
616  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
617  VTK_INT, operation, destProcessId);
618  }
619  int Reduce(const unsigned int *sendBuffer, unsigned int *recvBuffer,
620  vtkIdType length, int operation, int destProcessId) {
621  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
622  VTK_UNSIGNED_INT, operation, destProcessId);
623  }
624  int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
625  vtkIdType length, int operation, int destProcessId) {
626  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
627  VTK_UNSIGNED_LONG, operation, destProcessId);
628  }
629  int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
630  vtkIdType length, int operation, int destProcessId) {
631  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
632  VTK_UNSIGNED_CHAR, operation, destProcessId);
633  }
634  int Reduce(const char *sendBuffer, char *recvBuffer,
635  vtkIdType length, int operation, int destProcessId) {
636  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
637  VTK_CHAR, operation, destProcessId);
638  }
639  int Reduce(const float *sendBuffer, float *recvBuffer,
640  vtkIdType length, int operation, int destProcessId) {
641  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
642  VTK_FLOAT, operation, destProcessId);
643  }
644  int Reduce(const double *sendBuffer, double *recvBuffer,
645  vtkIdType length, int operation, int destProcessId) {
646  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
647  VTK_DOUBLE, operation, destProcessId);
648  }
649 #ifdef VTK_USE_64BIT_IDS
650  int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
651  vtkIdType length, int operation, int destProcessId) {
652  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
653  VTK_ID_TYPE, operation, destProcessId);
654  }
655 #endif
656  int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
657  int operation, int destProcessId);
659 
661 
664  int Reduce(const int *sendBuffer, int *recvBuffer,
665  vtkIdType length, Operation *operation, int destProcessId) {
666  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
667  VTK_INT, operation, destProcessId);
668  }
669  int Reduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
670  vtkIdType length, Operation *operation, int destProcessId) {
671  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
672  VTK_UNSIGNED_LONG, operation, destProcessId);
673  }
674  int Reduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
675  vtkIdType length, Operation *operation, int destProcessId) {
676  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
677  VTK_UNSIGNED_CHAR, operation, destProcessId);
678  }
679  int Reduce(const char *sendBuffer, char *recvBuffer,
680  vtkIdType length, Operation *operation, int destProcessId) {
681  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
682  VTK_CHAR, operation, destProcessId);
683  }
684  int Reduce(const float *sendBuffer, float *recvBuffer,
685  vtkIdType length, Operation *operation, int destProcessId) {
686  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
687  VTK_FLOAT, operation, destProcessId);
688  }
689  int Reduce(const double *sendBuffer, double *recvBuffer,
690  vtkIdType length, Operation *operation, int destProcessId) {
691  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
692  VTK_DOUBLE, operation, destProcessId);
693  }
694 #ifdef VTK_USE_64BIT_IDS
695  int Reduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
696  vtkIdType length, Operation *operation, int destProcessId) {
697  return this->ReduceVoidArray(sendBuffer, recvBuffer, length,
698  VTK_ID_TYPE, operation, destProcessId);
699  }
700 #endif
701  int Reduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
702  Operation *operation, int destProcessId);
704 
706 
708  int AllReduce(const int *sendBuffer, int *recvBuffer,
709  vtkIdType length, int operation) {
710  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
711  VTK_INT, operation);
712  }
713  int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
714  vtkIdType length, int operation) {
715  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
716  VTK_UNSIGNED_LONG, operation);
717  }
718  int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
719  vtkIdType length, int operation) {
720  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
721  VTK_UNSIGNED_CHAR, operation);
722  }
723  int AllReduce(const char *sendBuffer, char *recvBuffer,
724  vtkIdType length, int operation) {
725  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
726  VTK_CHAR, operation);
727  }
728  int AllReduce(const float *sendBuffer, float *recvBuffer,
729  vtkIdType length, int operation) {
730  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
731  VTK_FLOAT, operation);
732  }
733  int AllReduce(const double *sendBuffer, double *recvBuffer,
734  vtkIdType length, int operation) {
735  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
736  VTK_DOUBLE, operation);
737  }
738 #ifdef VTK_USE_64BIT_IDS
739  int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
740  vtkIdType length, int operation) {
741  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
742  VTK_ID_TYPE, operation);
743  }
744 #endif
745  int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
746  int operation);
747  int AllReduce(const int *sendBuffer, int *recvBuffer,
748  vtkIdType length, Operation *operation) {
749  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
750  VTK_INT, operation);
751  }
752  int AllReduce(const unsigned long *sendBuffer, unsigned long *recvBuffer,
753  vtkIdType length, Operation *operation) {
754  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
755  VTK_UNSIGNED_LONG, operation);
756  }
757  int AllReduce(const unsigned char *sendBuffer, unsigned char *recvBuffer,
758  vtkIdType length, Operation *operation) {
759  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
760  VTK_UNSIGNED_CHAR, operation);
761  }
762  int AllReduce(const char *sendBuffer, char *recvBuffer,
763  vtkIdType length, Operation *operation) {
764  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
765  VTK_CHAR, operation);
766  }
767  int AllReduce(const float *sendBuffer, float *recvBuffer,
768  vtkIdType length, Operation *operation) {
769  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
770  VTK_FLOAT, operation);
771  }
772  int AllReduce(const double *sendBuffer, double *recvBuffer,
773  vtkIdType length, Operation *operation) {
774  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
775  VTK_DOUBLE, operation);
776  }
777 #ifdef VTK_USE_64BIT_IDS
778  int AllReduce(const vtkIdType *sendBuffer, vtkIdType *recvBuffer,
779  vtkIdType length, Operation *operation) {
780  return this->AllReduceVoidArray(sendBuffer, recvBuffer, length,
781  VTK_ID_TYPE, operation);
782  }
783 #endif
784  int AllReduce(vtkDataArray *sendBuffer, vtkDataArray *recvBuffer,
785  Operation *operation);
787 
789 
791  virtual int BroadcastVoidArray(void *data, vtkIdType length, int type,
792  int srcProcessId);
793  virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer,
794  vtkIdType length, int type, int destProcessId);
795  virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer,
796  vtkIdType sendLength, vtkIdType *recvLengths,
797  vtkIdType *offsets, int type, int destProcessId);
798  virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer,
799  vtkIdType length, int type, int srcProcessId);
800  virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer,
801  vtkIdType *sendLengths, vtkIdType *offsets,
802  vtkIdType recvLength, int type,
803  int srcProcessId);
804  virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer,
805  vtkIdType length, int type);
806  virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer,
807  vtkIdType sendLength, vtkIdType *recvLengths,
808  vtkIdType *offsets, int type);
809  virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
810  vtkIdType length, int type,
811  int operation, int destProcessId);
812  virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
813  vtkIdType length, int type,
814  Operation *operation, int destProcessId);
815  virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
816  vtkIdType length, int type,
817  int operation);
818  virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
819  vtkIdType length, int type,
820  Operation *operation);
822 
823  static void SetUseCopy(int useCopy);
824 
825 //BTX
827 
835  virtual int ComputeGlobalBounds(int processorId, int numProcesses,
836  vtkBoundingBox *bounds,
837  int *rightHasBounds = 0,
838  int *leftHasBounds = 0,
839  int hasBoundsTag = 288402,
840  int localBoundsTag = 288403,
841  int globalBoundsTag = 288404);
842 //ETX
844 
846 
849  static int GetParentProcessor(int pid);
850  static int GetLeftChildProcessor(int pid);
852 
854 
857  static int MarshalDataObject(vtkDataObject *object, vtkCharArray *buffer);
858  static int UnMarshalDataObject(vtkCharArray *buffer, vtkDataObject *object);
860 
861 protected:
862 
863  int WriteDataArray(vtkDataArray *object);
864  int ReadDataArray(vtkDataArray *object);
865 
866  vtkCommunicator();
867  ~vtkCommunicator();
868 
869  // Internal methods called by Send/Receive(vtkDataObject *... ) above.
870  int SendElementalDataObject(vtkDataObject* data, int remoteHandle, int tag);
871  int SendMultiBlockDataSet(vtkMultiBlockDataSet* data, int remoteHandle, int tag);
872  int SendTemporalDataSet(vtkTemporalDataSet* data, int remoteHandle, int tag);
873  int ReceiveDataObject(vtkDataObject* data,
874  int remoteHandle, int tag, int type=-1);
875  int ReceiveElementalDataObject(vtkDataObject* data,
876  int remoteHandle, int tag);
877  int ReceiveMultiBlockDataSet(
878  vtkMultiBlockDataSet* data, int remoteHandle, int tag);
879  int ReceiveTemporalDataSet(
880  vtkTemporalDataSet* data, int remoteHandle, int tag);
881 
884 
886 
887  static int UseCopy;
888 
890 
891 private:
892  vtkCommunicator(const vtkCommunicator&); // Not implemented.
893  void operator=(const vtkCommunicator&); // Not implemented.
894 };
895 
896 #endif // __vtkCommunicator_h
897 
898