00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00066 #ifndef __vtkMPICommunicator_h
00067 #define __vtkMPICommunicator_h
00068
00069 #include "mpi.h"
00070 #include "vtkCommunicator.h"
00071 #include "vtkMPIGroup.h"
00072
00073 class vtkMPIController;
00074
00075 class VTK_PARALLEL_EXPORT vtkMPICommunicator : public vtkCommunicator
00076 {
00077
00078 public:
00079
00080 vtkTypeMacro( vtkMPICommunicator,vtkObject);
00081
00083 static vtkMPICommunicator* New();
00084
00087 static vtkMPICommunicator* GetWorldCommunicator();
00088
00089 virtual void PrintSelf(ostream& os, vtkIndent indent);
00090
00095 int Initialize(vtkMPICommunicator* mpiComm, vtkMPIGroup* group);
00096
00098
00100 virtual int Send(int* data, int length, int remoteProcessId, int tag);
00101 virtual int Send(unsigned long* data, int length, int remoteProcessId,
00102 int tag);
00103 virtual int Send(char* data, int length, int remoteProcessId, int tag);
00104 virtual int Send(unsigned char* data, int length, int remoteProcessId, int tag);
00105 virtual int Send(float* data, int length, int remoteProcessId,
00106 int tag);
00107 virtual int Send(double* data, int length, int remoteProcessId,
00108 int tag);
00109 #ifdef VTK_USE_64BIT_IDS
00110 virtual int Send(vtkIdType* data, int length, int remoteProcessId,
00111 int tag);
00113 #endif
00114 virtual int Send(vtkDataObject* data, int remoteProcessId, int tag)
00115 { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00116 virtual int Send(vtkDataArray* data, int remoteProcessId, int tag)
00117 { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00118
00119
00120
00121 class VTK_PARALLEL_EXPORT Request
00122 {
00123 public:
00124 int Test();
00125 void Cancel();
00126 void Wait();
00127 MPI_Request Req;
00128 };
00129
00130
00131
00133
00137 int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00138 Request& req);
00139 int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00140 int tag, Request& req);
00141 int NoBlockSend(char* data, int length, int remoteProcessId,
00142 int tag, Request& req);
00143 int NoBlockSend(float* data, int length, int remoteProcessId,
00144 int tag, Request& req);
00146
00148
00150 virtual int Receive(int* data, int length, int remoteProcessId,
00151 int tag);
00152 virtual int Receive(unsigned long* data, int length,
00153 int remoteProcessId, int tag);
00154 virtual int Receive(char* data, int length, int remoteProcessId,
00155 int tag);
00156 virtual int Receive(unsigned char* data, int length, int remoteProcessId,
00157 int tag);
00158 virtual int Receive(float* data, int length, int remoteProcessId,
00159 int tag);
00160 virtual int Receive(double* data, int length, int remoteProcessId,
00161 int tag);
00162 #ifdef VTK_USE_64BIT_IDS
00163 virtual int Receive(vtkIdType* data, int length, int remoteProcessId,
00164 int tag);
00166 #endif
00167 virtual int Receive(vtkDataObject* data, int remoteProcessId, int tag)
00168 { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00169 virtual int Receive(vtkDataArray* data, int remoteProcessId, int tag)
00170 { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00171
00173
00176 int NoBlockReceive(int* data, int length, int remoteProcessId,
00177 int tag, Request& req);
00178 int NoBlockReceive(unsigned long* data, int length,
00179 int remoteProcessId, int tag, Request& req);
00180 int NoBlockReceive(char* data, int length, int remoteProcessId,
00181 int tag, Request& req);
00182 int NoBlockReceive(float* data, int length, int remoteProcessId,
00183 int tag, Request& req);
00185
00186
00187
00188 friend class vtkMPIController;
00189
00190
00191
00192 protected:
00193
00194 vtkSetObjectMacro(Group, vtkMPIGroup);
00195
00197
00204 vtkSetMacro(KeepHandle, int);
00205 vtkBooleanMacro(KeepHandle, int);
00207
00208 static vtkMPICommunicator* WorldCommunicator;
00209
00210 void InitializeCopy(vtkMPICommunicator* source);
00211
00216 void CopyFrom(vtkMPICommunicator* source);
00217
00224 void Duplicate(vtkMPICommunicator* source);
00225
00226 MPI_Comm* Handle;
00227 vtkMPIGroup* Group;
00228
00229 int Initialized;
00230 int KeepHandle;
00231
00232 vtkMPICommunicator();
00233 ~vtkMPICommunicator();
00234
00235 private:
00236 static int CheckForMPIError(int err);
00237
00238 private:
00239 vtkMPICommunicator(const vtkMPICommunicator&);
00240 void operator=(const vtkMPICommunicator&);
00241 };
00242
00243
00244 #endif // __vtkMPICommunicator_h
00245
00246
00247
00248