diff options
author | Erik Schnetter <schnetter@aei.mpg.de> | 2005-08-26 14:45:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@aei.mpg.de> | 2005-08-26 14:45:00 +0000 |
commit | d6849480613bc591e9eb63ff896331eef12eec90 (patch) | |
tree | d6eacfd3c6c156b24e4878bab65940986e99cd0d | |
parent | ed0dc00bca80c9a29ee27208cc5ce36ff2709b92 (diff) |
Carpet: Pass MPI communicators as pointers instead of ints
Pass MPI communicators as pointers instead of ints because they may
not be implemented as ints.
Use MPI_COMM_NULL instead of -1 as illegal communicator.
darcs-hash:20050826144511-891bb-324a5d22efcbbd53cac35899e30559b06cfdfdb6.gz
-rw-r--r-- | Carpet/Carpet/interface.ccl | 6 | ||||
-rw-r--r-- | Carpet/Carpet/src/functions.hh | 4 | ||||
-rw-r--r-- | Carpet/Carpet/src/helpers.cc | 12 | ||||
-rw-r--r-- | Carpet/Carpet/src/variables.cc | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/Carpet/Carpet/interface.ccl b/Carpet/Carpet/interface.ccl index fa16cefcc..b5839262d 100644 --- a/Carpet/Carpet/interface.ccl +++ b/Carpet/Carpet/interface.ccl @@ -26,10 +26,12 @@ INCLUDE HEADER: typecase in carpet_typecase.hh # Get access to communicators -CCTK_INT FUNCTION GetMPICommUniverse (CCTK_POINTER_TO_CONST IN cctkGH) +CCTK_POINTER_TO_CONST \ +FUNCTION GetMPICommUniverse (CCTK_POINTER_TO_CONST IN cctkGH) PROVIDES FUNCTION GetMPICommUniverse WITH Carpet_GetMPICommUniverse LANGUAGE C -CCTK_INT FUNCTION GetMPICommWorld (CCTK_POINTER_TO_CONST IN cctkGH) +CCTK_POINTER_TO_CONST \ +FUNCTION GetMPICommWorld (CCTK_POINTER_TO_CONST IN cctkGH) PROVIDES FUNCTION GetMPICommWorld WITH Carpet_GetMPICommWorld LANGUAGE C diff --git a/Carpet/Carpet/src/functions.hh b/Carpet/Carpet/src/functions.hh index 9bf8c8f04..2d8866fe2 100644 --- a/Carpet/Carpet/src/functions.hh +++ b/Carpet/Carpet/src/functions.hh @@ -47,9 +47,9 @@ namespace Carpet { bool verbose); extern "C" { - CCTK_INT + CCTK_POINTER_TO_CONST Carpet_GetMPICommUniverse (CCTK_POINTER_TO_CONST cctkGH); - CCTK_INT + CCTK_POINTER_TO_CONST Carpet_GetMPICommWorld (CCTK_POINTER_TO_CONST cctkGH); } diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc index a5140f7f9..88691e86f 100644 --- a/Carpet/Carpet/src/helpers.cc +++ b/Carpet/Carpet/src/helpers.cc @@ -49,18 +49,18 @@ namespace Carpet { // Multi-Model - CCTK_INT + CCTK_POINTER_TO_CONST Carpet_GetMPICommUniverse (CCTK_POINTER_TO_CONST const cctkGH) { - assert (comm_universe >= 0); - return comm_universe; + assert (comm_universe != MPI_COMM_NULL); + return & comm_universe; } - CCTK_INT + CCTK_POINTER_TO_CONST Carpet_GetMPICommWorld (CCTK_POINTER_TO_CONST const cctkGH) { - assert (comm_world >= 0); - return comm_world; + assert (comm_world != MPI_COMM_NULL); + return & comm_world; } diff --git a/Carpet/Carpet/src/variables.cc b/Carpet/Carpet/src/variables.cc index 71520920c..fdd499419 100644 --- a/Carpet/Carpet/src/variables.cc +++ b/Carpet/Carpet/src/variables.cc @@ -105,7 +105,7 @@ namespace Carpet { // MPI Communicators - MPI_Comm comm_universe = -1; - MPI_Comm comm_world = -1; + MPI_Comm comm_universe = MPI_COMM_NULL; + MPI_Comm comm_world = MPI_COMM_NULL; } // namespace Carpet |