sorttruncate_da_path Subroutine

public subroutine sorttruncate_da_path(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_patharray_type) :: me

Calls

proc~~sorttruncate_da_path~~CallsGraph proc~sorttruncate_da_path sorttruncate_da_path interface~append~7 append proc~sorttruncate_da_path->interface~append~7 interface~destroy~8 destroy proc~sorttruncate_da_path->interface~destroy~8 interface~init~7 init proc~sorttruncate_da_path->interface~init~7 proc~append_da_path append_da_path interface~append~7->proc~append_da_path proc~append_da_vecpath append_da_vecpath interface~append~7->proc~append_da_vecpath proc~destroy_da_path destroy_da_path interface~destroy~8->proc~destroy_da_path proc~init_da_path init_da_path interface~init~7->proc~init_da_path interface~expand~6 expand proc~append_da_path->interface~expand~6 interface~sortedposofval sortedposofval proc~append_da_path->interface~sortedposofval proc~append_da_vecpath->interface~expand~6 proc~expand_da_path expand_da_path interface~expand~6->proc~expand_da_path proc~sortposofval_path sortposofval_path interface~sortedposofval->proc~sortposofval_path

Called by

proc~~sorttruncate_da_path~~CalledByGraph proc~sorttruncate_da_path sorttruncate_da_path interface~sorttruncate sorttruncate interface~sorttruncate->proc~sorttruncate_da_path

Source Code

  subroutine sorttruncate_da_path(me)
    !------------------------------------------------------------------------
    type(dyn_patharray_type) :: me !< array to sorttruncate
    !------------------------------------------------------------------------
    type(dyn_patharray_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_path