sorttruncate_da_real Subroutine

public subroutine sorttruncate_da_real(me)

fixing the dynamic array

truncate the array after the last valid entry and hence cut off the empty trailing empty entries store the array in the sorted order according to the sorted( ) array

Arguments

Type IntentOptional Attributes Name
type(dyn_realarray_type) :: me

Calls

proc~~sorttruncate_da_real~~CallsGraph proc~sorttruncate_da_real sorttruncate_da_real interface~init~9 init proc~sorttruncate_da_real->interface~init~9 interface~append~9 append proc~sorttruncate_da_real->interface~append~9 interface~destroy~9 destroy proc~sorttruncate_da_real->interface~destroy~9 proc~init_da_label init_da_label interface~init~9->proc~init_da_label proc~append_da_label append_da_label interface~append~9->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~9->proc~append_da_veclabel proc~destroy_da_label destroy_da_label interface~destroy~9->proc~destroy_da_label interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 interface~expand~9 expand proc~append_da_label->interface~expand~9 proc~append_da_veclabel->interface~expand~9 proc~sortposofval_label sortposofval_label interface~sortedposofval~5->proc~sortposofval_label proc~expand_da_label expand_da_label interface~expand~9->proc~expand_da_label

Called by

proc~~sorttruncate_da_real~~CalledByGraph proc~sorttruncate_da_real sorttruncate_da_real interface~sorttruncate~4 sorttruncate interface~sorttruncate~4->proc~sorttruncate_da_real

Contents

Source Code


Source Code

  subroutine sorttruncate_da_real(me)
    !------------------------------------------------------------------------
    type(dyn_realarray_type) :: me !< array to sorttruncate
    !------------------------------------------------------------------------
    type(dyn_realarray_type) :: tarray !< temporary array
    integer :: ival
    integer :: dpos
    !------------------------------------------------------------------------
    ! allocate the temporary array
    call init( me = tarray, length = me%nvals )
    ! copy the entries in a sorted fashion into the temporary array
    do ival = 1, me%nvals
      call append( me = tarray, val = me%val( me%sorted( ival )), &
           &       pos = dpos)
    enddo
    call destroy( me = me )

    me = tarray
    call destroy( me = tarray )

  end subroutine sorttruncate_da_real