tem_SiblingsOfId Function

public function tem_SiblingsOfId(TreeID) result(siblings)

This function delivers all sibling treeIDs of TreeID in an array

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(in) :: TreeID

current treeID

Return Value integer(kind=long_k), (7)

treeIDs siblings


Source Code

  function tem_SiblingsOfId( TreeID ) result(siblings)
    ! ---------------------------------------------------------------------------
    !> current treeID
    integer(kind=long_k), intent(in) :: TreeID
    !> treeIDs siblings
    integer(kind=long_k) :: siblings(7)
    ! ---------------------------------------------------------------------------
    integer :: myNumber, iElem, i
    integer(kind=long_k) :: offset
    ! ---------------------------------------------------------------------------

    offset   = ishft((TreeID-1_long_k), -3) * 8_long_k
    myNumber = int( TreeID - offset )
    iElem = 0
    do i = 1,8
      if( i /= myNumber ) then
        iElem = iElem + 1
        siblings( iElem ) = offset + int(i,long_k)
      endif
    enddo

  end function tem_SiblingsOfId