aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/dist.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2005-11-19 20:26:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2005-11-19 20:26:00 +0000
commitfcb3ad6d9a8e2b58b1af4f3aae62321f93a0fe57 (patch)
tree78a553f9fbd6173d075ebae7920cfde27790de7a /Carpet/CarpetLib/src/dist.hh
parent8d359765c34b766d2804f480bbfbbd41e19fd6ad (diff)
CarpetLib: Change member dist::comm to function dist::comm()
No functionality change, but this requires all callers to be changed. darcs-hash:20051119202604-dae7b-3492487bfdc4f3d228ec57a2b2ea02116f5cb64c.gz
Diffstat (limited to 'Carpet/CarpetLib/src/dist.hh')
-rw-r--r--Carpet/CarpetLib/src/dist.hh18
1 files changed, 15 insertions, 3 deletions
diff --git a/Carpet/CarpetLib/src/dist.hh b/Carpet/CarpetLib/src/dist.hh
index 81fd11204..86fcbf61b 100644
--- a/Carpet/CarpetLib/src/dist.hh
+++ b/Carpet/CarpetLib/src/dist.hh
@@ -21,7 +21,7 @@ using namespace std;
namespace dist {
- extern MPI_Comm comm;
+ extern MPI_Comm comm_;
#if 0
extern MPI_Datatype mpi_complex_float;
@@ -45,11 +45,23 @@ namespace dist {
// Information about the communicator
+ // Return the communicator
+ inline MPI_Comm comm ()
+ {
+ return comm_;
+ }
+
+ // Always return a good communicator
+ inline MPI_Comm goodcomm ()
+ {
+ return comm_ != MPI_COMM_NULL ? comm_ : MPI_COMM_WORLD;
+ }
+
// Rank in the communicator (this processor's number, 0 .. size-1)
inline int rank ()
{
int rank_;
- MPI_Comm_rank (comm, &rank_);
+ MPI_Comm_rank (comm(), &rank_);
return rank_;
}
@@ -57,7 +69,7 @@ namespace dist {
inline int size ()
{
int size_;
- MPI_Comm_size (comm, &size_);
+ MPI_Comm_size (comm(), &size_);
return size_;
}