diff options
author | schnetter <schnetter@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5> | 2004-05-19 22:15:42 +0000 |
---|---|---|
committer | schnetter <schnetter@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5> | 2004-05-19 22:15:42 +0000 |
commit | 05c9aee7b0d96ef5f81369983715ba4f7ddca0c2 (patch) | |
tree | e56d90597740e6c051ea0bde363865f2d1691d1f | |
parent | 3d03502fa512096e11eff393afb6540175f6226e (diff) |
Fix segmentation fault on multiple processors
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@7 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5
-rw-r--r-- | src/rotatingsymmetry90.c | 27 | ||||
-rw-r--r-- | src/rotatingsymmetry90.h | 33 |
2 files changed, 49 insertions, 11 deletions
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<xferinfo[2].dst.len; ++k) { - for (j=0; j<xferinfo[1].dst.len; ++j) { - for (i=0; i<xferinfo[0].dst.len; ++i) { - const int ind - = CCTK_GFINDEX3D(cctkGH, - xferinfo[0].dst.off + i - cctk_lbnd[0], - xferinfo[1].dst.off + j - cctk_lbnd[1], - xferinfo[2].dst.off + k - cctk_lbnd[2]); + 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; } } diff --git a/src/rotatingsymmetry90.h b/src/rotatingsymmetry90.h new file mode 100644 index 0000000..bdc3627 --- /dev/null +++ b/src/rotatingsymmetry90.h @@ -0,0 +1,33 @@ +/* $Header$ */ + +#ifndef ROTATINGSYMMETRY90_H +#define ROTATINGSYMMETRY90_H + +#include "cctk.h" +#include "cctk_Arguments.h" + +void Rot90_RegisterSymmetry (CCTK_ARGUMENTS); + +int BndRot90VI (cGH const * restrict const cctkGH, + int const * restrict const stencil, + int const vi); +void +Rot90_ApplyBC (CCTK_ARGUMENTS); + +CCTK_INT +Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_, + CCTK_INT const N_dims, + CCTK_INT const local_interp_handle, + CCTK_INT const param_table_handle, + CCTK_INT const coord_system_handle, + CCTK_INT const N_interp_points, + CCTK_INT const interp_coords_type, + CCTK_POINTER_TO_CONST const interp_coords[], + CCTK_INT const N_input_arrays, + CCTK_INT const input_array_indices[], + CCTK_INT const N_output_arrays, + CCTK_INT const output_array_types[], + CCTK_POINTER const output_arrays[], + CCTK_INT const faces[]); + +#endif /* ! defined ROTATINGSYMMETRY90_H */ |