HaloSiftDown Subroutine

public subroutine HaloSiftDown(keys, elems, sides, flips, ranks, start, last)

Arguments

TypeIntentOptionalAttributesName
integer(kind=int64), intent(inout) :: keys(:)
integer, intent(inout) :: elems(:)
integer, intent(inout) :: sides(:)
integer, intent(inout) :: flips(:)
integer, intent(inout) :: ranks(:)
integer, intent(in) :: start
integer, intent(in) :: last

Calls

proc~~halosiftdown~~CallsGraph proc~halosiftdown HaloSiftDown proc~haloswap HaloSwap proc~halosiftdown->proc~haloswap

Called by

proc~~halosiftdown~~CalledByGraph proc~halosiftdown HaloSiftDown proc~halokeysort HaloKeySort proc~halokeysort->proc~halosiftdown proc~buildhaloexchange_domaindecomposition BuildHaloExchange_DomainDecomposition proc~buildhaloexchange_domaindecomposition->proc~halokeysort

Contents

Source Code


Source Code

  subroutine HaloSiftDown(keys,elems,sides,flips,ranks,start,last)
    implicit none
    integer(int64),intent(inout) :: keys(:)
    integer,intent(inout) :: elems(:),sides(:),flips(:),ranks(:)
    integer,intent(in) :: start,last
    ! Local
    integer :: root,child

    root = start
    do while(2*root <= last)
      child = 2*root
      if(child < last) then
        if(keys(child) < keys(child+1)) child = child+1
      endif
      if(keys(root) < keys(child)) then
        call HaloSwap(keys,elems,sides,flips,ranks,root,child)
        root = child
      else
        return
      endif
    enddo

  endsubroutine HaloSiftDown