diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-07-06 17:38:23 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-07-06 17:38:23 +0000 |
commit | f0cf03607c0a19f30a2acefe531942dc49dcbf1d (patch) | |
tree | 10f0a3b60ec8255313c2037d04aed0b658c996f0 /src/comm/CactusSync.c | |
parent | abee539203ff53ed89b13193b9c57b9d4b2b57e6 (diff) |
Declare and make use of new overloadable CCTK_SyncGroupsByDirI() which
synchronises multiple groups in a single call. This function deprecates
the old overloadable function CCTK_SyncGroup().
This patch concludes the discussion thread starting on
http://www.cactuscode.org/old/pipermail/developers/2006-June/004933.html.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4348 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/comm/CactusSync.c')
-rw-r--r-- | src/comm/CactusSync.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/src/comm/CactusSync.c b/src/comm/CactusSync.c index 102d91d1..ee411372 100644 --- a/src/comm/CactusSync.c +++ b/src/comm/CactusSync.c @@ -36,6 +36,9 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) (int *ierror, const cGH **GH, const int *var); +void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupsI) + (int *ierror, const cGH **GH, const int *num_groups, + const int *groups); /*@@ @@ -45,8 +48,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) @desc Synchronizes a group given by its index. @enddesc - @calls CCTK_GroupName - CCTK_SyncGroup + @calls CCTK_SyncGroupsI @var GH @vdesc Pointer to Grid Hierachy @@ -62,29 +64,17 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) @returntype int @returndesc 0 for success, or<BR> - -1 if an invalid group was given,<BR> - -2 if driver returned an error on syncing the group + -negative return code of @seeroutine CCTK_SyncGroupsI @endreturndesc @@*/ int CCTK_SyncGroupI (const cGH *GH, int group) { int retval; - char *groupname; - retval = -1; - groupname = CCTK_GroupName (group); - if (groupname) - { - retval = CCTK_SyncGroup (GH, groupname); - if (retval) - { - retval = -2; - } - free (groupname); - } + retval = CCTK_SyncGroupsI (GH, 1, &group); - return (retval); + return (retval == 1 ? 0 : retval); } void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupI) @@ -192,7 +182,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) @desc Synchronises a list of groups given by their group indices. @enddesc - @calls CCTK_SyncGroupI + @calls CCTK_SyncGroupsByDirI @var GH @vdesc Pointer to Grid Hierachy @@ -212,24 +202,19 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) @returntype int @returndesc - the total number of groups synchronized + the total number of groups synchronized, or + -negative return code of @seeroutine CCTK_SyncGroupsByDirI @endreturndesc @@*/ int CCTK_SyncGroupsI (const cGH *GH, int n_groups, const int *groups) { - int i, retval; + int retval; - retval = 0; - for (i = 0; i < n_groups; i++) - { - if (CCTK_SyncGroupI (GH, groups[i]) == 0) - { - retval++; - } - } + /* passing NULL as the last argument means: synchronise all directions */ + retval = CCTK_SyncGroupsByDirI (GH, n_groups, groups, NULL); return (retval); } |