aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGH.c
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-03 17:05:15 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-03 17:05:15 +0000
commit46f2e553071b29921cd4a76411d9df248672c49f (patch)
tree41379ff9b96ea41a8119e3a6c2c026556e4a4112 /src/SetupPGH.c
parentbd8876cfde5d972865c8ee3612ba5505286168dc (diff)
Bugfix for dim == 0.
Cactus crashed in PUGH if no thorns declaring any GFs were compiled in. Fix for BR 221. Thomas git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@166 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGH.c')
-rw-r--r--src/SetupPGH.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index 381205e..12c8188 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -221,8 +221,8 @@ void pGH_SetupBasics(pGH *GH,
}
}
- GH->nsize = GH->GFExtras[dim-1]->nsize;
- GH->nghostzones = GH->GFExtras[dim-1]->nghostzones;
+ GH->nsize = dim > 0 ? GH->GFExtras[dim-1]->nsize : NULL;
+ GH->nghostzones = dim > 0 ? GH->GFExtras[dim-1]->nghostzones : NULL;
/*
if (Contains("commmodel","loc") != 0) {
@@ -348,17 +348,26 @@ void pGH_SetupOwnership(pGH *GH,int dim)
case 3:
Neighbours3D(GH, nproc, &maxpoints, &minpoints, &avgpoints);
break;
+case 0:
+break;
default:
CCTK_WARN(0,"PUGH can't cope with this dimension grid yet");
return;
}
avgpoints = (1.0 * avgpoints) / (GH->nprocs);
- GH->maxskew = (maxpoints-minpoints)/avgpoints * 100.0;
+ if (maxpoints > minpoints)
+ {
+ GH->maxskew = (maxpoints-minpoints)/avgpoints * 100.0;
+ }
+ else
+ {
+ GH->maxskew = 0;
+ }
/* Local information */
- GH->npoints = GH->GFExtras[dim-1]->npoints;
- GH->lnsize = GH->GFExtras[dim-1]->lnsize;
+ GH->npoints = dim > 0 ?GH->GFExtras[dim-1]->npoints : 0;
+ GH->lnsize = dim > 0 ?GH->GFExtras[dim-1]->lnsize : 0;