From 6bfc7e019454cf7f372271ec0295714f3c947edc Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 9 Mar 2004 20:36:11 +0000 Subject: Check for invalid arguments in PUGH_SyncGArrayGroup and abort on error. Do not synchronise groups without storage when running on a single processor. (This happens only for periodic boundaries.) git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@432 b61c5cb5-eaca-4651-9a7a-d64986f99364 --- src/Comm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Comm.c b/src/Comm.c index de81a2a..b601982 100644 --- a/src/Comm.c +++ b/src/Comm.c @@ -80,6 +80,10 @@ int PUGH_SyncGroup(const cGH *GH, const char *groupname) "PUGH_SyncGroup: Unknown group: %s", groupname); retval = -1; } + else if (CCTK_NumVarsInGroupI(group) == 0) + { + /* do nothing */ + } else { CCTK_GroupData(group, &pgroup); @@ -295,6 +299,8 @@ static int PUGH_SyncGArrayGroup(pGH *pughGH, int first_var) pGA *firstGA; + if (first_var<0 || first_var>=CCTK_NumVars()) CCTK_WARN (0, "internal error"); + firstGA = (pGA *) pughGH->variables [first_var][0]; #ifdef DEBUG_PUGH @@ -971,6 +977,14 @@ static int PUGH_SyncSingleProc(pGH *pughGH, pComm *comm) GA = (pGA *) pughGH->variables [comm->first_var][comm->sync_timelevel]; + /* return if no storage assigned */ + if (! GA->storage) + { + CCTK_VWarn(2, __LINE__, __FILE__, CCTK_THORNSTRING, + "Trying to synchronize variable '%s' with no storage", GA->name); + return; + } + /* since we need to iterators here we need to allocate one */ iterator_from = GA->extras->iterator; iterator_to = (int *) malloc (GA->extras->dim * sizeof (int)); -- cgit v1.2.3