truncate_ga_dynlong Subroutine

public subroutine truncate_ga_dynlong(me)

Arguments

Type IntentOptional Attributes Name
type(grw_dynlongarray_type) :: me

Called by

proc~~truncate_ga_dynlong~~CalledByGraph proc~truncate_ga_dynlong truncate_ga_dynlong interface~truncate~2 truncate interface~truncate~2->proc~truncate_ga_dynlong proc~truncate_element truncate_element proc~truncate_element->interface~truncate~2 interface~truncate~38 truncate interface~truncate~38->proc~truncate_element

Contents

Source Code


Source Code

  subroutine truncate_ga_dynlong(me)
    !------------------------------------------------------------------------
    type(grw_dynlongarray_type) :: me !< array to truncate
    !------------------------------------------------------------------------
    type(dyn_longarray_type), allocatable :: tarray(:)
    !------------------------------------------------------------------------
    integer :: ii
    !------------------------------------------------------------------------

    ! nothing to do if container size is not larger than the number of values
    ! in the array.
    if (me%containersize > me%nvals) then
      allocate(tarray(me%nvals))
      do ii = 1, me%nvals
        tarray(ii) = me%val(ii)
      end do
      call move_alloc(tarray, me%val)
      me%containersize = me%nvals
    end if

  end subroutine truncate_ga_dynlong