00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00048 #ifndef __vtkMPIController_h
00049 #define __vtkMPIController_h
00050 
00051 #include "vtkMultiProcessController.h"
00052 
00053 
00054 
00055 #include "vtkMPICommunicator.h" 
00056 
00057 class VTK_PARALLEL_EXPORT vtkMPIController : public vtkMultiProcessController
00058 {
00059 
00060 public:
00061 
00062   static vtkMPIController *New();
00063   vtkTypeRevisionMacro(vtkMPIController,vtkMultiProcessController);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067 
00075   virtual void Initialize(int* argc, char*** argv) 
00076     { this->Initialize(argc, argv, 0); }
00078 
00079   virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv),
00080                           int initializedExternally);
00081 
00084   virtual void Finalize() { this->Finalize(0); }
00085 
00086   virtual void Finalize(int finalizedExternally);
00087 
00090   virtual void SingleMethodExecute();
00091   
00095   virtual void MultipleMethodExecute();
00096 
00099   void Barrier();
00100 
00103   virtual void CreateOutputWindow();
00104 
00107   static char* ErrorString(int err);
00108 
00109 
00115   void SetCommunicator(vtkMPICommunicator* comm);
00116 
00117 
00118 
00120 
00125   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00126                   vtkMPICommunicator::Request& req)
00127     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00128         (data ,length, remoteProcessId, tag, req); }
00129   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00130                   int tag, vtkMPICommunicator::Request& req)
00131     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00132         (data, length, remoteProcessId, tag, req); }
00133   int NoBlockSend(char* data, int length, int remoteProcessId, 
00134                   int tag, vtkMPICommunicator::Request& req)
00135     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00136         (data, length, remoteProcessId, tag, req); }
00137   int NoBlockSend(float* data, int length, int remoteProcessId, 
00138                   int tag, vtkMPICommunicator::Request& req)
00139     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00140         (data, length, remoteProcessId, tag, req); }
00142 
00144 
00148   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00149                      int tag, vtkMPICommunicator::Request& req)
00150     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00151         (data, length, remoteProcessId, tag, req); }
00152   int NoBlockReceive(unsigned long* data, int length, 
00153                      int remoteProcessId, int tag, 
00154                      vtkMPICommunicator::Request& req)
00155     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00156         (data, length, remoteProcessId, tag, req); }
00157   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00158                      int tag, vtkMPICommunicator::Request& req)
00159     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00160         (data, length, remoteProcessId, tag, req); }
00161   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00162                      int tag, vtkMPICommunicator::Request& req)
00163     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00164         (data, length, remoteProcessId, tag, req); }
00166 
00167 
00168 
00169   static const char* GetProcessorName();
00170 
00171 protected:
00172   vtkMPIController();
00173   ~vtkMPIController();
00174 
00175   
00176   
00177   
00178   
00179   int InitializeNumberOfProcesses();
00180 
00181   
00182   void InitializeCommunicator(vtkMPICommunicator* comm);
00183 
00184   
00185   void InitializeRMICommunicator();
00186 
00187   
00188   
00189   
00190   
00191   
00192   static vtkMPICommunicator* WorldRMICommunicator;
00193 
00194   
00195   static int Initialized;
00196 
00197   static char ProcessorName[];
00198 
00199 private:
00200   vtkMPIController(const vtkMPIController&);  
00201   void operator=(const vtkMPIController&);  
00202 };
00203 
00204 
00205 #endif
00206 
00207