Compute the 2 indices from a Morton index Adapted from archer2 cpp course
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int64), | intent(in) | :: | z |
Morton Index |
||
integer(kind=int32), | intent(out) | :: | x |
The computed indices |
||
integer(kind=int32), | intent(out) | :: | y |
The computed indices |
subroutine decode(z, x, y) !! Compute the 2 indices from a Morton index !! Adapted from archer2 cpp [course](https://github.com/EPCCed/archer2-cpp/tree/main/exercises/morton-order) !> Morton Index integer(kind=int64), intent(in) :: z !> The computed indices integer(kind=int32), intent(out) :: x, y integer(kind=int64) :: i, j i = z x = pack_bits(i) j = rshift(z, 1) y = pack_bits(j) end subroutine decode