module kinds_modSubroutines and functions:
public pure subroutine morton2d_c2i (lev, p, idx) public pure subroutine morton2d_i2c (lev, idx, p) public pure subroutine morton_c2i (lev, p, idx)
Uses simple bit-interleaving algorithm as described in M.J. Aftosmis, M.J. Berger and S.M. Murman, "Applications of Space-Filling Curves to Cartesian Methods for CFD", 2004
Routines accept position and morton-index starting at 1!
Author: Matthias Lieber
public pure subroutine morton2d_c2i (lev, p, idx) integer (kind=i_k), intent(in) :: lev integer (kind=i_k), intent(in), dimension (2) :: p integer (kind=i_k), intent(out) :: idx end subroutine morton2d_c2iParameters:
lev | level of the morton curve (1=2x2, 2=4x4, 3=8x8, etc) |
p | 2D coordinates [1 ... 2^lev] |
idx | index on the 2D morton curve [1 ... (2^lev)^2] |
Has logarithmic complexity: number of loop iterations = lev. Due to performance reasons, no checking of arguments is performend!
public pure subroutine morton2d_i2c (lev, idx, p) integer (kind=i_k), intent(in) :: lev integer (kind=i_k), intent(in) :: idx integer (kind=i_k), intent(out), dimension (2) :: p end subroutine morton2d_i2cParameters:
lev | level of the morton curve (1=2x2, 2=4x4, 3=8x8, etc) |
idx | index on the 2D morton curve [1 ... (2^lev)^2] |
p | 2D coordinates [1 ... 2^lev] |
Has logarithmic complexity: number of loop iterations = lev. Due to performance reasons, no checking of arguments is performend!
public pure subroutine morton_c2i (lev, p, idx) integer (kind=i_k), intent(in) :: lev integer (kind=i_k), intent(in), dimension (3) :: p integer (kind=i_k), intent(out) :: idx end subroutine morton_c2iParameters:
lev | level of the morton curve (1=2x2x2, 2=4x4x4, 3=8x8x8, etc) |
p | 3D coordinates [1 ... 2^lev] |
idx | index on the 3D morton curve [1 ... (2^lev)^3] |
Has logarithmic complexity: number of loop iterations = lev. Due to performance reasons, no checking of arguments is performend!