This function delivers of TreeID, which child number it is from its parent
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | TreeID |
current treeID |
result of function containing child number
elemental function tem_childNumber( TreeID ) result(res) ! --------------------------------------------------------------------------- !> current treeID integer(kind=long_k), intent(in) :: TreeID !> result of function containing child number integer :: res ! --------------------------------------------------------------------------- integer(kind=long_k) :: offset ! --------------------------------------------------------------------------- ! offset = ((treeID-1)/8) * 8 offset = ishft((TreeID-1_long_k), -3) * 8_long_k res = int( TreeID - offset ) end function tem_childNumber