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

vtkMPIController.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMPIController.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 =========================================================================*/
00058 #ifndef __vtkMPIController_h
00059 #define __vtkMPIController_h
00060 
00061 #include "vtkMultiProcessController.h"
00062 // Do not remove this header file. This class contains methods
00063 // which take arguments defined in  vtkMPICommunicator.h by
00064 // reference.
00065 #include "vtkMPICommunicator.h" // Needed for direct access to communicator
00066 
00067 class VTK_PARALLEL_EXPORT vtkMPIController : public vtkMultiProcessController
00068 {
00069 
00070 public:
00071 
00072   static vtkMPIController *New();
00073   vtkTypeRevisionMacro(vtkMPIController,vtkMultiProcessController);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00077 
00085   virtual void Initialize(int* argc, char*** argv) 
00086     { this->Initialize(argc, argv, 0); }
00088 
00089   virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv),
00090                           int initializedExternally);
00091 
00094   virtual void Finalize() { this->Finalize(0); }
00095 
00096   virtual void Finalize(int finalizedExternally);
00097 
00100   virtual void SingleMethodExecute();
00101   
00105   virtual void MultipleMethodExecute();
00106 
00109   void Barrier();
00110 
00113   virtual void CreateOutputWindow();
00114 
00117   static char* ErrorString(int err);
00118 
00119 
00125   void SetCommunicator(vtkMPICommunicator* comm);
00126 
00127 //BTX
00128 
00130 
00135   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00136                   vtkMPICommunicator::Request& req)
00137     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00138         (data ,length, remoteProcessId, tag, req); }
00139   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00140                   int tag, vtkMPICommunicator::Request& req)
00141     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00142         (data, length, remoteProcessId, tag, req); }
00143   int NoBlockSend(char* data, int length, int remoteProcessId, 
00144                   int tag, vtkMPICommunicator::Request& req)
00145     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00146         (data, length, remoteProcessId, tag, req); }
00147   int NoBlockSend(float* data, int length, int remoteProcessId, 
00148                   int tag, vtkMPICommunicator::Request& req)
00149     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00150         (data, length, remoteProcessId, tag, req); }
00152 
00154 
00158   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00159                      int tag, vtkMPICommunicator::Request& req)
00160     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00161         (data, length, remoteProcessId, tag, req); }
00162   int NoBlockReceive(unsigned long* data, int length, 
00163                      int remoteProcessId, int tag, 
00164                      vtkMPICommunicator::Request& req)
00165     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00166         (data, length, remoteProcessId, tag, req); }
00167   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00168                      int tag, vtkMPICommunicator::Request& req)
00169     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00170         (data, length, remoteProcessId, tag, req); }
00171   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00172                      int tag, vtkMPICommunicator::Request& req)
00173     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00174         (data, length, remoteProcessId, tag, req); }
00176 
00177 //ETX
00178 
00179   static const char* GetProcessorName();
00180 
00181 protected:
00182   vtkMPIController();
00183   ~vtkMPIController();
00184 
00185   // Given a communicator, obtain size and rank
00186   // setting NumberOfProcesses and LocalProcessId
00187   // Should not be called if the current communicator
00188   // does not include this process
00189   int InitializeNumberOfProcesses();
00190 
00191   // Set the communicator to comm and call InitializeNumberOfProcesses()
00192   void InitializeCommunicator(vtkMPICommunicator* comm);
00193 
00194   // Duplicate the current communicator, creating RMICommunicator
00195   void InitializeRMICommunicator();
00196 
00197   // MPI communicator created when Initialize() called.
00198   // This is a copy of MPI_COMM_WORLD but uses a new
00199   // context, i.e. even if the tags are the same, the
00200   // RMI messages will not interfere with user level
00201   // messages.
00202   static vtkMPICommunicator* WorldRMICommunicator;
00203 
00204   // Initialize only once.
00205   static int Initialized;
00206 
00207   static char ProcessorName[];
00208 
00209 private:
00210   vtkMPIController(const vtkMPIController&);  // Not implemented.
00211   void operator=(const vtkMPIController&);  // Not implemented.
00212 };
00213 
00214 
00215 #endif
00216 
00217