[Developers] How about changing avoid_origin* restricted ?

Erik Schnetter schnetter at cct.lsu.edu
Sat Apr 14 09:09:52 CDT 2007


On Apr 14, 2007, at 07:15:01, jtao at cct.lsu.edu wrote:

> It is sometime necessary to check if the grid contains origin.
> If avoid_origin parameters can be accessed directly,
> one doesn't have to do explicit checking. Is it ok to change
> those avoid_origin parameters restricted ?

I'm afraid that this would not work in the general case.  Even  
CartGrid3D ignores the avoid_origin parameter under certain  
circumstances.  CoordBase does not take them into account.  With mesh  
refinement, avoid_origin describes only the coarsest grid, and finer  
grids can have different behaviour.  avoid_origin is meant for a  
human being to give instructions to CartGrid3D.  It is not a good  
idea to use it to draw conclusions about how the grid is laid out in  
the end.

Instead, you can calculate the quantity

CCTK_REAL nx0 = (0.0 - CCTK_ORIGIN_SPACE(0)) / CCTK_DELTA_SPACE(0)

and test whether it is integer or not:

if (fabs (nx0 - floor(nx0)) < 0.01) /* grid point at origin */

else if (fabs (nx0 - floor(nx0) + 0.5) < 0.01) /* staggered about  
origin */

else /* no definite relation */

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20070414/54370910/attachment.bin 


More information about the Developers mailing list