truncate_ga_char Subroutine

public subroutine truncate_ga_char(me)

Arguments

Type IntentOptional Attributes Name
type(grw_chararray_type) :: me

Called by

proc~~truncate_ga_char~~CalledByGraph proc~truncate_ga_char truncate_ga_char interface~truncate~18 truncate interface~truncate~18->proc~truncate_ga_char proc~destroy_intpmatrixlsf destroy_intpMatrixLSF proc~destroy_intpmatrixlsf->interface~truncate~18 proc~setup_indices_spacetime setup_indices_spacetime proc~setup_indices_spacetime->interface~truncate~18 interface~tem_spatial_storeval tem_spatial_storeVal proc~setup_indices_spacetime->interface~tem_spatial_storeval proc~tem_opvar_fill_inputindex tem_opVar_fill_inputIndex proc~tem_opvar_fill_inputindex->interface~truncate~18 proc~tem_opvar_setupindices tem_opVar_setupIndices proc~tem_opvar_setupindices->interface~truncate~18 proc~tem_opvar_setupindices->proc~tem_opvar_fill_inputindex proc~tem_spatial_scalar_storeval tem_spatial_scalar_storeVal proc~tem_spatial_scalar_storeval->interface~truncate~18 proc~tem_spatial_vector_storeval tem_spatial_vector_storeVal proc~tem_spatial_vector_storeval->interface~truncate~18 proc~truncate_grwpoints truncate_grwPoints proc~truncate_grwpoints->interface~truncate~18 proc~truncate_intpmatrixlsf truncate_intpMatrixLSF proc~truncate_intpmatrixlsf->interface~truncate~18 interface~destroy~10 destroy interface~destroy~10->proc~destroy_intpmatrixlsf interface~tem_spatial_storeval->proc~tem_spatial_scalar_storeval interface~tem_spatial_storeval->proc~tem_spatial_vector_storeval interface~truncate~25 truncate interface~truncate~25->proc~truncate_grwpoints interface~truncate~8 truncate interface~truncate~8->proc~truncate_intpmatrixlsf

Source Code

  subroutine truncate_ga_char(me)
    !------------------------------------------------------------------------
    type(grw_chararray_type) :: me !< array to truncate
    !------------------------------------------------------------------------
    character, 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_char