aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Comm.cc
diff options
context:
space:
mode:
authorThomas Radke <tradke@aei.mpg.de>2006-07-06 17:24:00 +0000
committerThomas Radke <tradke@aei.mpg.de>2006-07-06 17:24:00 +0000
commit3e6599be1c61037cfdfec9b1b18d085fe70f2959 (patch)
treea0cc2ba6c1ae307acee9e976fd1b1c98cbd5dc46 /Carpet/Carpet/src/Comm.cc
parent23230ad2174db9e3d2d3759ee3e6ec472cb82366 (diff)
Carpet: remove unnecessary overload function for CCTK_SyncGroup() ...
Don't panic, I replaced it by an overload function for CCTK_SyncGroupsByDirI() which can synchronise multiple groups at a time. This patch requires the most recent changes in the flesh API to provide the new overloadable function CCTK_SyncGroupsByDirI(), as discussed in thread http://www.cactuscode.org/old/pipermail/developers/2006-June/004933.html. darcs-hash:20060706172438-776a0-a16f88e46597dde9d7899e5c4e69ed8cb420a13a.gz
Diffstat (limited to 'Carpet/Carpet/src/Comm.cc')
-rw-r--r--Carpet/Carpet/src/Comm.cc42
1 files changed, 27 insertions, 15 deletions
diff --git a/Carpet/Carpet/src/Comm.cc b/Carpet/Carpet/src/Comm.cc
index a52cdfd5c..284484eb2 100644
--- a/Carpet/Carpet/src/Comm.cc
+++ b/Carpet/Carpet/src/Comm.cc
@@ -23,25 +23,37 @@ namespace Carpet {
const vector<int>& groups);
- // Carpet's overload function for CCTK_SyncGroup()
- // which synchronises a single group
+ // Carpet's overload function for CCTK_SyncGroupsByDirI()
+ // which synchronises a set of groups given by their indices.
+ // Synchronisation of individual directions is not (yet?) implemented.
//
- // returns 0 for success
- // -1 if the group doesn't have storage assigned
- // -2 if the given groupname is invalid
- int SyncGroup (const cGH* cctkGH, const char* groupname)
+ // returns the number of groups successfully synchronised
+ // -1 if a group in the set doesn't have storage assigned
+ int SyncGroupsByDirI (const cGH* cctkGH,
+ int num_groups,
+ const int *groups,
+ const int *directions)
{
- DECLARE_CCTK_PARAMETERS;
- int retval;
+ int group, retval = 0;
+ vector<int> groups_set;
+
+ // individual directions aren't supported (yet?)
+ if (directions != NULL) {
+ CCTK_WARN (0, "Carpet doesn't support synchronisation of individual "
+ "directions");
+ }
- const int group = CCTK_GroupIndex(groupname);
- if (group >= 0) {
- assert (group < (int)arrdata.size());
+ for (group = 0; group < num_groups; group++) {
+ if (CCTK_NumVarsInGroupI (groups[group]) > 0) {
+ groups_set.push_back (groups[group]);
+ }
+ }
- const vector<int> groups(1, group);
- retval = SyncProlongateGroups (cctkGH, groups);
- } else {
- retval = -2;
+ if (groups_set.size() > 0) {
+ retval = SyncProlongateGroups (cctkGH, groups_set);
+ if (retval == 0) {
+ retval = groups_set.size();
+ }
}
return retval;