tem_resizeIntLong2dArray Subroutine

private subroutine tem_resizeIntLong2dArray(Array, Newsize1, Newsize2)

append an entry to an allocatable array 2d 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 resize

integer, intent(in) :: Newsize1

first new size

integer, intent(in) :: Newsize2

second new size


Called by

proc~~tem_resizeintlong2darray~~CalledByGraph proc~tem_resizeintlong2darray tem_resizeIntLong2dArray interface~resize resize interface~resize->proc~tem_resizeintlong2darray

Source Code

  subroutine tem_resizeIntLong2dArray( Array, Newsize1, Newsize2 )
    ! ---------------------------------------------------------------------------
    !> array to resize
    integer(kind=long_k),intent(inout), allocatable :: Array(:,:)
    !> first new size
    integer,intent(in) :: Newsize1
    !> second new size
    integer,intent(in) :: Newsize2
    ! ---------------------------------------------------------------------------
    integer(kind=long_k),allocatable :: tempArray(:,:)
    integer :: ierr
    ! ---------------------------------------------------------------------------

    ! allocate temporary array with new size
    allocate(tempArray(NewSize1,NewSize2),stat=ierr)
    ! Copy to temp array
    tempArray(1:NewSize1,1:NewSize2) = Array(1:NewSize1,1:NewSize2)
    ! Deallocate Array
    deallocate(Array)
    ! Reallocate Array
    allocate(Array(NewSize1,Newsize2),stat=ierr)
    ! Deallocate temp array
    Array(1:NewSize1,1:NewSize2) = tempArray(1:NewSize1,1:NewSize2)
    deallocate(tempArray)
    if(ierr .ne. 0) Write(*,*) 'Error in reallocating array'

  end subroutine tem_resizeIntLong2dArray