tem_appendIntLongArrayTo1dArray Subroutine

private subroutine tem_appendIntLongArrayTo1dArray(Array, ArrayToAppend)

append an entry to an allocatable array 1d with long integer If the array is too small, reallocate with double size

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(inout), allocatable :: Array(:)

array to append to

integer(kind=long_k), intent(in) :: ArrayToAppend(:)

array to append


Called by

proc~~tem_appendintlongarrayto1darray~~CalledByGraph proc~tem_appendintlongarrayto1darray tem_appendIntLongArrayTo1dArray interface~append~2 append interface~append~2->proc~tem_appendintlongarrayto1darray proc~tem_calc_vrtx_coord tem_calc_vrtx_coord proc~tem_calc_vrtx_coord->interface~append~2 proc~tem_unify_vrtx tem_unify_vrtx proc~tem_calc_vrtx_coord->proc~tem_unify_vrtx proc~tem_findelement tem_findElement proc~tem_findelement->interface~append~2 proc~tem_findelement->proc~tem_findelement proc~tem_findpath tem_findPath proc~tem_findpath->interface~append~2 proc~tem_findpath->proc~tem_findpath proc~tem_unify_vrtx->interface~append~2 proc~hvs_output_init hvs_output_init proc~hvs_output_init->proc~tem_calc_vrtx_coord proc~tem_init_tracker tem_init_tracker proc~tem_init_tracker->proc~hvs_output_init

Source Code

  subroutine tem_appendIntLongArrayTo1dArray(Array, ArrayToAppend )
    ! ---------------------------------------------------------------------------
    !> array to append to
    integer(kind=long_k),intent(inout), allocatable :: Array(:)
    !> array to append
    integer(kind=long_k),intent(in) :: ArrayToAppend(:)
    ! ---------------------------------------------------------------------------
    integer(kind=long_k),allocatable :: tempArray(:)
    integer(kind=long_k) :: ArraySize,ArraySize2,ierr,NewSize
    ! ---------------------------------------------------------------------------

    ! Get size of array
    ArraySize  = size(Array,1)
    ArraySize2 = size(ArrayToAppend,1)

    NewSize = ArraySize + ArraySize2
    ! allocate temporary array with new size
    allocate(tempArray(NewSize),stat=ierr)
    ! Copy both arrays to temp array
    tempArray(1:ArraySize) = Array(1:ArraySize)
    tempArray(ArraySize+1:ArraySize+ArraySize2) = ArrayToAppend(1:ArraySize2)
    ! Deallocate Array
    deallocate(Array)
    ! Reallocate Array
    allocate(Array(NewSize),stat=ierr)
    Array(1:NewSize) = tempArray(1:NewSize)
    ! Deallocate temp array
    deallocate(tempArray)
    if(ierr .ne. 0) Write(*,*) 'Error in reallocating array'

  end subroutine tem_appendIntLongArrayTo1dArray