tem_posOfLong Function

private pure function tem_posOfLong(long, array) result(pos)

This function detects the first position of an integer value of kind long_k in an array. When there is no match the return value is 0.

Arguments

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

Return Value integer


Source Code

  pure function tem_posOfLong( long, array ) result( pos )
    ! ---------------------------------------------------------------------------
    integer(kind=long_k), intent(in) :: long
    integer(kind=long_k), intent(in) :: array(:)
    integer :: pos
    ! ---------------------------------------------------------------------------
    integer :: iEntry
    ! ---------------------------------------------------------------------------

    do iEntry = 1, size(array)
      if( long == array(iEntry))then
        pos = iEntry
        return
      end if
    end do

    pos = 0

  end function tem_posOfLong