Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Parallel/vtkMPICommunicator.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkMPICommunicator.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00053 #ifndef __vtkMPICommunicator_h
    00054 #define __vtkMPICommunicator_h
    00055
    00056 #include "vtkCommunicator.h"
    00057
    00058 class vtkMPIController;
    00059 class vtkMPIGroup;
    00060
    00061 class vtkMPICommunicatorOpaqueRequest;
    00062 class vtkMPICommunicatorOpaqueComm;
    00063
    00064 class VTK_PARALLEL_EXPORT vtkMPICommunicator : public vtkCommunicator
    00065 {
    00066 public:
    00067   vtkTypeRevisionMacro( vtkMPICommunicator,vtkCommunicator);
    00068
    00070   static vtkMPICommunicator* New();
    00071
    00074   static vtkMPICommunicator* GetWorldCommunicator();
    00075
    00076   virtual void PrintSelf(ostream& os, vtkIndent indent);
    00077
    00082   int Initialize(vtkMPICommunicator* mpiComm, vtkMPIGroup* group);
    00083
    00085
    00087   virtual int Send(int* data, int length, int remoteProcessId, int tag);
    00088   virtual int Send(unsigned long* data, int length, int remoteProcessId,
    00089                    int tag);
    00090   virtual int Send(char* data, int length, int remoteProcessId, int tag);
    00091   virtual int Send(unsigned char* data, int length, int remoteProcessId,
    00092                    int tag);
    00093   virtual int Send(float* data, int length, int remoteProcessId,
    00094                    int tag);
    00095   virtual int Send(double* data, int length, int remoteProcessId,
    00096                    int tag);
    00097 #ifdef VTK_USE_64BIT_IDS
    00098   virtual int Send(vtkIdType* data, int length, int remoteProcessId,
    00099                    int tag);
    00101 #endif
    00102   virtual int Send(vtkDataObject* data, int remoteProcessId, int tag)
    00103     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
    00104   virtual int Send(vtkDataArray* data, int remoteProcessId, int tag)
    00105     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
    00106
    00107 //BTX
    00108
    00109   class VTK_PARALLEL_EXPORT Request
    00110   {
    00111   public:
    00112     Request();
    00113     ~Request();
    00114     int Test();
    00115     void Cancel();
    00116     void Wait();
    00117     vtkMPICommunicatorOpaqueRequest* Req;
    00118   };
    00119
    00120 //ETX
    00121
    00123
    00127   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
    00128                   Request& req);
    00129   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
    00130                   int tag, Request& req);
    00131   int NoBlockSend(char* data, int length, int remoteProcessId,
    00132                   int tag, Request& req);
    00133   int NoBlockSend(float* data, int length, int remoteProcessId,
    00134                   int tag, Request& req);
    00136
    00138
    00140   virtual int Receive(int* data, int length, int remoteProcessId,
    00141                       int tag);
    00142   virtual int Receive(unsigned long* data, int length,
    00143                       int remoteProcessId, int tag);
    00144   virtual int Receive(char* data, int length, int remoteProcessId,
    00145                       int tag);
    00146   virtual int Receive(unsigned char* data, int length, int remoteProcessId,
    00147                       int tag);
    00148   virtual int Receive(float* data, int length, int remoteProcessId,
    00149                       int tag);
    00150   virtual int Receive(double* data, int length, int remoteProcessId,
    00151                       int tag);
    00152 #ifdef VTK_USE_64BIT_IDS
    00153   virtual int Receive(vtkIdType* data, int length, int remoteProcessId,
    00154                       int tag);
    00156 #endif
    00157   virtual int Receive(vtkDataObject* data, int remoteProcessId, int tag)
    00158     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
    00159   virtual int Receive(vtkDataArray* data, int remoteProcessId, int tag)
    00160     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
    00161
    00163
    00166   int NoBlockReceive(int* data, int length, int remoteProcessId,
    00167                      int tag, Request& req);
    00168   int NoBlockReceive(unsigned long* data, int length,
    00169                      int remoteProcessId, int tag, Request& req);
    00170   int NoBlockReceive(char* data, int length, int remoteProcessId,
    00171                      int tag, Request& req);
    00172   int NoBlockReceive(float* data, int length, int remoteProcessId,
    00173                      int tag, Request& req);
    00175
    00176
    00178
    00179   int Broadcast(int* data          , int length, int root);
    00180   int Broadcast(unsigned long* data, int length, int root);
    00181   int Broadcast(char* data         , int length, int root);
    00182   int Broadcast(float* data        , int length, int root);
    00183   int Broadcast(double* data        , int length, int root);
    00185
    00186
    00188
    00190   int Gather(int* data          , int* to          , int length, int root);
    00191   int Gather(unsigned long* data, unsigned long* to, int length, int root);
    00192   int Gather(char* data         , char* to         , int length, int root);
    00193   int Gather(float* data        , float* to        , int length, int root);
    00194   int Gather(double* data       , double* to       , int length, int root);
    00196
    00198
    00205   int GatherV(int* data, int* to,
    00206               int sendlength, int* recvlengths, int* offsets, int root);
    00207   int GatherV(unsigned long* data, unsigned long* to,
    00208               int sendlength, int* recvlengths, int* offsets, int root);
    00209   int GatherV(char* data, char* to,
    00210               int sendlength, int* recvlengths, int* offsets, int root);
    00211   int GatherV(float* data, float* to,
    00212               int sendlength, int* recvlengths, int* offsets, int root);
    00213   int GatherV(double* data, double* to,
    00214               int sendlength, int* recvlengths, int* offsets, int root);
    00216
    00218
    00219   int ReduceMax(int* data, int* to, int size, int root);
    00220   int ReduceMax(long* data, long* to, int size, int root);
    00221   int ReduceMax(float* data, float* to, int size, int root);
    00222   int ReduceMax(double* data, double* to, int size, int root);
    00224
    00225   int ReduceMin(int* data, int* to, int size, int root);
    00226   int ReduceMin(long* data, long* to, int size, int root);
    00227   int ReduceMin(float* data, float* to, int size, int root);
    00228   int ReduceMin(double* data, double* to, int size, int root);
    00229
    00230   int ReduceSum(int* data, int* to, int size, int root);
    00231   int ReduceSum(long* data, long* to, int size, int root);
    00232   int ReduceSum(float* data, float* to, int size, int root);
    00233   int ReduceSum(double* data, double* to, int size, int root);
    00234
    00235   int ReduceAnd(bool* data, bool* to, int size, int root);
    00236   int ReduceOr(bool* data, bool* to, int size, int root);
    00237
    00238
    00239 //BTX
    00240
    00241   friend class vtkMPIController;
    00242
    00243   vtkMPICommunicatorOpaqueComm* GetMPIComm()
    00244     {
    00245       return this->Comm;
    00246     }
    00247
    00248 //ETX
    00249
    00250   static char* Allocate(size_t size);
    00251   static void Free(char* ptr);
    00252
    00253
    00254 protected:
    00255   vtkMPICommunicator();
    00256   ~vtkMPICommunicator();
    00257
    00258   virtual void SetGroup(vtkMPIGroup*);
    00259
    00261
    00268   vtkSetMacro(KeepHandle, int);
    00269   vtkBooleanMacro(KeepHandle, int);
    00271
    00272
    00273   static vtkMPICommunicator* WorldCommunicator;
    00274
    00275   void InitializeCopy(vtkMPICommunicator* source);
    00276
    00281   void CopyFrom(vtkMPICommunicator* source);
    00282
    00289   void Duplicate(vtkMPICommunicator* source);
    00290
    00291   vtkMPICommunicatorOpaqueComm* Comm;
    00292   vtkMPIGroup* Group;
    00293
    00294   int Initialized;
    00295   int KeepHandle;
    00296
    00297   static int CheckForMPIError(int err);
    00298
    00299 private:
    00300   vtkMPICommunicator(const vtkMPICommunicator&);  // Not implemented.
    00301   void operator=(const vtkMPICommunicator&);  // Not implemented.
    00302 };
    00303
    00304
    00305 #endif //  __vtkMPICommunicator_h
    00306
    00307
    00308
    00309