EpetraExt Development
EpetraExt_MultiMpiComm.h
Go to the documentation of this file.
00001 //@HEADER
00002 // ***********************************************************************
00003 //
00004 //     EpetraExt: Epetra Extended - Linear Algebra Services Package
00005 //                 Copyright (2011) Sandia Corporation
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 
00042 #ifndef EPETRAEXT_MULTIMPICOMM_H
00043 #define EPETRAEXT_MULTIMPICOMM_H
00044 
00045 #include "EpetraExt_ConfigDefs.h"
00046 #include "EpetraExt_MultiComm.h" 
00047 #include "Epetra_MpiComm.h" 
00048 #include "Teuchos_VerboseObject.hpp"
00049 #include "Teuchos_RCP.hpp"
00050 
00055 
00065 namespace EpetraExt {
00066 
00067 class MultiMpiComm: public EpetraExt::MultiComm, public Epetra_MpiComm,
00068   public Teuchos::VerboseObject<MultiMpiComm> {
00069  public:
00070 
00072 
00073 
00082   MultiMpiComm(MPI_Comm globalComm, int subDomainProcs, int numTimeSteps_=-1);
00083   
00085 
00093   MultiMpiComm(const Epetra_MpiComm& Comm, int numTimeSteps_);
00094 
00096   MultiMpiComm( const MultiMpiComm &MMC );
00097 
00099   virtual ~MultiMpiComm();
00101   
00103   virtual Epetra_Comm& SubDomainComm() const {return *subComm;}
00104 
00106   Epetra_MpiComm& SubDomainMpiComm() const {return *subComm;}
00107 
00109   virtual Epetra_Comm& TimeDomainComm() const { return *timeComm; }
00110 
00112   Epetra_MpiComm& TimeDomainMpiComm() const {return *timeComm;}
00113 
00115   virtual int NumSubDomains() const {return numSubDomains;}
00116 
00118   virtual int SubDomainRank() const {return subDomainRank;}
00119 
00121   virtual int NumTimeDomains() const { return numTimeDomains; }
00122 
00124   virtual int TimeDomainRank() const { return timeDomainRank; }
00125 
00127   virtual int NumTimeStepsOnDomain() const {return numTimeStepsOnDomain;}
00128   virtual int FirstTimeStepOnDomain() const {return firstTimeStepOnDomain;}
00129 
00131   virtual int NumTimeSteps() const {return numTimeSteps;}
00132 
00134   //  be set later than the MultiLevel parallelism is set up.
00135   void ResetNumTimeSteps(int numTimeSteps);
00136 
00137   virtual Epetra_Comm * Clone() const  { return myComm->Clone(); };
00138   virtual void Barrier() const { myComm->Barrier(); };
00139   virtual int Broadcast(double * MyVals, int Count, int Root) const
00140           { return myComm->Broadcast( MyVals, Count, Root); };
00141   virtual int Broadcast(int * MyVals, int Count, int Root) const
00142           { return myComm->Broadcast( MyVals, Count, Root); };
00143   virtual int Broadcast(long * MyVals, int Count, int Root) const
00144           { return myComm->Broadcast( MyVals, Count, Root); };
00145   virtual int Broadcast(char * MyVals, int Count, int Root) const
00146           { return myComm->Broadcast( MyVals, Count, Root); };
00147   virtual int GatherAll(double * MyVals, double * AllVals, int Count) const
00148           { return myComm->GatherAll( MyVals,  AllVals, Count); };
00149   virtual int GatherAll(int * MyVals, int * AllVals, int Count) const
00150           { return myComm->GatherAll( MyVals, AllVals, Count); };
00151   virtual int GatherAll(long * MyVals, long * AllVals, int Count) const
00152           { return myComm->GatherAll( MyVals,  AllVals, Count); };
00153   virtual int SumAll(double * PartialSums, double * GlobalSums, int Count) const
00154           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00155   virtual int SumAll(int * PartialSums, int * GlobalSums, int Count) const
00156           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00157   virtual int SumAll(long * PartialSums, long * GlobalSums, int Count) const
00158           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00159   virtual int MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const
00160           { return myComm->MaxAll( PartialMaxs,  GlobalMaxs, Count); };
00161   virtual int MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const
00162           { return myComm->MaxAll( PartialMaxs,  GlobalMaxs, Count); };
00163   virtual int MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const
00164           { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
00165   virtual int MinAll(double * PartialMins, double * GlobalMins, int Count) const
00166           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00167   virtual int MinAll(int * PartialMins, int * GlobalMins, int Count) const
00168           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00169   virtual int MinAll(long * PartialMins, long * GlobalMins, int Count)const
00170           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00171   virtual int ScanSum(double * MyVals, double * ScanSums, int Count)const
00172           { return myComm->ScanSum( MyVals,  ScanSums, Count); };
00173   virtual int ScanSum(int * MyVals, int * ScanSums, int Count) const
00174           { return myComm->ScanSum(MyVals, ScanSums, Count); };
00175   virtual int ScanSum(long * MyVals, long * ScanSums, int Count) const
00176           { return myComm->ScanSum(MyVals, ScanSums, Count); };
00177   virtual int MyPID() const { return myComm->MyPID(); };
00178   virtual int NumProc() const { return myComm->NumProc(); };
00179   virtual Epetra_Distributor * CreateDistributor() const { return myComm->CreateDistributor(); };
00180   virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap & Map) const 
00181           { return myComm->CreateDirectory(Map); };
00182   virtual void PrintInfo(ostream & os) const { myComm->PrintInfo( os); };
00183 
00184  protected:
00185 
00186   Teuchos::RCP<Epetra_Comm> myComm;
00187 
00188   Epetra_MpiComm* subComm; 
00189   Epetra_MpiComm* timeComm; 
00190   int numSubDomains;
00191   int numTimeDomains;
00192   int subDomainRank;
00193   int timeDomainRank;
00194 
00195   int numTimeSteps;
00196   int numTimeStepsOnDomain;
00197   int firstTimeStepOnDomain;
00198 };
00199 
00200 } //namespace EpetraExt
00201 
00202 #endif /* EPETRAEXT_MULTIMPICOMM_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines