From 3810449e2095aec53bcb1580b0173d4305d79e57 Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 22 Oct 2002 16:11:05 +0000 Subject: Now respecting ghost zones and boundaries. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Slab/trunk@3 2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8 --- src/slab.c | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/slab.c b/src/slab.c index a5800a7..a7280e3 100644 --- a/src/slab.c +++ b/src/slab.c @@ -5,6 +5,8 @@ Provide facilities for dim != 3 Set up the slab exchange information in advance Test slabbing without MPI + Allow using / not setting the ghost zones + Allow not using / not setting the boundaries */ @@ -155,7 +157,7 @@ struct bbox { }; struct arrays { - struct bbox global, local, slab; + struct bbox global, local, active, slab; }; struct info { @@ -220,11 +222,27 @@ static void local2bbox (struct slabinfo const * restrict const slab, assert (slab->lbnd >= 0); assert (slab->lsh >= 0); assert (slab->lbnd + slab->lsh <= slab->gsh); + bbox->off = slab->lbnd; + bbox->len = slab->lsh; + bbox->str = 1; + bbox_check (bbox); +} + +static void active2bbox (struct slabinfo const * restrict const slab, + struct bbox * restrict const bbox, + int const useghosts) +{ + assert (slab); + assert (bbox); + assert (useghosts == 0 || useghosts == 1); + assert (slab->lbnd >= 0); + assert (slab->lsh >= 0); + assert (slab->lbnd + slab->lsh <= slab->gsh); assert (slab->lbbox == 0 || slab->lbbox == 1); assert (slab->ubbox == 0 || slab->ubbox == 1); assert (slab->nghostzones >= 0); - int const nlghostzones = slab->lbbox ? 0 : slab->nghostzones; - int const nughostzones = slab->ubbox ? 0 : slab->nghostzones; + int const nlghostzones = slab->lbbox || useghosts ? 0 : slab->nghostzones; + int const nughostzones = slab->ubbox || useghosts ? 0 : slab->nghostzones; bbox->off = slab->lbnd + nlghostzones; bbox->len = slab->lsh - nlghostzones - nughostzones; bbox->str = 1; @@ -328,14 +346,16 @@ int Slab_Transfer (cGH * const cctkGH, for (int d=0; d