tem_invertRealRkArray Subroutine

private subroutine tem_invertRealRkArray(me, nElems)

Invert a given array 1 2 3 4 5 -> 5 4 3 2 1

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(inout) :: me(:,:)

array to invert

integer, intent(in) :: nElems

number of elements in the array


Called by

proc~~tem_invertrealrkarray~~CalledByGraph proc~tem_invertrealrkarray tem_invertRealRkArray proc~tem_calc_vrtx_coord tem_calc_vrtx_coord proc~tem_calc_vrtx_coord->proc~tem_invertrealrkarray proc~hvs_output_init hvs_output_init proc~hvs_output_init->proc~tem_calc_vrtx_coord proc~tem_init_tracker tem_init_tracker proc~tem_init_tracker->proc~hvs_output_init

Source Code

  subroutine tem_invertRealRkArray( me, nElems )
    ! ---------------------------------------------------------------------------
    !> array to invert
    real(kind=rk), intent(inout) :: me(:,:)
    !> number of elements in the array
    integer, intent(in) :: nElems
    ! ---------------------------------------------------------------------------
    real(kind=rk) :: tmp_entry(3)
    integer :: maxPos, minPos
    ! ---------------------------------------------------------------------------

    minPos = 1
    maxPos = nElems
    do while( minPos .lt. maxPos )
      tmp_entry = me( :, minPos )
      me( :, minPos ) = me( :, maxPos )
      me( :, maxPos ) = tmp_entry
      minPos = minPos + 1
      maxPos = maxPos - 1
    end do

  end subroutine tem_invertRealRkArray