How do I get the global integer coordinates for a grid point (i.e. the ones that take into account refinement level)?
Cheers, Steve
Steve
I assume you refer to the integer coordinates where the coarse grid points may have a large stride (e.g. 512).
Assume you have a grid point with index i,j,k in C. These are the process-local indices.
First you calculate the global indices as gi=cctk_lbnd[0]+i, gj=cctk_lbnd[1]+j, etc. These are global, but still per refinement level. This convention was introduced by PUGH.
Next you need to scale by the refinement factor of the current level, which is cctk_levfac[0], cctk_levfac[1], etc. This scale factor is 1 for the coarsest level.
Finally, you many need to add an offset. This offset can be a rational number, since coarse and fine grid points do not coincide for cell-centred refinement. This rational number is cctk_levoff[0] / cctk_levoffdenom[0] etc. This offset also needs to be scaled by cctk_levfac.
Given that you divide by cctk_levfac and cctk_levoffdenom, the result may not be integer. Carpet thus multiplies everything by a large integer to ensure that the result is integer. I don't think this integer is stored in the cGH structure. This integer is probably 2^(maxreflevels-1) for vertex-centred and 2^maxreflevels for cell-centred grids. It is stored e.g. in the gh structure as the stride of the coarsest level. You can access this stride via
const ibbox &baseext = vhh.AT(map)->baseextents.AT(mglevel).AT(reflevel);
where you set map, mglevel, reflevel = 0. Then baseext.stride()[0] is the stride in the i direction.
-erik
On Mon, Jan 11, 2016 at 1:52 PM, Steven R. Brandt sbrandt@cct.lsu.edu wrote:
How do I get the global integer coordinates for a grid point (i.e. the ones that take into account refinement level)?
Cheers, Steve _______________________________________________ Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
users@lists.einsteintoolkit.org