From 05c9aee7b0d96ef5f81369983715ba4f7ddca0c2 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 19 May 2004 22:15:42 +0000 Subject: Fix segmentation fault on multiple processors git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@7 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5 --- src/rotatingsymmetry90.c | 27 ++++++++++++++++----------- src/rotatingsymmetry90.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 src/rotatingsymmetry90.h diff --git a/src/rotatingsymmetry90.c b/src/rotatingsymmetry90.c index b39e518..3b0952c 100644 --- a/src/rotatingsymmetry90.c +++ b/src/rotatingsymmetry90.c @@ -293,7 +293,7 @@ int BndRot90VI (cGH const * restrict const cctkGH, srcindex1 = convert_index (step, index1, alldirs, &parity); srcindex2 = convert_index (step, index2, alldirs, &parity); { - int const compact[3][3] = { 0,1,2, 1,3,4, 2,4,5 }; + int const compact[3][3] = { { 0,1,2 }, { 1,3,4 }, { 2,4,5 } }; srcindex = compact[srcindex1][srcindex2]; } srcvi = firstvar + srcindex; @@ -365,8 +365,8 @@ int BndRot90VI (cGH const * restrict const cctkGH, xferinfo[ dir[q]].xpose = otherdir[q]; xferinfo[otherdir[q]].xpose = dir[q]; - // Note: For other rotations that in the xy plane, the - // flipping might be different + /* Note: For rotations other than in the xy plane, the + flipping might be different */ xferinfo[ dir[q]].flip = 1; } break; @@ -402,17 +402,22 @@ int BndRot90VI (cGH const * restrict const cctkGH, 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=0; k