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   vtkTypeMacro(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 Initialize();
00085 
00088   virtual void Finalize() { this->Finalize(0); }
00089 
00090   virtual void Finalize(int finalizedExternally);
00091 
00094   virtual void SingleMethodExecute();
00095   
00099   virtual void MultipleMethodExecute();
00100 
00103   virtual void CreateOutputWindow();
00104 
00107   static char* ErrorString(int err);
00108 
00109 
00115   void SetCommunicator(vtkMPICommunicator* comm);
00116 
00117   virtual vtkMPIController *CreateSubController(vtkProcessGroup *group);
00118 
00119   virtual vtkMPIController *PartitionController(int localColor, int localKey);
00120 
00121 
00122 
00124 
00129   int NoBlockSend(const int* data, int length, int remoteProcessId, int tag,
00130                   vtkMPICommunicator::Request& req)
00131     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00132         (data ,length, remoteProcessId, tag, req); }
00133   int NoBlockSend(const unsigned long* 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(const char* data, int length, int remoteProcessId, 
00138                   int tag, vtkMPICommunicator::Request& req)
00139     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00140         (data, length, remoteProcessId, tag, req); }
00141   int NoBlockSend(const float* data, int length, int remoteProcessId, 
00142                   int tag, vtkMPICommunicator::Request& req)
00143     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00144         (data, length, remoteProcessId, tag, req); }
00146 
00148 
00152   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00153                      int tag, vtkMPICommunicator::Request& req)
00154     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00155         (data, length, remoteProcessId, tag, req); }
00156   int NoBlockReceive(unsigned long* data, int length, 
00157                      int remoteProcessId, int tag, 
00158                      vtkMPICommunicator::Request& req)
00159     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00160         (data, length, remoteProcessId, tag, req); }
00161   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00162                      int tag, vtkMPICommunicator::Request& req)
00163     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00164         (data, length, remoteProcessId, tag, req); }
00165   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00166                      int tag, vtkMPICommunicator::Request& req)
00167     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00168         (data, length, remoteProcessId, tag, req); }
00169 #ifdef VTK_USE_64BIT_IDS
00170   int NoBlockReceive(vtkIdType* data, int length, int remoteProcessId, 
00171                      int tag, vtkMPICommunicator::Request& req)
00172     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00173         (data, length, remoteProcessId, tag, req); }
00174 #endif
00175 
00176 
00177 
00178 
00179   static const char* GetProcessorName();
00180 
00182 
00184   static void SetUseSsendForRMI(int use_send)
00185     { vtkMPIController::UseSsendForRMI = (use_send != 0)? 1: 0; }
00186   static int GetUseSsendForRMI() { return vtkMPIController::UseSsendForRMI; }
00187 
00188 protected:
00189   vtkMPIController();
00190   ~vtkMPIController();
00192 
00193   
00194   void InitializeCommunicator(vtkMPICommunicator* comm);
00195 
00196   
00197   void InitializeRMICommunicator();
00198 
00200 
00203   virtual void TriggerRMIInternal(int remoteProcessId, 
00204     void* arg, int argLength, int rmiTag, bool propagate);
00206 
00207   
00208   
00209   
00210   
00211   
00212   static vtkMPICommunicator* WorldRMICommunicator;
00213 
00214   friend class vtkMPIOutputWindow;
00215 
00216   
00217   static int Initialized;
00218 
00219   static char ProcessorName[];
00220 
00222 
00223   static int UseSsendForRMI;
00224 private:
00225   vtkMPIController(const vtkMPIController&);  
00226   void operator=(const vtkMPIController&);  
00227 
00228 };
00230 
00231 
00232 #endif
00233 
00234