EpetraExt Package Browser (Single Doxygen Collection) 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          const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
00084   
00086 
00094   MultiMpiComm(const Epetra_MpiComm& Comm, int numTimeSteps_,
00095          const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
00096 
00098   MultiMpiComm( const MultiMpiComm &MMC );
00099 
00101   virtual ~MultiMpiComm();
00103   
00105   virtual Epetra_Comm& SubDomainComm() const {return *subComm;}
00106 
00108   Epetra_MpiComm& SubDomainMpiComm() const {return *subComm;}
00109 
00111   virtual Epetra_Comm& TimeDomainComm() const { return *timeComm; }
00112 
00114   Epetra_MpiComm& TimeDomainMpiComm() const {return *timeComm;}
00115 
00117   virtual int NumSubDomains() const {return numSubDomains;}
00118 
00120   virtual int SubDomainRank() const {return subDomainRank;}
00121 
00123   virtual int NumTimeDomains() const { return numTimeDomains; }
00124 
00126   virtual int TimeDomainRank() const { return timeDomainRank; }
00127 
00129   virtual int NumTimeStepsOnDomain() const {return numTimeStepsOnDomain;}
00130   virtual int FirstTimeStepOnDomain() const {return firstTimeStepOnDomain;}
00131 
00133   virtual int NumTimeSteps() const {return numTimeSteps;}
00134 
00136   //  be set later than the MultiLevel parallelism is set up.
00137   void ResetNumTimeSteps(int numTimeSteps);
00138 
00139   virtual Epetra_Comm * Clone() const  { return myComm->Clone(); };
00140   virtual void Barrier() const { myComm->Barrier(); };
00141   virtual int Broadcast(double * MyVals, int Count, int Root) const
00142           { return myComm->Broadcast( MyVals, Count, Root); };
00143   virtual int Broadcast(int * MyVals, int Count, int Root) const
00144           { return myComm->Broadcast( MyVals, Count, Root); };
00145   virtual int Broadcast(long * MyVals, int Count, int Root) const
00146           { return myComm->Broadcast( MyVals, Count, Root); };
00147   virtual int Broadcast(long long * MyVals, int Count, int Root) const
00148           { return myComm->Broadcast( MyVals, Count, Root); };
00149   virtual int Broadcast(char * MyVals, int Count, int Root) const
00150           { return myComm->Broadcast( MyVals, Count, Root); };
00151   virtual int GatherAll(double * MyVals, double * AllVals, int Count) const
00152           { return myComm->GatherAll( MyVals,  AllVals, Count); };
00153   virtual int GatherAll(int * MyVals, int * AllVals, int Count) const
00154           { return myComm->GatherAll( MyVals, AllVals, Count); };
00155   virtual int GatherAll(long * MyVals, long * AllVals, int Count) const
00156           { return myComm->GatherAll( MyVals,  AllVals, Count); };
00157   virtual int GatherAll(long long * MyVals, long long * AllVals, int Count) const
00158           { return myComm->GatherAll( MyVals,  AllVals, Count); };
00159   virtual int SumAll(double * PartialSums, double * GlobalSums, int Count) const
00160           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00161   virtual int SumAll(int * PartialSums, int * GlobalSums, int Count) const
00162           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00163   virtual int SumAll(long * PartialSums, long * GlobalSums, int Count) const
00164           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00165   virtual int SumAll(long long * PartialSums, long long * GlobalSums, int Count) const
00166           { return myComm->SumAll( PartialSums,  GlobalSums, Count); };
00167   virtual int MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const
00168           { return myComm->MaxAll( PartialMaxs,  GlobalMaxs, Count); };
00169   virtual int MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const
00170           { return myComm->MaxAll( PartialMaxs,  GlobalMaxs, Count); };
00171   virtual int MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const
00172           { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
00173   virtual int MaxAll(long long * PartialMaxs, long long * GlobalMaxs, int Count) const
00174           { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
00175   virtual int MinAll(double * PartialMins, double * GlobalMins, int Count) const
00176           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00177   virtual int MinAll(int * PartialMins, int * GlobalMins, int Count) const
00178           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00179   virtual int MinAll(long * PartialMins, long * GlobalMins, int Count)const
00180           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00181   virtual int MinAll(long long * PartialMins, long long * GlobalMins, int Count)const
00182           { return myComm->MinAll( PartialMins, GlobalMins, Count); };
00183   virtual int ScanSum(double * MyVals, double * ScanSums, int Count)const
00184           { return myComm->ScanSum( MyVals,  ScanSums, Count); };
00185   virtual int ScanSum(int * MyVals, int * ScanSums, int Count) const
00186           { return myComm->ScanSum(MyVals, ScanSums, Count); };
00187   virtual int ScanSum(long * MyVals, long * ScanSums, int Count) const
00188           { return myComm->ScanSum(MyVals, ScanSums, Count); };
00189   virtual int ScanSum(long long * MyVals, long long * ScanSums, int Count) const
00190           { return myComm->ScanSum(MyVals, ScanSums, Count); };
00191   virtual int MyPID() const { return myComm->MyPID(); };
00192   virtual int NumProc() const { return myComm->NumProc(); };
00193   virtual Epetra_Distributor * CreateDistributor() const { return myComm->CreateDistributor(); };
00194   virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap & Map) const 
00195           { return myComm->CreateDirectory(Map); };
00196   virtual void PrintInfo(std::ostream & os) const { myComm->PrintInfo( os); };
00197 
00198  protected:
00199 
00200   Teuchos::RCP<Epetra_Comm> myComm;
00201 
00202   Epetra_MpiComm* subComm; 
00203   Epetra_MpiComm* timeComm; 
00204   int numSubDomains;
00205   int numTimeDomains;
00206   int subDomainRank;
00207   int timeDomainRank;
00208 
00209   int numTimeSteps;
00210   int numTimeStepsOnDomain;
00211   int firstTimeStepOnDomain;
00212 };
00213 
00214 } //namespace EpetraExt
00215 
00216 #endif /* EPETRAEXT_MULTIMPICOMM_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines