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 #if defined(EpetraExt_SHOW_DEPRECATED_WARNINGS)
46 #ifdef __GNUC__
47 #warning "The EpetraExt package is deprecated"
48 #endif
49 #endif
50 
51 #include "EpetraExt_ConfigDefs.h"
52 #include "EpetraExt_MultiComm.h"
53 #include "Epetra_MpiComm.h"
54 #include "Teuchos_VerboseObject.hpp"
55 #include "Teuchos_RCP.hpp"
56 
61 
71 namespace EpetraExt {
72 
74  public Teuchos::VerboseObject<MultiMpiComm> {
75  public:
76 
78 
88  MultiMpiComm(MPI_Comm globalComm, int subDomainProcs, int numTimeSteps_=-1,
89  const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
90 
92 
100  MultiMpiComm(const Epetra_MpiComm& Comm, int numTimeSteps_,
101  const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_DEFAULT);
102 
104  MultiMpiComm( const MultiMpiComm &MMC );
105 
107  virtual ~MultiMpiComm();
109 
111  virtual Epetra_Comm& SubDomainComm() const {return *subComm;}
112 
115 
117  virtual Epetra_Comm& TimeDomainComm() const { return *timeComm; }
118 
121 
123  virtual int NumSubDomains() const {return numSubDomains;}
124 
126  virtual int SubDomainRank() const {return subDomainRank;}
127 
129  virtual int NumTimeDomains() const { return numTimeDomains; }
130 
132  virtual int TimeDomainRank() const { return timeDomainRank; }
133 
135  virtual int NumTimeStepsOnDomain() const {return numTimeStepsOnDomain;}
136  virtual int FirstTimeStepOnDomain() const {return firstTimeStepOnDomain;}
137 
139  virtual int NumTimeSteps() const {return numTimeSteps;}
140 
142  // be set later than the MultiLevel parallelism is set up.
144 
145  virtual Epetra_Comm * Clone() const { return myComm->Clone(); };
146  virtual void Barrier() const { myComm->Barrier(); };
147  virtual int Broadcast(double * MyVals, int Count, int Root) const
148  { return myComm->Broadcast( MyVals, Count, Root); };
149  virtual int Broadcast(int * MyVals, int Count, int Root) const
150  { return myComm->Broadcast( MyVals, Count, Root); };
151  virtual int Broadcast(long * MyVals, int Count, int Root) const
152  { return myComm->Broadcast( MyVals, Count, Root); };
153  virtual int Broadcast(long long * MyVals, int Count, int Root) const
154  { return myComm->Broadcast( MyVals, Count, Root); };
155  virtual int Broadcast(char * MyVals, int Count, int Root) const
156  { return myComm->Broadcast( MyVals, Count, Root); };
157  virtual int GatherAll(double * MyVals, double * AllVals, int Count) const
158  { return myComm->GatherAll( MyVals, AllVals, Count); };
159  virtual int GatherAll(int * MyVals, int * AllVals, int Count) const
160  { return myComm->GatherAll( MyVals, AllVals, Count); };
161  virtual int GatherAll(long * MyVals, long * AllVals, int Count) const
162  { return myComm->GatherAll( MyVals, AllVals, Count); };
163  virtual int GatherAll(long long * MyVals, long long * AllVals, int Count) const
164  { return myComm->GatherAll( MyVals, AllVals, Count); };
165  virtual int SumAll(double * PartialSums, double * GlobalSums, int Count) const
166  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
167  virtual int SumAll(int * PartialSums, int * GlobalSums, int Count) const
168  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
169  virtual int SumAll(long * PartialSums, long * GlobalSums, int Count) const
170  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
171  virtual int SumAll(long long * PartialSums, long long * GlobalSums, int Count) const
172  { return myComm->SumAll( PartialSums, GlobalSums, Count); };
173  virtual int MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const
174  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
175  virtual int MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const
176  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
177  virtual int MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const
178  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
179  virtual int MaxAll(long long * PartialMaxs, long long * GlobalMaxs, int Count) const
180  { return myComm->MaxAll( PartialMaxs, GlobalMaxs, Count); };
181  virtual int MinAll(double * PartialMins, double * GlobalMins, int Count) const
182  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
183  virtual int MinAll(int * PartialMins, int * GlobalMins, int Count) const
184  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
185  virtual int MinAll(long * PartialMins, long * GlobalMins, int Count)const
186  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
187  virtual int MinAll(long long * PartialMins, long long * GlobalMins, int Count)const
188  { return myComm->MinAll( PartialMins, GlobalMins, Count); };
189  virtual int ScanSum(double * MyVals, double * ScanSums, int Count)const
190  { return myComm->ScanSum( MyVals, ScanSums, Count); };
191  virtual int ScanSum(int * MyVals, int * ScanSums, int Count) const
192  { return myComm->ScanSum(MyVals, ScanSums, Count); };
193  virtual int ScanSum(long * MyVals, long * ScanSums, int Count) const
194  { return myComm->ScanSum(MyVals, ScanSums, Count); };
195  virtual int ScanSum(long long * MyVals, long long * ScanSums, int Count) const
196  { return myComm->ScanSum(MyVals, ScanSums, Count); };
197  virtual int MyPID() const { return myComm->MyPID(); };
198  virtual int NumProc() const { return myComm->NumProc(); };
199  virtual Epetra_Distributor * CreateDistributor() const { return myComm->CreateDistributor(); };
200  virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap & Map) const
201  { return myComm->CreateDirectory(Map); };
202  virtual void PrintInfo(std::ostream & os) const { myComm->PrintInfo( os); };
203 
204  protected:
205 
206  Teuchos::RCP<Epetra_Comm> myComm;
207 
214 
218 };
219 
220 } //namespace EpetraExt
221 
222 #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