truncate_da_int Subroutine

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

Called by

proc~~truncate_da_int~~CalledByGraph proc~truncate_da_int truncate_da_int interface~truncate~7 truncate interface~truncate~7->proc~truncate_da_int

Contents

Source Code


Source Code

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