From ba9d75ac3f15bf6285f763be96531dc807ca7a0a Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 16 Jan 2013 14:41:12 -0500 Subject: CarpetReduce: Support array padding (cctk_ash) --- Carpet/CarpetReduce/src/mask_carpet.cc | 4 ++-- Carpet/CarpetReduce/src/mask_coords.c | 4 ++-- Carpet/CarpetReduce/src/reduce.cc | 38 +++++++++++++++++++++------------- 3 files changed, 28 insertions(+), 18 deletions(-) (limited to 'Carpet') diff --git a/Carpet/CarpetReduce/src/mask_carpet.cc b/Carpet/CarpetReduce/src/mask_carpet.cc index 758af60a7..622e632a5 100644 --- a/Carpet/CarpetReduce/src/mask_carpet.cc +++ b/Carpet/CarpetReduce/src/mask_carpet.cc @@ -115,7 +115,7 @@ namespace CarpetMask { CCTK_LOOP3(CarpetMaskSetup_prolongation, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); iweight[ind] &= bmask; @@ -133,7 +133,7 @@ namespace CarpetMask { CCTK_LOOP3(CarpetMaskSetup_restriction, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); iweight[ind] &= bmask; diff --git a/Carpet/CarpetReduce/src/mask_coords.c b/Carpet/CarpetReduce/src/mask_coords.c index 7836d2aa8..121bbe7f4 100644 --- a/Carpet/CarpetReduce/src/mask_coords.c +++ b/Carpet/CarpetReduce/src/mask_coords.c @@ -124,7 +124,7 @@ CoordBase_SetupMask (CCTK_ARGUMENTS) CCTK_LOOP3(CoordBase_SetupMask_boundary, i,j,k, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); iweight[ind] = 0; @@ -220,7 +220,7 @@ CoordBase_SetupMask (CCTK_ARGUMENTS) CCTK_LOOP3(CoordBase_SetupMask_ghost, i,j,k, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); iweight[ind] = 0; diff --git a/Carpet/CarpetReduce/src/reduce.cc b/Carpet/CarpetReduce/src/reduce.cc index 9a8b804f5..df5ebd296 100644 --- a/Carpet/CarpetReduce/src/reduce.cc +++ b/Carpet/CarpetReduce/src/reduce.cc @@ -551,8 +551,8 @@ namespace CarpetReduce { } template - void reduce (const int* const lsh, const int* const bbox, - const int* const nghostzones, + void reduce (const int* const lsh, const int* const ash, + const int* const bbox, const int* const nghostzones, vector const& inarrays, vector const& tfacs, void* const outval, void* const cnt, @@ -583,7 +583,7 @@ namespace CarpetReduce { for (int k=imin[2]; k const& inarrays, vector const& tfacs, const int intype, @@ -842,6 +842,7 @@ namespace CarpetReduce { for (int d=0; d=0); + assert (myash[d]>=mylsh[d]); assert (mynghostzones[d]>=0); int const nb = !mybbox[2*d] + !mybbox[2*d+1]; assert (nb*mynghostzones[d]<=mylsh[d]); @@ -867,7 +868,7 @@ namespace CarpetReduce { #define REDUCE(OP,S) \ case do_##OP: { \ typedef typeconv::goodtype T; \ - reduce > (mylsh, mybbox, mynghostzones, \ + reduce > (mylsh, myash, mybbox, mynghostzones, \ myinarrays, tfacs, \ &((char*)myoutvals)[vartypesize*n], \ &((char*)mycounts )[vartypesize*n], \ @@ -1063,16 +1064,18 @@ namespace CarpetReduce { assert (num_outvals == lsize); } - vect mylsh, mynghostzones; + vect mylsh, myash, mynghostzones; vect,dim> mybbox; for (int d=0; d=0); + assert (ash[d]>=lsh[d]); assert (nghostzones[d]>=0); int const nb = !bbox[2*d] + !bbox[2*d+1]; assert (nb*nghostzones[d]<=lsh[d]); } - vect mylsh, mynghostzones; + vect mylsh, myash, mynghostzones; vect,dim> mybbox; for (int d=0; d