From fd09b304809f68285daa05deb9abfa7cb0a853ae Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 3 Dec 2010 16:19:27 -0500 Subject: CarpetReduce: Correct handling staggered boundaries --- Carpet/CarpetReduce/src/mask_coords.c | 203 +++++++++++++++++----------------- 1 file changed, 99 insertions(+), 104 deletions(-) (limited to 'Carpet/CarpetReduce') diff --git a/Carpet/CarpetReduce/src/mask_coords.c b/Carpet/CarpetReduce/src/mask_coords.c index b018dbce4..271e1b957 100644 --- a/Carpet/CarpetReduce/src/mask_coords.c +++ b/Carpet/CarpetReduce/src/mask_coords.c @@ -16,17 +16,17 @@ CoordBase_SetupMask (CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; - CCTK_INT nboundaryzones[6]; - CCTK_INT is_internal[6]; - CCTK_INT is_staggered[6]; - CCTK_INT shiftout[6]; + CCTK_INT nboundaryzones[2*cctk_dim]; + CCTK_INT is_internal[2*cctk_dim]; + CCTK_INT is_staggered[2*cctk_dim]; + CCTK_INT shiftout[2*cctk_dim]; - int bnd_points[6]; /* points outside the domain */ - int int_points[3]; /* global interior points */ + int bnd_points[2*cctk_dim]; /* points outside the domain */ + int int_points[cctk_dim]; /* global interior points */ - int gmin[3], gmax[3]; /* global domain extent */ - int imin[3], imax[3]; /* domain extent */ - int bmin[3], bmax[3]; /* boundary extent */ + int gmin[cctk_dim], gmax[cctk_dim]; /* global domain extent */ + int imin[cctk_dim], imax[cctk_dim]; /* domain extent */ + int bmin[cctk_dim], bmax[cctk_dim]; /* boundary extent */ int ierr; @@ -40,24 +40,25 @@ CoordBase_SetupMask (CCTK_ARGUMENTS) int const m = MultiPatch_GetMap (cctkGH); assert (m >= 0); ierr = MultiPatch_GetBoundarySpecification - (m, 6, nboundaryzones, is_internal, is_staggered, shiftout); + (m, 2*cctk_dim, nboundaryzones, is_internal, is_staggered, shiftout); } else { ierr = GetBoundarySpecification - (6, nboundaryzones, is_internal, is_staggered, shiftout); + (2*cctk_dim, nboundaryzones, is_internal, is_staggered, shiftout); } if (ierr != 0) { - CCTK_WARN (0, "Could not get boundary specification"); + CCTK_WARN (CCTK_WARN_ABORT, "Could not get boundary specification"); } - /* Calculate the number of boundary points */ - for (int d=0; d<3; ++d) { + /* Calculate the number of boundary points. This excludes points + that are directly on the boundary. */ + for (int d=0; d= 0) { - - if (bnd_points[2*d+f] < 0 || bnd_points[2*d+f] > cctk_lsh[d]) { - CCTK_WARN (0, "Illegal number of boundary points"); - } - - /* Calculate the extent of the domain */ - for (int dd=0; dd<3; ++dd) { - imin[dd] = 0; - imax[dd] = cctk_lsh[dd]; - } - - /* Calculate the extent of the boundary */ - for (int dd=0; dd<3; ++dd) { - bmin[dd] = imin[dd]; - bmax[dd] = imax[dd]; - } - if (f==0) { - /* lower face */ - bmax[d] = imin[d] + bnd_points[2*d+f]; - } else { - /* upper face */ - bmin[d] = imax[d] - bnd_points[2*d+f]; - } - - /* Loop over the boundary */ - if (verbose) { - CCTK_VInfo (CCTK_THORNSTRING, - "Setting boundary points in direction %d face %d to weight 0 on level %d", d, f, reflevel); - } + if (bnd_points[2*d+f] < 0 || bnd_points[2*d+f] > cctk_lsh[d]) { + CCTK_WARN (CCTK_WARN_ABORT, "Illegal number of boundary points"); + } + + /* Calculate the extent of the local part of the domain */ + for (int dd=0; dd