From 342ae4c153d733e9ffb3ce655437e3f17b91c129 Mon Sep 17 00:00:00 2001 From: schnetter Date: Fri, 28 Feb 2003 16:05:44 +0000 Subject: Completed the work for the previous commit. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Slab/trunk@15 2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8 --- src/slab.c | 182 ++++++++++++++++++++++++++++++++--------------------------- src/slab.inc | 18 +++--- 2 files changed, 107 insertions(+), 93 deletions(-) diff --git a/src/slab.c b/src/slab.c index 304adf4..026b002 100644 --- a/src/slab.c +++ b/src/slab.c @@ -620,25 +620,25 @@ int Slab_Transfer (cGH * restrict const cctkGH, } { - int iflag[dim]; - for (d=0; d= info[c].src.local.off && srcipos[c] < info[c].src.local.off + info[c].src.local.len); - if (! (srcipos[c] >= allinfo[n*dim+c].src.slab.off - && srcipos[c] <= allinfo[n*dim+c].src.slab.off + (allinfo[n*dim+c].src.slab.len - 1) * allinfo[n*dim+c].src.slab.str)) { + if (! (srcipos[c] >= allinfo[n*SLAB_MAXDIM+c].src.slab.off + && srcipos[c] <= allinfo[n*SLAB_MAXDIM+c].src.slab.off + (allinfo[n*SLAB_MAXDIM+c].src.slab.len - 1) * allinfo[n*SLAB_MAXDIM+c].src.slab.str)) { } - assert (srcipos[c] >= allinfo[n*dim+c].src.slab.off - && srcipos[c] <= allinfo[n*dim+c].src.slab.off + (allinfo[n*dim+c].src.slab.len - 1) * allinfo[n*dim+c].src.slab.str); - assert ((srcipos[c] - allinfo[n*dim+c].src.slab.off) % allinfo[n*dim+c].src.slab.str == 0); + assert (srcipos[c] >= allinfo[n*SLAB_MAXDIM+c].src.slab.off + && srcipos[c] <= allinfo[n*SLAB_MAXDIM+c].src.slab.off + (allinfo[n*SLAB_MAXDIM+c].src.slab.len - 1) * allinfo[n*SLAB_MAXDIM+c].src.slab.str); + assert ((srcipos[c] - allinfo[n*SLAB_MAXDIM+c].src.slab.off) % allinfo[n*SLAB_MAXDIM+c].src.slab.str == 0); bufipos[d] = ipos[d]; - assert (bufipos[d] >= 0 && bufipos[d] < srcdetail[n*dim+c].len); + assert (bufipos[d] >= 0 && bufipos[d] < srcdetail[n*SLAB_MAXDIM+c].len); } srcind = 0; bufind = 0; - for (d=dim-1; d>=0; --d) { + for (d=SLAB_MAXDIM-1; d>=0; --d) { int const c = info[d].xpose; srcind = srcind * info[d].src.local.len + srcipos[d] - info[d].src.local.off; - bufind = bufind * srcdetail[n*dim+c].len + bufipos[d]; + bufind = bufind * srcdetail[n*SLAB_MAXDIM+c].len + bufipos[d]; } assert (srcind < srclentot); assert (bufind < (size_t)srccount[n]); @@ -922,26 +936,26 @@ int Slab_Transfer (cGH * restrict const cctkGH, } for (n = 0; n < size; ++n) { - assert (dim == 3); - for (k = 0; k < dstdetail[n*dim+2].len; ++k) { - for (j = 0; j < dstdetail[n*dim+1].len; ++j) { - for (i = 0; i < dstdetail[n*dim+0].len; ++i) { - int ipos[3]; - int bufipos[3]; - int dstipos[3]; + assert (SLAB_MAXDIM == 3); + for (k = 0; k < dstdetail[n*SLAB_MAXDIM+2].len; ++k) { + for (j = 0; j < dstdetail[n*SLAB_MAXDIM+1].len; ++j) { + for (i = 0; i < dstdetail[n*SLAB_MAXDIM+0].len; ++i) { + int ipos[SLAB_MAXDIM]; + int bufipos[SLAB_MAXDIM]; + int dstipos[SLAB_MAXDIM]; size_t bufind; size_t dstind; ipos[0] = i; ipos[1] = j; ipos[2] = k; - for (d=0; d= 0 && bufipos[d] < dstdetail[n*dim+d].len); - dstipos[d] = dstdetail[n*dim+d].off + ipos[d] * info[d].dst.slab.str; + assert (bufipos[d] >= 0 && bufipos[d] < dstdetail[n*SLAB_MAXDIM+d].len); + dstipos[d] = dstdetail[n*SLAB_MAXDIM+d].off + ipos[d] * info[d].dst.slab.str; assert (dstipos[d] >= info[d].dst.local.off && dstipos[d] < info[d].dst.local.off + info[d].dst.local.len); assert (dstipos[d] >= info[d].dst.slab.off @@ -950,8 +964,8 @@ int Slab_Transfer (cGH * restrict const cctkGH, } bufind = 0; dstind = 0; - for (d=dim-1; d>=0; --d) { - bufind = bufind * dstdetail[n*dim+d].len + bufipos[d]; + for (d=SLAB_MAXDIM-1; d>=0; --d) { + bufind = bufind * dstdetail[n*SLAB_MAXDIM+d].len + bufipos[d]; dstind = dstind * info[d].dst.local.len + dstipos[d] - info[d].dst.local.off; } assert (bufind < (size_t)dstcount[n]); diff --git a/src/slab.inc b/src/slab.inc index a0f9bdc..395985a 100644 --- a/src/slab.inc +++ b/src/slab.inc @@ -17,17 +17,17 @@ interface integer ierr CCTK_POINTER cctkGH integer dim - integer src_gsh, src_lbnd, src_lsh - integer src_lbbox, src_ubbox, src_nghostzones - integer src_off, src_str, src_len - integer dst_gsh, dst_lbnd, dst_lsh - integer dst_lbbox, dst_ubbox, dst_nghostzones - integer dst_off, dst_str, dst_len - integer xpose, flip + integer src_gsh(dim), src_lbnd(dim), src_lsh(dim) + integer src_lbbox(dim), src_ubbox(dim), src_nghostzones(dim) + integer src_off(dim), src_str(dim), src_len(dim) + integer dst_gsh(dim), dst_lbnd(dim), dst_lsh(dim) + integer dst_lbbox(dim), dst_ubbox(dim), dst_nghostzones(dim) + integer dst_off(dim), dst_str(dim), dst_len(dim) + integer xpose(dim), flip(dim) integer options integer srctype - CCTK_POINTER srcptr + CCTK_REAL srcptr(*) integer dsttype - CCTK_POINTER dstptr + CCTK_REAL dstptr(*) end subroutine Slab_Transfer end interface -- cgit v1.2.3