EpetraExt  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpetraExt_MultiMpiComm.h
Go to the documentation of this file.
1 //@HEADER
2 // ***********************************************************************
3 //
4 // EpetraExt: Epetra Extended - Linear Algebra Services Package
5 // Copyright (2011) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 
42 #ifndef EPETRAEXT_MULTIMPICOMM_H
43 #define EPETRAEXT_MULTIMPICOMM_H
44 
45 #include "EpetraExt_ConfigDefs.h"
46 #include "EpetraExt_MultiComm.h"
47 #include "Epetra_MpiComm.h"
48 #include "Teuchos_VerboseObject.hpp"
49 #include "Teuchos_RCP.hpp"
50 
55 
65 namespace EpetraExt {
66 
68  public Teuchos::VerboseObject<MultiMpiComm> {
69  public:
70 
72 
82  MultiMpiComm(MPI_Comm globalComm, int subDomainProcs, int numTimeSteps_=-1,
83  const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
84 
86 
94  MultiMpiComm(const Epetra_MpiComm& Comm, int numTimeSteps_,
95  const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
96 
98  MultiMpiComm( const MultiMpiComm &MMC );
99 
101  virtual ~MultiMpiComm();
103 
105  virtual Epetra_Comm& SubDomainComm() const {return *subComm;}
106 
109 
111  virtual Epetra_Comm& TimeDomainComm() const { return *timeComm; }
112 
115 
117  virtual int NumSubDomains() const {return numSubDomains;}
118 
120  virtual int SubDomainRank() const {return subDomainRank;}
121 
123  virtual int NumTimeDomains() const { return numTimeDomains; }
124 
126  virtual int TimeDomainRank() const { return timeDomainRank; }
127 
129  virtual int NumTimeStepsOnDomain() const {return numTimeStepsOnDomain;}
130  virtual int FirstTimeStepOnDomain() const {return firstTimeStepOnDomain;}
131 
133  virtual int NumTimeSteps() const {return numTimeSteps;}
134 
136  // be set later than the MultiLevel parallelism is set up.
138 
139  virtual Epetra_Comm * Clone() const { return myComm->Clone(); };
140  virtual void Barrier() const { myComm->Barrier(); };
141  virtual int Broadcast(double * MyVals, int Count, int Root) const
142  { return myComm->Broadcast( MyVals, Count, Root); };
143  virtual int Broadcast(int * MyVals, int Count, int Root) const
144  { return myComm->Broadcast( MyVals, Count, Root); };
145  virtual int Broadcast(long * MyVals, int Count, int Root) const
146  { return myComm->Broadcast( MyVals, Count, Root); };
147  virtual int Broadcast(long long * MyVals, int Count, int Root) const
148  { return myComm->Broadcast( MyVals, Count, Root); };
149  virtual int Broadcast(char * MyVals, int Count, int Root) const
150  { return myComm->Broadcast( MyVals, Count, Root); };
151  virtual int GatherAll(double * MyVals, double * AllVals, int Count) const
152  { return myComm->GatherAll( MyVals, AllVals, Count); };
153  virtual int GatherAll(int * MyVals, int * AllVals, int Count) const
154  { return myComm->GatherAll( MyVals, AllVals, Count); };
155  virtual int GatherAll(long * MyVals, long * AllVals, int Count) const
156  { return myComm->GatherAll( MyVals, AllVals, Count); };
157  virtual int GatherAll(long long * MyVals, long long * AllVals, int Count) const
158  { return myComm->GatherAll( MyVals, AllVals, Count); };
159  virtual int SumAll(double * PartialSums, double * GlobalSums, int Count) const
160  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
161  virtual int SumAll(int * PartialSums, int * GlobalSums, int Count) const
162  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
163  virtual int SumAll(long * PartialSums, long * GlobalSums, int Count) const
164  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
165  virtual int SumAll(long long * PartialSums, long long * GlobalSums, int Count) const
166  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
167  virtual int MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const
168  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
169  virtual int MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const
170  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
171  virtual int MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const
172  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
173  virtual int MaxAll(long long * PartialMaxs, long long * GlobalMaxs, int Count) const
174  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
175  virtual int MinAll(double * PartialMins, double * GlobalMins, int Count) const
176  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
177  virtual int MinAll(int * PartialMins, int * GlobalMins, int Count) const
178  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
179  virtual int MinAll(long * PartialMins, long * GlobalMins, int Count)const
180  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
181  virtual int MinAll(long long * PartialMins, long long * GlobalMins, int Count)const
182  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
183  virtual int ScanSum(double * MyVals, double * ScanSums, int Count)const
184  { return myComm->ScanSum( MyVals, ScanSums, Count); };
185  virtual int ScanSum(int * MyVals, int * ScanSums, int Count) const
186  { return myComm->ScanSum(MyVals, ScanSums, Count); };
187  virtual int ScanSum(long * MyVals, long * ScanSums, int Count) const
188  { return myComm->ScanSum(MyVals, ScanSums, Count); };
189  virtual int ScanSum(long long * MyVals, long long * ScanSums, int Count) const
190  { return myComm->ScanSum(MyVals, ScanSums, Count); };
191  virtual int MyPID() const { return myComm->MyPID(); };
192  virtual int NumProc() const { return myComm->NumProc(); };
193  virtual Epetra_Distributor * CreateDistributor() const { return myComm->CreateDistributor(); };
194  virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap & Map) const
195  { return myComm->CreateDirectory(Map); };
196  virtual void PrintInfo(std::ostream & os) const { myComm->PrintInfo( os); };
197 
198  protected:
199 
200  Teuchos::RCP<Epetra_Comm> myComm;
201 
208 
212 };
213 
214 } //namespace EpetraExt
215 
216 #endif /* EPETRAEXT_MULTIMPICOMM_H */
virtual int SumAll(long long *PartialSums, long long *GlobalSums, int Count) const
virtual int SumAll(double *PartialSums, double *GlobalSums, int Count) const
virtual int NumTimeDomains() const
Return number of time domains that the global problem is split into.
virtual int SubDomainRank() const
Return integer [0:numSubDomains-1} corresponding to this sub-domain&#39;s rank.
virtual int NumSubDomains() const
Return number of sub-domains that the global problem is split into.
virtual int SumAll(long *PartialSums, long *GlobalSums, int Count) const
virtual int GatherAll(int *MyVals, int *AllVals, int Count) const
virtual int FirstTimeStepOnDomain() const
virtual int MaxAll(double *PartialMaxs, double *GlobalMaxs, int Count) const
virtual int NumProc() const
virtual int Broadcast(double *MyVals, int Count, int Root) const
virtual void Barrier() const
virtual int Broadcast(long long *MyVals, int Count, int Root) const
virtual Epetra_Comm & SubDomainComm() const
Get reference to split Communicator for sub-domain.
virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap &Map) const
virtual int MaxAll(long *PartialMaxs, long *GlobalMaxs, int Count) const
virtual int Broadcast(int *MyVals, int Count, int Root) const
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const
virtual int NumTimeStepsOnDomain() const
Return number of time steps, first step number, on time domain.
virtual int SumAll(int *PartialSums, int *GlobalSums, int Count) const
void ResetNumTimeSteps(int numTimeSteps)
Reset total number of time steps, allowing time steps per domain to.
virtual Epetra_Comm & TimeDomainComm() const
Get reference to split Communicator for time domain.
virtual int Broadcast(long *MyVals, int Count, int Root) const
Epetra_MpiComm & TimeDomainMpiComm() const
Get reference to split MPI Communicator for time domain.
virtual int ScanSum(int *MyVals, int *ScanSums, int Count) const
virtual int GatherAll(long *MyVals, long *AllVals, int Count) const
Teuchos::RCP< Epetra_Comm > myComm
MultiMpiComm(MPI_Comm globalComm, int subDomainProcs, int numTimeSteps_=-1, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT)
MultiMpiComm constuctor.
virtual int NumTimeSteps() const
Return total number of time steps.
virtual void PrintInfo(std::ostream &os) const
virtual int MinAll(long long *PartialMins, long long *GlobalMins, int Count) const
virtual Epetra_Comm * Clone() const
MPI_Comm Comm() const
Epetra_MpiComm & SubDomainMpiComm() const
Get reference to split MPI Communicator for sub-domain.
virtual int GatherAll(long long *MyVals, long long *AllVals, int Count) const
virtual int MaxAll(int *PartialMaxs, int *GlobalMaxs, int Count) const
virtual int TimeDomainRank() const
Return integer [0:numTimeDomains-1} corresponding to this time-domain&#39;s rank.
virtual int MinAll(long *PartialMins, long *GlobalMins, int Count) const
virtual ~MultiMpiComm()
Destructor.
virtual int MinAll(int *PartialMins, int *GlobalMins, int Count) const
virtual int ScanSum(double *MyVals, double *ScanSums, int Count) const
virtual int Broadcast(char *MyVals, int Count, int Root) const
virtual int MaxAll(long long *PartialMaxs, long long *GlobalMaxs, int Count) const
virtual int ScanSum(long *MyVals, long *ScanSums, int Count) const
virtual int GatherAll(double *MyVals, double *AllVals, int Count) const
virtual Epetra_Distributor * CreateDistributor() const
virtual int ScanSum(long long *MyVals, long long *ScanSums, int Count) const