diff options
author | lanfer <lanfer@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2000-08-25 12:23:10 +0000 |
---|---|---|
committer | lanfer <lanfer@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2000-08-25 12:23:10 +0000 |
commit | fc2408a04ec4422b3617446f7de95369e6740d1e (patch) | |
tree | 083c00f1800773ec712102efc0b85a0a88e3da99 /src/CoordinateStuff.c | |
parent | 1b44d542df1481f4636196d101a9cdced4f286bb (diff) |
bug fix: ghostzones not treated properly
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveBinarySource/trunk@12 b9286e40-80fe-41ab-903a-d6b447012e1e
Diffstat (limited to 'src/CoordinateStuff.c')
-rw-r--r-- | src/CoordinateStuff.c | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/src/CoordinateStuff.c b/src/CoordinateStuff.c index de22af4..6173e0f 100644 --- a/src/CoordinateStuff.c +++ b/src/CoordinateStuff.c @@ -11,13 +11,11 @@ @author Gerd Lanfermann @desc For a given physical, global coordinate, IndexFloor returns - the closest lower grid index *locally* in the direction d, - which is owned by the grid path. (Ghostzone are not owned!) + the closest lower grid index *locally* in the direction d, + this includes ghostzones; + Other return values: -1 : gridindex not on this gridpatch - -3 : coordinate is outside global grid - - This routine and the Fortran wrapper are Fortran/C index aware. @enddesc @calls @calledby @@ -30,7 +28,7 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) { - int index_low,idummy,ugs,lgs; + int index_low,idummy; char *message; CCTK_REAL cmin,cmax; @@ -56,20 +54,10 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) idummy = floor((coord_value-cmin)/ GH->cctk_delta_space[d]); index_low = idummy-GH->cctk_lbnd[d]; - if (GH->cctk_bbox[2*d]==1) - lgs = 0; - else - lgs = GH->cctk_nghostzones[d]; - - if (GH->cctk_bbox[2*d+1]==1) - ugs = 0; - else - ugs = GH->cctk_nghostzones[d]; - - if (index_low<lgs) + if (index_low<0) index_low = -1; - if (index_low>=GH->cctk_lsh[d]-ugs) + if (index_low>=GH->cctk_lsh[d]) index_low = -1; return(index_low); @@ -82,13 +70,10 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) @author Gerd Lanfermann @desc For a given physical, global coordinate, IndexCeil returns - the closest upper grid index *locally* in the direction d, - which is owned by the grid path. (Ghostzone are not owned!) + the closest upper grid index *locally* in the direction d + including ghostzones. Other return values: -1 : grid index not on this gridpatch - -3 : coordinate is outside global grid - - This routine and the Fortran wrapper are Fortran/C index aware. @enddesc @calls @calledby @@ -101,7 +86,7 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d) { - int index_up,idummy,ugs,lgs; + int index_up,idummy; char *message; CCTK_REAL cmin,cmax; @@ -127,21 +112,11 @@ int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d) idummy = ceil((coord_value-cmin)/ GH->cctk_delta_space[d]); index_up = idummy-GH->cctk_lbnd[d]; - - if (GH->cctk_bbox[2*d]==1) - lgs = 0; - else - lgs = GH->cctk_nghostzones[d]; - - if (GH->cctk_bbox[2*d+1]==1) - ugs = 0; - else - ugs = GH->cctk_nghostzones[d]; - - if (index_up<lgs) + + if (index_up<0) index_up = -1; - if (index_up>=GH->cctk_lsh[d]-ugs) + if (index_up>=GH->cctk_lsh[d]) index_up = -1; return(index_up); |