sorttruncate_da_int Subroutine

public subroutine sorttruncate_da_int(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_intarray_type) :: me

Calls

proc~~sorttruncate_da_int~~CallsGraph proc~sorttruncate_da_int sorttruncate_da_int interface~init~9 init proc~sorttruncate_da_int->interface~init~9 interface~append~9 append proc~sorttruncate_da_int->interface~append~9 interface~destroy~9 destroy proc~sorttruncate_da_int->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_int~~CalledByGraph proc~sorttruncate_da_int sorttruncate_da_int interface~sorttruncate~3 sorttruncate interface~sorttruncate~3->proc~sorttruncate_da_int

Contents

Source Code


Source Code

  subroutine sorttruncate_da_int(me)
    !------------------------------------------------------------------------
    type(dyn_intarray_type) :: me !< array to sorttruncate
    !------------------------------------------------------------------------
    type(dyn_intarray_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_int