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~append~29 append proc~sorttruncate_da_real->interface~append~29 interface~destroy~30 destroy proc~sorttruncate_da_real->interface~destroy~30 interface~init~29 init proc~sorttruncate_da_real->interface~init~29 proc~append_da_label append_da_label interface~append~29->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~29->proc~append_da_veclabel proc~destroy_da_label destroy_da_label interface~destroy~30->proc~destroy_da_label proc~init_da_label init_da_label interface~init~29->proc~init_da_label interface~expand~27 expand proc~append_da_label->interface~expand~27 interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 proc~append_da_veclabel->interface~expand~27 proc~expand_da_label expand_da_label interface~expand~27->proc~expand_da_label proc~sortposofval_label sortposofval_label interface~sortedposofval~5->proc~sortposofval_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

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