GlobalToLocalIndices Interface

public interface GlobalToLocalIndices

Module Procedures

private subroutine GlobalSegMapToIndices_(GSMap, comm, start, length)

Arguments

Type IntentOptional Attributes Name
type(GlobalSegMap), intent(in) :: GSMap
integer, intent(in) :: comm
integer, dimension(:), pointer :: start
integer, dimension(:), pointer :: length

private subroutine GlobalSegMapToNavigator_(GSMap, comm, oNav)

Arguments

Type IntentOptional Attributes Name
type(GlobalSegMap), intent(in) :: GSMap
integer, intent(in) :: comm
type(Navigator), intent(out) :: oNav

private subroutine GlobalSegMapToIndexArr_(GSMap, i_global, i_local, nindex, comm)

determine the global segments on this processor just once, so the info be used repeatedly below

this loop is optimized for the case that the indices in iglobal() are in the same order that they appear in the global segments, which seems usually (always?) to be the case.

note that the j loop exit condition is only executed when the index is not found in the current segment, which saves a factor of 2 since many consecutive indices are in the same segment.

!! this version vectorizes (outer loop) !! performance for in-order input is slightly slower than the above !! but performance on out-of-order input is probably much better !! at the moment we are going on the assumption that caller is !! likely providing in-order, so we won't use this version.

do i=1,nindex

i_local(i)= -1

SEARCH_LOOP: do j=1,nlseg

  if ( (mygs_lb(j) <= i_global(i)) .and. &
       (i_global(i) <= mygs_ub(j))) then
    i_local(i) = mygs_lstart(j) + (i_global(i) - mygs_lb(j))
  endif

end do SEARCH_LOOP

end do

Arguments

Type IntentOptional Attributes Name
type(GlobalSegMap), intent(in) :: GSMap
integer, intent(in) :: i_global(:)
integer, intent(out) :: i_local(:)
integer, intent(in) :: nindex
integer, intent(in) :: comm