Module name: reallocate
Author: Dean Hinshaw (NASA/GFSC, dah@milkyway.gsfc.nasa.gov)
This subroutine can be used to reallocate memory space for a pointer to an array, retaining any data already stored in the array. The calling sequence is:
SUBROUTINE realloc_real32(p, n) INTEGER, INTENT(in) :: n
where p can have any of the possible specifications:
REAL(KIND=single), POINTER, DIMENSION(:) :: p REAL(KIND=double), POINTER, DIMENSION(:) :: p INTEGER(KIND=int8), POINTER, DIMENSION(:) :: p INTEGER(KIND=int16), POINTER, DIMENSION(:) :: p INTEGER(KIND=int32), POINTER, DIMENSION(:) :: p LOGICAL(KIND=bool), POINTER, DIMENSION(:) :: p CHARACTER(LEN=*), POINTER, DIMENSION(:) :: p
and n is the size of the reallocated array. The lower bound value of the old array is retained.
If n is greater than the original array size, then the all data from the old array is retained, and the array values greater then the original array size are undefined. If n is less than the original array size, then the first n data elements from the old array are retained.