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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00075 #ifndef __vtkMPIController_h
00076 #define __vtkMPIController_h
00077 
00078 #include "mpi.h"
00079 
00080 #include "vtkMultiProcessController.h"
00081 #include "vtkMPICommunicator.h"
00082 
00083 
00084 class VTK_PARALLEL_EXPORT vtkMPIController : public vtkMultiProcessController
00085 {
00086 
00087 public:
00088 
00089   static vtkMPIController *New();
00090   vtkTypeMacro(vtkMPIController,vtkMultiProcessController);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00101   virtual void Initialize(int* argc, char*** arcv);
00102 
00105   virtual void Finalize();
00106 
00109   virtual void SingleMethodExecute();
00110   
00114   virtual void MultipleMethodExecute();
00115 
00118   void Barrier();
00119 
00122   virtual void CreateOutputWindow();
00123 
00126   static char* ErrorString(int err);
00127 
00128 
00134   void SetCommunicator(vtkMPICommunicator* comm);
00135 
00136 //BTX
00137 
00139 
00144   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00145                   vtkMPICommunicator::Request& req)
00146     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00147         (data ,length, remoteProcessId, tag, req); }
00148   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00149                   int tag, vtkMPICommunicator::Request& req)
00150     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00151         (data, length, remoteProcessId, tag, req); }
00152   int NoBlockSend(char* data, int length, int remoteProcessId, 
00153                   int tag, vtkMPICommunicator::Request& req)
00154     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00155         (data, length, remoteProcessId, tag, req); }
00156   int NoBlockSend(float* data, int length, int remoteProcessId, 
00157                   int tag, vtkMPICommunicator::Request& req)
00158     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend
00159         (data, length, remoteProcessId, tag, req); }
00161 
00163 
00167   int NoBlockReceive(int* 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(unsigned long* data, int length, 
00172                      int remoteProcessId, int tag, 
00173                      vtkMPICommunicator::Request& req)
00174     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00175         (data, length, remoteProcessId, tag, req); }
00176   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00177                      int tag, vtkMPICommunicator::Request& req)
00178     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00179         (data, length, remoteProcessId, tag, req); }
00180   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00181                      int tag, vtkMPICommunicator::Request& req)
00182     { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive
00183         (data, length, remoteProcessId, tag, req); }
00185 
00186 //ETX
00187 
00188 protected:
00189 
00190   vtkMPIController();
00191   ~vtkMPIController();
00192 
00193   // Given a communicator, obtain size and rank
00194   // setting NumberOfProcesses and LocalProcessId
00195   // Should not be called if the current communicator
00196   // does not include this process
00197   int InitializeNumberOfProcesses();
00198 
00199   // Set the communicator to comm and call InitializeNumberOfProcesses()
00200   void InitializeCommunicator(vtkMPICommunicator* comm);
00201 
00202   // Duplicate the current communicator, creating RMICommunicator
00203   void InitializeRMICommunicator();
00204 
00205   // MPI communicator created when Initialize() called.
00206   // This is a copy of MPI_COMM_WORLD but uses a new
00207   // context, i.e. even if the tags are the same, the
00208   // RMI messages will not interfere with user level
00209   // messages.
00210   static vtkMPICommunicator* WorldRMICommunicator;
00211 
00212   // Initialize only once.
00213   static int Initialized;
00214 
00215 
00216 private:
00217   vtkMPIController(const vtkMPIController&);  // Not implemented.
00218   void operator=(const vtkMPIController&);  // Not implemented.
00219 };
00220 
00221 
00222 #endif
00223 
00224 

Generated on Thu Mar 28 14:19:29 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001