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

Parallel/vtkMPICommunicator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMPICommunicator.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00066 #ifndef __vtkMPICommunicator_h
00067 #define __vtkMPICommunicator_h
00068 
00069 #include "mpi.h"
00070 #include "vtkCommunicator.h"
00071 #include "vtkMPIGroup.h"
00072 
00073 class vtkMPIController;
00074 
00075 class VTK_PARALLEL_EXPORT vtkMPICommunicator : public vtkCommunicator
00076 {
00077 
00078 public:
00079 
00080   vtkTypeMacro( vtkMPICommunicator,vtkObject);
00081   
00083   static vtkMPICommunicator* New();
00084 
00087   static vtkMPICommunicator* GetWorldCommunicator();
00088   
00089   virtual void PrintSelf(ostream& os, vtkIndent indent);
00090 
00095   int Initialize(vtkMPICommunicator* mpiComm, vtkMPIGroup* group);
00096 
00098 
00100   virtual int Send(int* data, int length, int remoteProcessId, int tag);
00101   virtual int Send(unsigned long* data, int length, int remoteProcessId,
00102                    int tag);
00103   virtual int Send(char* data, int length, int remoteProcessId, int tag);
00104   virtual int Send(unsigned char* data, int length, int remoteProcessId, int tag);
00105   virtual int Send(float* data, int length, int remoteProcessId, 
00106                    int tag);
00107   virtual int Send(double* data, int length, int remoteProcessId, 
00108                    int tag);
00109 #ifdef VTK_USE_64BIT_IDS
00110   virtual int Send(vtkIdType* data, int length, int remoteProcessId, 
00111                    int tag);
00113 #endif
00114   virtual int Send(vtkDataObject* data, int remoteProcessId, int tag)
00115     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00116   virtual int Send(vtkDataArray* data, int remoteProcessId, int tag)
00117     { return this->vtkCommunicator::Send(data, remoteProcessId, tag); }
00118 
00119 //BTX
00120 
00121   class VTK_PARALLEL_EXPORT Request
00122   {
00123   public:
00124     int Test();
00125     void Cancel();
00126     void Wait();
00127     MPI_Request Req;
00128   };
00129 
00130 //ETX
00131 
00133 
00137   int NoBlockSend(int* data, int length, int remoteProcessId, int tag,
00138                   Request& req);
00139   int NoBlockSend(unsigned long* data, int length, int remoteProcessId,
00140                   int tag, Request& req);
00141   int NoBlockSend(char* data, int length, int remoteProcessId, 
00142                   int tag, Request& req);
00143   int NoBlockSend(float* data, int length, int remoteProcessId, 
00144                   int tag, Request& req);
00146 
00148 
00150   virtual int Receive(int* data, int length, int remoteProcessId, 
00151                       int tag);
00152   virtual int Receive(unsigned long* data, int length, 
00153                       int remoteProcessId, int tag);
00154   virtual int Receive(char* data, int length, int remoteProcessId, 
00155                       int tag);
00156   virtual int Receive(unsigned char* data, int length, int remoteProcessId, 
00157                       int tag);
00158   virtual int Receive(float* data, int length, int remoteProcessId, 
00159                       int tag);
00160   virtual int Receive(double* data, int length, int remoteProcessId, 
00161                       int tag);
00162 #ifdef VTK_USE_64BIT_IDS
00163   virtual int Receive(vtkIdType* data, int length, int remoteProcessId, 
00164                       int tag);
00166 #endif
00167   virtual int Receive(vtkDataObject* data, int remoteProcessId, int tag)
00168     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00169   virtual int Receive(vtkDataArray* data, int remoteProcessId, int tag)
00170     { return this->vtkCommunicator::Receive(data, remoteProcessId, tag); }
00171 
00173 
00176   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00177                      int tag, Request& req);
00178   int NoBlockReceive(unsigned long* data, int length, 
00179                      int remoteProcessId, int tag, Request& req);
00180   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00181                      int tag, Request& req);
00182   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00183                      int tag, Request& req);
00185 
00186 //BTX
00187 
00188   friend class vtkMPIController;
00189 
00190 //ETX
00191 
00192 protected:
00193 
00194   vtkSetObjectMacro(Group, vtkMPIGroup);
00195 
00197 
00204   vtkSetMacro(KeepHandle, int);
00205   vtkBooleanMacro(KeepHandle, int);
00207 
00208   static vtkMPICommunicator* WorldCommunicator;
00209 
00210   void InitializeCopy(vtkMPICommunicator* source);
00211 
00216   void CopyFrom(vtkMPICommunicator* source);
00217 
00224   void Duplicate(vtkMPICommunicator* source);
00225 
00226   MPI_Comm* Handle;
00227   vtkMPIGroup* Group;
00228 
00229   int Initialized;
00230   int KeepHandle;
00231 
00232   vtkMPICommunicator();
00233   ~vtkMPICommunicator();
00234 
00235  private:
00236   static int CheckForMPIError(int err);
00237 
00238 private:
00239   vtkMPICommunicator(const vtkMPICommunicator&);  // Not implemented.
00240   void operator=(const vtkMPICommunicator&);  // Not implemented.
00241 };
00242 
00243 
00244 #endif //  __vtkMPICommunicator_h
00245 
00246 
00247 
00248 

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