diff options
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); |