truncate_da_path Subroutine

public subroutine truncate_da_path(me)

truncate the array after the last valid entry and hence cut off the empty trailing empty entries

Arguments

Type IntentOptional Attributes Name
type(dyn_patharray_type) :: me

Called by

proc~~truncate_da_path~~CalledByGraph proc~truncate_da_path truncate_da_path interface~truncate~3 truncate interface~truncate~3->proc~truncate_da_path

Source Code

  subroutine truncate_da_path(me)
    !------------------------------------------------------------------------
    type(dyn_patharray_type) :: me !< array to sorttruncate
    !------------------------------------------------------------------------
    type(tem_path_type), allocatable :: swpval(:)
    integer, allocatable :: swpsort(:)
    !------------------------------------------------------------------------

    if (me%nvals < me%containersize) then
      allocate(swpval(me%nvals))
      allocate(swpsort(me%nvals))

      swpval = me%val(:me%nvals)
      swpsort = me%sorted(:me%nvals)

      call move_alloc(swpval, me%val)
      call move_alloc(swpsort, me%sorted)

      me%containersize = me%nvals
    end if

  end subroutine truncate_da_path