truncate_da_real Subroutine

public subroutine truncate_da_real(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_realarray_type) :: me

Called by

proc~~truncate_da_real~~CalledByGraph proc~truncate_da_real truncate_da_real interface~truncate~8 truncate interface~truncate~8->proc~truncate_da_real

Contents

Source Code


Source Code

  subroutine truncate_da_real(me)
    !------------------------------------------------------------------------
    type(dyn_realarray_type) :: me !< array to sorttruncate
    !------------------------------------------------------------------------
    real(kind=rk), 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_real