diff options
author | hawke <hawke@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5> | 2004-06-22 13:19:21 +0000 |
---|---|---|
committer | hawke <hawke@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5> | 2004-06-22 13:19:21 +0000 |
commit | 1f2da65826fcdc52d4ffa70fa2d3cca20d0dca29 (patch) | |
tree | be38bdfb65816539f4acfca365d33e9b7434df1a | |
parent | 23074b9a6ad87274d713367308cfe304ea74d791 (diff) |
Move the local bbox part into the global bbox loop so the xferinfo information is not used after being free'd.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@14 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5
-rw-r--r-- | src/rotatingsymmetry90.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/rotatingsymmetry90.c b/src/rotatingsymmetry90.c index 3b0952c..7dfbb02 100644 --- a/src/rotatingsymmetry90.c +++ b/src/rotatingsymmetry90.c @@ -389,42 +389,42 @@ int BndRot90VI (cGH const * restrict const cctkGH, (cctkGH, group.dim, xferinfo, -1, group.vartype, srcptr, group.vartype, varptr); assert (!ierr); - - free (xferinfo); - - } /* if have_global_bbox */ - /* take parity into account */ - have_local_bbox = 1; - for (q=0; q<ndirs; ++q) { - have_local_bbox = have_local_bbox && cctk_bbox[2*dir[q]]; - } - if (have_local_bbox) { - assert (abs(parity) == 1); - if (parity == -1) { - int imin[3], imax[3]; - int i, j, k; - for (d=0; d<3; ++d) { - imin[d] = xferinfo[d].dst.off; - imax[d] = xferinfo[d].dst.off + xferinfo[d].dst.len; - imin[d] -= cctk_lbnd[d]; - imax[d] -= cctk_lbnd[d]; - if (imin[d] < 0) imin[d] = 0; - if (imax[d] >= cctk_lsh[d]) imax[d] = cctk_lsh[d]; - } - assert (group.dim == 3); - assert (group.vartype == CCTK_VARIABLE_REAL); - for (k=imin[0]; k<imax[2]; ++k) { - for (j=imin[1]; j<imax[1]; ++j) { - for (i=imin[2]; i<imax[0]; ++i) { - const int ind = CCTK_GFINDEX3D(cctkGH, i, j, k); - ((CCTK_REAL *) varptr) [ind] *= -1; + /* take parity into account */ + have_local_bbox = 1; + for (q=0; q<ndirs; ++q) { + have_local_bbox = have_local_bbox && cctk_bbox[2*dir[q]]; + } + if (have_local_bbox) { + assert (abs(parity) == 1); + if (parity == -1) { + int imin[3], imax[3]; + int i, j, k; + for (d=0; d<3; ++d) { + imin[d] = xferinfo[d].dst.off; + imax[d] = xferinfo[d].dst.off + xferinfo[d].dst.len; + imin[d] -= cctk_lbnd[d]; + imax[d] -= cctk_lbnd[d]; + if (imin[d] < 0) imin[d] = 0; + if (imax[d] >= cctk_lsh[d]) imax[d] = cctk_lsh[d]; + } + assert (group.dim == 3); + assert (group.vartype == CCTK_VARIABLE_REAL); + for (k=imin[0]; k<imax[2]; ++k) { + for (j=imin[1]; j<imax[1]; ++j) { + for (i=imin[2]; i<imax[0]; ++i) { + const int ind = CCTK_GFINDEX3D(cctkGH, i, j, k); + ((CCTK_REAL *) varptr) [ind] *= -1; + } } } } - } - } /* if bbox */ + } /* if bbox */ + + free (xferinfo); + + } /* if have_global_bbox */ } /* for step */ |