From 9ee6f38cace2f2c4b088d4a4032c91fcdf902e59 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 7 Dec 2005 00:41:06 +0000 Subject: Clean up the code. Replace the magic number 3 by a constant DIM. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@33 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5 --- src/rotatingsymmetry90.c | 97 +++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/src/rotatingsymmetry90.c b/src/rotatingsymmetry90.c index 728f8c5..cead8a8 100644 --- a/src/rotatingsymmetry90.c +++ b/src/rotatingsymmetry90.c @@ -16,16 +16,22 @@ +/* This is pretty hard coded into all the tensor types and cannot be + changed easily. */ +#define DIM 3 /* spatial dimension */ + + + static int convert_index (int const step, int const index, int const * restrict const alldirs, int * restrict const parity) { int srcindex; - assert (index>=0 && index<3); + assert (index>=0 && index=0 && alldirs[0]<3); - assert (alldirs[1]>=0 && alldirs[1]<3); + assert (alldirs[0]>=0 && alldirs[0]=0 && alldirs[1]cctk_bbox[d]; - for (d=0; d<3; ++d) local[6+d] = -cctkGH->cctk_lbnd[d]; - for (d=0; d<3; ++d) local[9+d] = cctkGH->cctk_ubnd[d]; + for (d=0; d<2*DIM; ++d) local[ d] = cctkGH->cctk_bbox[d]; + for (d=0; d< DIM; ++d) local[2*DIM+d] = -cctkGH->cctk_lbnd[d]; + for (d=0; d< DIM; ++d) local[3*DIM+d] = cctkGH->cctk_ubnd[d]; ierr = CCTK_ReduceLocArrayToArray1D - (cctkGH, -1, max_handle, local, global, 12, CCTK_VARIABLE_INT); - for (d=0; d<6; ++d) global_bbox[d] = global[ d]; - for (d=0; d<3; ++d) global_lbnd[d] = -global[6+d]; - for (d=0; d<3; ++d) global_ubnd[d] = global[9+d]; + (cctkGH, -1, max_handle, local, global, 4*DIM, CCTK_VARIABLE_INT); + for (d=0; d<2*DIM; ++d) global_bbox[d] = global[ d]; + for (d=0; d< DIM; ++d) global_lbnd[d] = -global[2*DIM+d]; + for (d=0; d< DIM; ++d) global_ubnd[d] = global[3*DIM+d]; - for (d=0; d<3; ++d) { + for (d=0; d=0 && index<3); + assert (index>=0 && index=0 && index<4); + assert (index>=0 && index=0 && index<6); + assert (index>=0 && index=0 && index<10); + assert (index>=0 && index<(DIM+1)*(DIM+2)/2); if (index==0) { /* temporal-temporal component */ srcvi = firstvar; - } else if (index<4) { + } else if (index= cctk_lsh[d]) imax[d] = cctk_lsh[d]; } - assert (group.dim == 3); + assert (group.dim == DIM); assert (group.vartype == CCTK_VARIABLE_REAL); - for (k=imin[0]; k=0 && indices[var]= 0); + assert (widths[var]>=0); } ierr = BndRot90VI (cctkGH, nvars, indices); -- cgit v1.2.3