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

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