sort_index Subroutine

public subroutine sort_index(X, IA, rc)

Uses

  • proc~~sort_index~~UsesGraph proc~sort_index sort_index module~mapl_sortmod MAPL_SortMod proc~sort_index->module~mapl_sortmod iso_fortran_env iso_fortran_env module~mapl_sortmod->iso_fortran_env module~mapl_exceptionhandling MAPL_ExceptionHandling module~mapl_sortmod->module~mapl_exceptionhandling module~mapl_errorhandlingmod MAPL_ErrorHandlingMod module~mapl_exceptionhandling->module~mapl_errorhandlingmod module~mapl_throwmod MAPL_ThrowMod module~mapl_exceptionhandling->module~mapl_throwmod module~mapl_errorhandlingmod->module~mapl_throwmod mpi mpi module~mapl_errorhandlingmod->mpi

Arguments

Type IntentOptional Attributes Name
real(kind=ESMF_KIND_R8), intent(in) :: X(:)
integer, intent(out) :: IA(:)
integer, intent(out), optional :: rc

Calls

proc~~sort_index~~CallsGraph proc~sort_index sort_index interface~mapl_assert MAPL_Assert proc~sort_index->interface~mapl_assert interface~mapl_sort MAPL_Sort proc~sort_index->interface~mapl_sort proc~mapl_return MAPL_Return proc~sort_index->proc~mapl_return at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception

Source Code

  subroutine sort_index (X, IA, rc)
    use MAPL_SortMod
    real(ESMF_KIND_R8), intent(in) :: X(:)
    integer, intent(out) :: IA(:)            ! index
    integer, optional, intent(out) :: rc

    integer :: i, len
    integer(ESMF_KIND_I8), allocatable :: IX(:)

    _ASSERT (size(X)==size(IA), 'X and IA (its index) differ in dimension')
    len = size (X)
    allocate (IX(len))
    do i=1, len
       IX(i)=X(i)
       IA(i)=i
    enddo
    call MAPL_Sort(IX,IA)
    _RETURN(_SUCCESS)

  end subroutine sort_index