diff options
author | schnetter <schnetter@2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8> | 2002-10-22 16:11:05 +0000 |
---|---|---|
committer | schnetter <schnetter@2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8> | 2002-10-22 16:11:05 +0000 |
commit | 3810449e2095aec53bcb1580b0173d4305d79e57 (patch) | |
tree | a4e79600a47c5b8a100074ed5dbbac5c7ca35544 | |
parent | 2f751a2911f964a8e471b4206352d913b968a7bf (diff) |
Now respecting ghost zones and boundaries.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Slab/trunk@3 2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8
-rw-r--r-- | src/slab.c | 44 |
1 files changed, 33 insertions, 11 deletions
@@ -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<dim; ++d) { global2bbox (&xferinfo[d].src, &info[d].src.global); local2bbox (&xferinfo[d].src, &info[d].src.local); - assert (bbox_iscontained (&info[d].src.local, &info[d].src.global)); + active2bbox (&xferinfo[d].src, &info[d].src.active, 0); slab2bbox (&xferinfo[d].src, &info[d].src.slab); + assert (bbox_iscontained (&info[d].src.active, &info[d].src.local)); assert (bbox_iscontained (&info[d].src.local, &info[d].src.global)); global2bbox (&xferinfo[d].dst, &info[d].dst.global); local2bbox (&xferinfo[d].dst, &info[d].dst.local); - assert (bbox_iscontained (&info[d].dst.local, &info[d].dst.global)); + active2bbox (&xferinfo[d].dst, &info[d].dst.active, 1); slab2bbox (&xferinfo[d].dst, &info[d].dst.slab); + assert (bbox_iscontained (&info[d].dst.active, &info[d].dst.local)); assert (bbox_iscontained (&info[d].dst.local, &info[d].dst.global)); info[d].xpose = xferinfo[d].xpose; @@ -417,6 +437,8 @@ int Slab_Transfer (cGH * const cctkGH, assert (allinfo[n][d].dst.global.str == info[d].dst.global.str); assert (allinfo[n][d].src.local.str == info[d].src.local.str); assert (allinfo[n][d].dst.local.str == info[d].dst.local.str); + assert (allinfo[n][d].src.active.str == info[d].src.active.str); + assert (allinfo[n][d].dst.active.str == info[d].dst.active.str); assert (allinfo[n][d].src.slab.str == info[d].src.slab.str); assert (allinfo[n][d].dst.slab.str == info[d].dst.slab.str); assert (allinfo[n][d].xpose == info[d].xpose); @@ -434,8 +456,8 @@ int Slab_Transfer (cGH * const cctkGH, ifdebug printf (" src.slab d=%d ", d); ifdebug bbox_print (&srcdetail[n][d]); ifdebug printf ("\n"); - bbox_clip (&srcdetail[n][d], &info[d].src.local); - ifdebug printf (" clipped with src.local d=%d ", d); + bbox_clip (&srcdetail[n][d], &info[d].src.active); + ifdebug printf (" clipped with src.active d=%d ", d); ifdebug bbox_print (&srcdetail[n][d]); ifdebug printf ("\n"); } @@ -444,7 +466,7 @@ int Slab_Transfer (cGH * const cctkGH, ifdebug printf (" dst.slab d=%d ", info[d].xpose); ifdebug bbox_print (&whereto); ifdebug printf ("\n"); - bbox_clip (&whereto, &allinfo[n][d].dst.local); + bbox_clip (&whereto, &allinfo[n][d].dst.active); ifdebug printf (" whereto d=%d ", info[d].xpose); ifdebug bbox_print (&whereto); ifdebug printf ("\n"); @@ -494,15 +516,15 @@ int Slab_Transfer (cGH * const cctkGH, ifdebug printf (" dst.slab d=%d ", d); ifdebug bbox_print (&dstdetail[n][d]); ifdebug printf ("\n"); - bbox_clip (&dstdetail[n][d], &info[d].dst.local); - ifdebug printf (" clipped with dst.local d=%d ", d); + bbox_clip (&dstdetail[n][d], &info[d].dst.active); + ifdebug printf (" clipped with dst.active d=%d ", d); ifdebug bbox_print (&dstdetail[n][d]); ifdebug printf ("\n"); struct bbox wherefrom = allinfo[n][info[d].xpose].src.slab; ifdebug printf (" src.slab d=%d ", d); ifdebug bbox_print (&dstdetail[n][d]); ifdebug printf ("\n"); - bbox_clip (&wherefrom, &allinfo[n][info[d].xpose].src.local); + bbox_clip (&wherefrom, &allinfo[n][info[d].xpose].src.active); ifdebug printf (" wherefrom d=%d ", d); ifdebug bbox_print (&dstdetail[n][d]); ifdebug printf ("\n"); |