diff options
author | tradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-08-25 09:46:39 +0000 |
---|---|---|
committer | tradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-08-25 09:46:39 +0000 |
commit | 5b0e72d0414102ad7781a5a60cdc9b06ea4b53ce (patch) | |
tree | 037a05543e426ccba78d9c642a104a23f926c2d0 /src | |
parent | 366dc41f901abbe828792f3df13695a240e9d9b5 (diff) |
Bugfix for collecting processor-local chunks into the global hyperslab
if we deal with periodic boundary conditions.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@32 10716dce-81a3-4424-a2c8-48026a0d3035
Diffstat (limited to 'src')
-rw-r--r-- | src/Hyperslab.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Hyperslab.c b/src/Hyperslab.c index f702489..7cee730 100644 --- a/src/Hyperslab.c +++ b/src/Hyperslab.c @@ -217,7 +217,8 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, int vdim; /* looper over all dimensions */ int totals; /* total number of hyperslab data points */ int retval; /* the return value (0 for success) */ - pGExtras *extras; /* the variable's info structure from PUGH */ + pGH *pughGH; /* pointer to the current pGH */ + pGA *GA; /* the variable's GA structure from PUGH */ const char *errormsg; /* explanation string in case of errors */ @@ -267,8 +268,9 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, do_dir [vdim] = 1; } - /* get the variable's info structure from PUGH */ - extras = ((pGA *) PUGH_pGH (GH)->variables [vindex][vtimelvl])->extras; + /* get the pGH pointer and the variable's GA structure */ + pughGH = PUGH_pGH (GH); + GA = (pGA *) pughGH->variables [vindex][vtimelvl]; /* compute the global endpoint */ for (vdim = hdim = 0; vdim < vinfo.dim; vdim++) @@ -277,8 +279,8 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, { global_endpoint [vdim] = extents [hdim] > 0 ? MIN (global_startpoint [vdim] + extents [hdim], - extras->nsize [vdim]) : - extras->nsize [vdim]; + GA->extras->nsize [vdim]) : + GA->extras->nsize [vdim]; downsample [vdim] = downsample_ [hdim]; hdim++; } @@ -297,17 +299,17 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, { stagger_index = CCTK_StaggerDirIndex (vdim, vinfo.stagtype); - if (global_startpoint [vdim] < MY_GLOBAL_EP (extras, myproc, + if (global_startpoint [vdim] < MY_GLOBAL_EP (GA->extras, myproc, stagger_index, vdim)) { - if (global_startpoint [vdim] < MY_GLOBAL_SP (extras, myproc, + if (global_startpoint [vdim] < MY_GLOBAL_SP (GA->extras, myproc, stagger_index, vdim)) { int npoints; - npoints = (MY_GLOBAL_SP (extras, myproc, stagger_index, vdim) + npoints = (MY_GLOBAL_SP (GA->extras, myproc, stagger_index, vdim) - global_startpoint [vdim]) / downsample [vdim]; - if ((MY_GLOBAL_SP (extras, myproc, stagger_index, vdim) + if ((MY_GLOBAL_SP (GA->extras, myproc, stagger_index, vdim) - global_startpoint [vdim]) % downsample [vdim]) npoints++; my_global_startpoint [vdim] = global_startpoint [vdim] + @@ -329,20 +331,20 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, stagger_index = CCTK_StaggerDirIndex (vdim, vinfo.stagtype); if (my_global_startpoint [vdim] >= 0 && - my_global_startpoint [vdim] < MY_GLOBAL_EP (extras, myproc, + my_global_startpoint [vdim] < MY_GLOBAL_EP (GA->extras, myproc, stagger_index, vdim)) { startpoint [vdim] = my_global_startpoint [vdim] - - extras->lb [myproc][vdim]; + GA->extras->lb [myproc][vdim]; } else startpoint [vdim] = -1; - if (global_endpoint [vdim] > MY_GLOBAL_SP (extras, myproc, + if (global_endpoint [vdim] > MY_GLOBAL_SP (GA->extras, myproc, stagger_index, vdim)) { - endpoint [vdim] = MIN (MY_LOCAL_EP (extras, stagger_index, vdim), - global_endpoint [vdim] - extras->lb[myproc][vdim]); + endpoint [vdim] = MIN (MY_LOCAL_EP (GA->extras, stagger_index, vdim), + global_endpoint [vdim] - GA->extras->lb[myproc][vdim]); } else endpoint [vdim] = -1; @@ -398,6 +400,8 @@ int Hyperslab_GetLocalHyperslab (cGH *GH, int vindex, int vtimelvl, { hoffset_global [hdim] = (my_global_startpoint [vdim] - global_startpoint [vdim]) / downsample [vdim]; + if (GA->connectivity->perme [vdim]) + hoffset_global [hdim] -= GA->extras->nghostzones [vdim]; #ifdef DEBUG printf ("hoffset_global, hsize in direction %d: %d, %d\n", hdim, hoffset_global [hdim], hsize [hdim]); |