SUBROUTINE ReallocateRealArray(Array,ArrayMax,ArrayInc)
! SUBROUTINE INFORMATION:
! AUTHOR Linda K. Lawrie
! DATE WRITTEN October 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine reallocates (preserving data) a REAL(r64) array.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
REAL(r64), ALLOCATABLE, DIMENSION(:), INTENT(INOUT) :: Array
INTEGER, INTENT(INOUT) :: ArrayMax ! Current and resultant dimension for Array
INTEGER, INTENT(IN) :: ArrayInc ! increment for redimension
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64), DIMENSION(:), ALLOCATABLE :: NewArray
ALLOCATE(NewArray(ArrayMax+ArrayInc))
NewArray=0.0d0
IF (ArrayMax > 0) THEN
NewArray(1:ArrayMax)=Array(1:ArrayMax)
ENDIF
DEALLOCATE(Array)
ArrayMax=ArrayMax+ArrayInc
ALLOCATE(Array(ArrayMax))
Array=NewArray
DEALLOCATE(NewArray)
RETURN
END SUBROUTINE ReallocateRealArray