demorton2D Subroutine

public elemental subroutine demorton2D(code, i, j, b)

Decode 1 integer (64 bits) Morton's code into 2 integer (32 bits) indexes.

Arguments

Type IntentOptional AttributesName
integer(kind=I8P), intent(in) :: code

Morton's code.

integer(kind=I4P), intent(inout) :: i

I index.

integer(kind=I4P), intent(inout) :: j

J index.

integer(kind=I2P), intent(in), optional :: b

Number of significant bits of 'i' (2/4/8/16/32).

Calls

proc~~demorton2d~~CallsGraph proc~demorton2d demorton2D proc~contract contract proc~demorton2d->proc~contract
Help

Source Code


Source Code

  elemental subroutine demorton2D(code, i, j, b)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Decode 1 integer (64 bits) Morton's code into 2 integer (32 bits) indexes.
  !---------------------------------------------------------------------------------------------------------------------------------
  integer(I8P), intent(in)           :: code !< Morton's code.
  integer(I4P), intent(inout)        :: i    !< I index.
  integer(I4P), intent(inout)        :: j    !< J index.
  integer(I2P), intent(in), optional :: b    !< Number of significant bits of 'i' (2/4/8/16/32).
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  if (present(b)) then
    call contract(i=code,           b=b, z=1_I1P, c=i)
    call contract(i=ishft(code,-1), b=b, z=1_I1P, c=j)
  else
    call contract(i=code,           b=32_I2P, z=1_I1P, c=i)
    call contract(i=ishft(code,-1), b=32_I2P, z=1_I1P, c=j)
  endif
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine demorton2D