Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkMPICommunicator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMPICommunicator.h,v $
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 =========================================================================*/
00038 #ifndef __vtkMPICommunicator_h
00039 #define __vtkMPICommunicator_h
00040 
00041 #include "vtkCommunicator.h"
00042 
00043 class vtkMPIController;
00044 class vtkMPIGroup;
00045 
00046 class vtkMPICommunicatorOpaqueRequest;
00047 class vtkMPICommunicatorOpaqueComm;
00048 
00049 class VTK_PARALLEL_EXPORT vtkMPICommunicator : public vtkCommunicator
00050 {
00051 public:
00052   vtkTypeRevisionMacro( vtkMPICommunicator,vtkCommunicator);
00053   
00055   static vtkMPICommunicator* New();
00056 
00059   static vtkMPICommunicator* GetWorldCommunicator();
00060   
00061   virtual void PrintSelf(ostream& os, vtkIndent indent);
00062 
00067   int Initialize(vtkMPICommunicator* mpiComm, vtkMPIGroup* group);
00068 
00070 
00072   virtual int Send(int* data, int length, int remoteProcessId, int tag);
00073   virtual int Send(unsigned long* data, int length, int remoteProcessId,
00074                    int tag);
00075   virtual int Send(char* data, int length, int remoteProcessId, int tag);
00076   virtual int Send(unsigned char* data, int length, int remoteProcessId, 
00077                    int tag);
00078   virtual int Send(float* data, int length, int remoteProcessId, 
00079                    int tag);
00080   virtual int Send(double* data, int length, int remoteProcessId, 
00081                    int tag);
00082 #ifdef VTK_USE_64BIT_IDS
00083   virtual int Send(vtkIdType* data, int length, int remoteProcessId, 
00084                    int tag);
00086 #endif
00087   virtual int Send(vtkDataObject* data, int remoteProcessId, int tag)
00088     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00089   virtual int Send(vtkDataArray* data, int remoteProcessId, int tag)
00090     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00091 
00092 //BTX
00093 
00094   class VTK_PARALLEL_EXPORT Request
00095   {
00096   public:
00097     Request();
00098     ~Request();
00099     int Test();
00100     void Cancel();
00101     void Wait();
00102     vtkMPICommunicatorOpaqueRequest* Req;
00103   };
00104 
00105 //ETX
00106 
00108 
00112   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00113                   Request& req);
00114   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00115                   int tag, Request& req);
00116   int NoBlockSend(char* data, int length, int remoteProcessId, 
00117                   int tag, Request& req);
00118   int NoBlockSend(float* data, int length, int remoteProcessId, 
00119                   int tag, Request& req);
00121 
00123 
00125   virtual int Receive(int* data, int length, int remoteProcessId, 
00126                       int tag);
00127   virtual int Receive(unsigned long* data, int length, 
00128                       int remoteProcessId, int tag);
00129   virtual int Receive(char* data, int length, int remoteProcessId, 
00130                       int tag);
00131   virtual int Receive(unsigned char* data, int length, int remoteProcessId, 
00132                       int tag);
00133   virtual int Receive(float* data, int length, int remoteProcessId, 
00134                       int tag);
00135   virtual int Receive(double* data, int length, int remoteProcessId, 
00136                       int tag);
00137 #ifdef VTK_USE_64BIT_IDS
00138   virtual int Receive(vtkIdType* data, int length, int remoteProcessId, 
00139                       int tag);
00141 #endif
00142   virtual int Receive(vtkDataObject* data, int remoteProcessId, int tag)
00143     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00144   virtual int Receive(vtkDataArray* data, int remoteProcessId, int tag)
00145     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00146 
00148 
00151   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00152                      int tag, Request& req);
00153   int NoBlockReceive(unsigned long* data, int length, 
00154                      int remoteProcessId, int tag, Request& req);
00155   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00156                      int tag, Request& req);
00157   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00158                      int tag, Request& req);
00160 
00161 
00163 
00164   int Broadcast(int* data          , int length, int root);
00165   int Broadcast(unsigned long* data, int length, int root);
00166   int Broadcast(char* data         , int length, int root);
00167   int Broadcast(float* data        , int length, int root);
00168   int Broadcast(double* data        , int length, int root);
00170 
00171   
00173 
00175   int Gather(int* data          , int* to          , int length, int root);
00176   int Gather(unsigned long* data, unsigned long* to, int length, int root);
00177   int Gather(char* data         , char* to         , int length, int root);
00178   int Gather(float* data        , float* to        , int length, int root);
00179   int Gather(double* data       , double* to       , int length, int root);
00181 
00183 
00190   int GatherV(int* data, int* to, 
00191               int sendlength, int* recvlengths, int* offsets, int root);
00192   int GatherV(unsigned long* data, unsigned long* to, 
00193               int sendlength, int* recvlengths, int* offsets, int root);
00194   int GatherV(char* data, char* to, 
00195               int sendlength, int* recvlengths, int* offsets, int root);
00196   int GatherV(float* data, float* to, 
00197               int sendlength, int* recvlengths, int* offsets, int root);
00198   int GatherV(double* data, double* to, 
00199               int sendlength, int* recvlengths, int* offsets, int root);
00201 
00202 
00204 
00208   int AllGather(int* data          , int* to          , int length);
00209   int AllGather(unsigned long* data, unsigned long* to, int length);
00210   int AllGather(char* data         , char* to         , int length);
00211   int AllGather(float* data        , float* to        , int length);
00212   int AllGather(double* data       , double* to       , int length);
00214   
00216 
00220   int AllGatherV(int* data, int* to, 
00221                  int sendlength, int* recvlengths, int* recvOffsets);
00222   int AllGatherV(unsigned long* data, unsigned long* to, 
00223                  int sendlength, int* recvlengths, int* recvOffsets);
00224   int AllGatherV(char* data, char* to, 
00225                  int sendlength, int* recvlengths, int* recvOffsets);
00226   int AllGatherV(float* data, float* to, 
00227                  int sendlength, int* recvlengths, int* recvOffsets);
00228   int AllGatherV(double* data, double* to, 
00229                  int sendlength, int* recvlengths, int* recvOffsets);
00231 
00233 
00234   int ReduceMax(int* data, int* to, int size, int root);
00235   int ReduceMax(unsigned long* data, unsigned long* to, int size, int root);
00236   int ReduceMax(float* data, float* to, int size, int root);
00237   int ReduceMax(double* data, double* to, int size, int root);
00239 
00240   int ReduceMin(int* data, int* to, int size, int root);
00241   int ReduceMin(unsigned long* data, unsigned long* to, int size, int root);
00242   int ReduceMin(float* data, float* to, int size, int root);
00243   int ReduceMin(double* data, double* to, int size, int root);
00244 
00245   int ReduceSum(int* data, int* to, int size, int root);
00246   int ReduceSum(unsigned long* data, unsigned long* to, int size, int root);
00247   int ReduceSum(float* data, float* to, int size, int root);
00248   int ReduceSum(double* data, double* to, int size, int root);
00249 
00250   int ReduceAnd(bool* data, bool* to, int size, int root);
00251   int ReduceOr(bool* data, bool* to, int size, int root);
00252 
00253 
00254 //BTX
00255 
00256   friend class vtkMPIController;
00257 
00258   vtkMPICommunicatorOpaqueComm *GetMPIComm()
00259     {
00260     return this->MPIComm;
00261     }
00262 //ETX
00263 
00264   static char* Allocate(size_t size);
00265   static void Free(char* ptr);
00266 
00267 
00268 protected:
00269   vtkMPICommunicator();
00270   ~vtkMPICommunicator();
00271 
00272   virtual void SetGroup(vtkMPIGroup*);
00273 
00275 
00282   vtkSetMacro(KeepHandle, int);
00283   vtkBooleanMacro(KeepHandle, int);
00285 
00286 
00287   static vtkMPICommunicator* WorldCommunicator;
00288 
00289   void InitializeCopy(vtkMPICommunicator* source);
00290 
00295   void CopyFrom(vtkMPICommunicator* source);
00296 
00303   void Duplicate(vtkMPICommunicator* source);
00304 
00305   vtkMPICommunicatorOpaqueComm* MPIComm;
00306   vtkMPIGroup* Group;
00307 
00308   int Initialized;
00309   int KeepHandle;
00310 
00311   static int CheckForMPIError(int err);
00312 
00313 private:
00314   vtkMPICommunicator(const vtkMPICommunicator&);  // Not implemented.
00315   void operator=(const vtkMPICommunicator&);  // Not implemented.
00316 };
00317 
00318 #endif

Generated on Mon Jan 21 23:07:33 2008 for VTK by  doxygen 1.4.3-20050530