find_rightmost_link Subroutine

private subroutine find_rightmost_link(iglo, iglo_right, ipright)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iglo
integer, intent(out) :: iglo_right
integer, intent(out) :: ipright

Contents

Source Code


Source Code

  subroutine find_rightmost_link (iglo, iglo_right, ipright)
    use gs2_layouts, only: it_idx,ik_idx,g_lo,il_idx,ie_idx,is_idx,idx,proc_id
    use kt_grids, only: get_rightmost_it
    implicit none
    integer, intent (in) :: iglo
    integer, intent (out) :: iglo_right, ipright
    integer :: iglo_star
    integer :: it_cur,ik,it,il,ie,is
    iglo_star = iglo
    it_cur=it_idx(g_lo,iglo)
    ik=ik_idx(g_lo,iglo)
    it=it_cur

    !Now get the rightmost it
    it_cur=get_rightmost_it(it,ik)

    !If we're at the same it then don't need to do much
    if (it == it_cur) then
       iglo_right=iglo
       ipright=proc_id(g_lo,iglo)
       return
    end if

    !If not then we need to calculate iglo_left and ipleft
    il=il_idx(g_lo,iglo)
    ie=ie_idx(g_lo,iglo)
    is=is_idx(g_lo,iglo)
    iglo_right=idx(g_lo,ik,it_cur,il,ie,is)
    ipright=proc_id(g_lo,iglo_right)

  end subroutine find_rightmost_link