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

dox/Parallel/vtkMPIController.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMPIController.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00052 #ifndef __vtkMPIController_h
00053 #define __vtkMPIController_h
00054 
00055 #include "vtkMultiProcessController.h"
00056 // Do not remove this header file. This class contains methods
00057 // which take arguments defined in  vtkMPICommunicator.h by
00058 // reference.
00059 #include "vtkMPICommunicator.h" // Needed for direct access to communicator
00060 
00061 class VTK_PARALLEL_EXPORT vtkMPIController : public vtkMultiProcessController
00062 {
00063 
00064 public:
00065 
00066   static vtkMPIController *New();
00067   vtkTypeRevisionMacro(vtkMPIController,vtkMultiProcessController);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00069 
00071 
00079   virtual void Initialize(int* argc, char*** argv) 
00080     { this->Initialize(argc, argv, 0); }
00082 
00083   virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv),
00084                           int initializedExternally);
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   void Barrier();
00104 
00107   virtual void CreateOutputWindow();
00108 
00111   static char* ErrorString(int err);
00112 
00113 
00119   void SetCommunicator(vtkMPICommunicator* comm);
00120 
00121 //BTX
00122 
00124 
00129   int NoBlockSend(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(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(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(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); }
00170 
00171 //ETX
00172 
00173   static const char* GetProcessorName();
00174 
00175 protected:
00176   vtkMPIController();
00177   ~vtkMPIController();
00178 
00179   // Given a communicator, obtain size and rank
00180   // setting NumberOfProcesses and LocalProcessId
00181   // Should not be called if the current communicator
00182   // does not include this process
00183   int InitializeNumberOfProcesses();
00184 
00185   // Set the communicator to comm and call InitializeNumberOfProcesses()
00186   void InitializeCommunicator(vtkMPICommunicator* comm);
00187 
00188   // Duplicate the current communicator, creating RMICommunicator
00189   void InitializeRMICommunicator();
00190 
00191   // MPI communicator created when Initialize() called.
00192   // This is a copy of MPI_COMM_WORLD but uses a new
00193   // context, i.e. even if the tags are the same, the
00194   // RMI messages will not interfere with user level
00195   // messages.
00196   static vtkMPICommunicator* WorldRMICommunicator;
00197 
00198   // Initialize only once.
00199   static int Initialized;
00200 
00201   static char ProcessorName[];
00202 
00203 private:
00204   vtkMPIController(const vtkMPIController&);  // Not implemented.
00205   void operator=(const vtkMPIController&);  // Not implemented.
00206 };
00207 
00208 
00209 #endif
00210 
00211