70 SUBROUTINE reallocate_int( array, newSize, errorMessage, ERR, ERROR, * )
71 INTEGER(INTG),
ALLOCATABLE,
INTENT(INOUT) :: array(:)
72 INTEGER(INTG),
INTENT(IN) :: newSize
73 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
74 INTEGER(INTG),
INTENT(OUT) :: ERR
75 TYPE(varying_string),
INTENT(OUT) :: ERROR
77 enters(
"REALLOCATE_INT",err,error,*999)
79 IF(
ALLOCATED( array ) )
THEN 83 ALLOCATE( array( newsize ), stat = err )
84 IF( err /= 0 )
CALL flagerror( errormessage, err, error, *999)
88 exits(
"REALLOCATE_INT")
90 999 errorsexits(
"REALLOCATE_INT",err,error)
97 SUBROUTINE reallocate_real( array, newSize, errorMessage, ERR, ERROR, * )
98 REAL(DP),
ALLOCATABLE,
INTENT(INOUT) :: array(:)
99 INTEGER(INTG),
INTENT(IN) :: newSize
100 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
101 INTEGER(INTG),
INTENT(OUT) :: ERR
102 TYPE(varying_string),
INTENT(OUT) :: ERROR
104 enters(
"REALLOCATE_REAL",err,error,*999)
106 IF(
ALLOCATED( array ) )
THEN 110 ALLOCATE( array( newsize ), stat = err )
111 IF( err /= 0 )
CALL flagerror( errormessage, err, error, *999)
115 exits(
"REALLOCATE_REAL")
117 999 errorsexits(
"REALLOCATE_REAL",err,error)
125 TYPE(varying_string),
ALLOCATABLE,
INTENT(INOUT) :: array(:)
126 INTEGER(INTG),
INTENT(IN) :: newSize
127 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
128 INTEGER(INTG),
INTENT(OUT) :: ERR
129 TYPE(varying_string),
INTENT(OUT) :: ERROR
133 enters(
"REALLOCATE_STRING",err,error,*999)
135 IF(
ALLOCATED( array ) )
THEN 142 ALLOCATE( array( newsize ), stat = err )
143 IF( err /= 0 )
CALL flagerror( errormessage, err, error, *999)
145 exits(
"REALLOCATE_STRING")
147 999 errorsexits(
"REALLOCATE_STRING",err,error)
154 SUBROUTINE reallocate_2d( array, newSize1, newSize2, errorMessage, ERR, ERROR, * )
155 INTEGER(INTG),
ALLOCATABLE,
INTENT(INOUT) :: array(:,:)
156 INTEGER(INTG),
INTENT(IN) :: newSize1
157 INTEGER(INTG),
INTENT(IN) :: newSize2
158 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
159 INTEGER(INTG),
INTENT(OUT) :: ERR
160 TYPE(varying_string),
INTENT(OUT) :: ERROR
162 enters(
"REALLOCATE_2D",err,error,*999)
164 IF(
ALLOCATED( array ) )
THEN 168 ALLOCATE( array( newsize1, newsize2 ), stat = err )
169 IF( err /= 0 )
CALL flagerror( errormessage, err, error, *999)
173 exits(
"REALLOCATE_2D")
175 999 errorsexits(
"REALLOCATE_2D",err,error)
182 SUBROUTINE grow_array_int( array, delta, errorMessage, ERR, ERROR, * )
183 INTEGER(INTG),
ALLOCATABLE,
INTENT(INOUT) :: array(:)
184 INTEGER(INTG),
INTENT(IN) :: delta
185 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
186 INTEGER(INTG),
INTENT(OUT) :: ERR
187 TYPE(varying_string),
INTENT(OUT) :: ERROR
189 INTEGER(INTG),
ALLOCATABLE :: tempArray(:)
190 INTEGER(INTG) :: oldSize
192 enters(
"GROW_ARRAY_INT",err,error,*999)
194 IF( .NOT.
ALLOCATED( array ) )
THEN 195 CALL reallocate( array, delta, errormessage, err, error, *999 )
199 oldsize =
SIZE( array )
201 CALL reallocate( temparray, oldsize, errormessage, err, error, *999 )
203 temparray(:) = array(:)
205 CALL reallocate( array, oldsize + delta, errormessage, err, error, *999 )
207 array(1:oldsize) = temparray(:)
209 DEALLOCATE( temparray )
211 exits(
"GROW_ARRAY_INT")
213 999 errorsexits(
"GROW_ARRAY_INT",err,error)
220 SUBROUTINE grow_array_real( array, delta, errorMessage, ERR, ERROR, * )
221 REAL(C_DOUBLE),
ALLOCATABLE,
INTENT(INOUT) :: array(:)
222 INTEGER(INTG),
INTENT(IN) :: delta
223 CHARACTER(LEN=*),
INTENT(IN) :: errorMessage
224 INTEGER(INTG),
INTENT(OUT) :: ERR
225 TYPE(varying_string),
INTENT(OUT) :: ERROR
227 REAL(C_DOUBLE),
ALLOCATABLE :: tempArray(:)
228 INTEGER(INTG) :: oldSize
230 enters(
"GROW_ARRAY_REAL",err,error,*999)
232 IF( .NOT.
ALLOCATED( array ) )
THEN 233 CALL reallocate( array, delta, errormessage, err, error, *999 )
237 oldsize =
SIZE( array )
239 CALL reallocate( temparray, oldsize, errormessage, err, error, *999 )
241 temparray(:) = array(:)
243 CALL reallocate( array, oldsize + delta, errormessage, err, error, *999 )
245 array(1:oldsize) = temparray(:)
247 DEALLOCATE( temparray )
249 exits(
"GROW_ARRAY_REAL")
251 999 errorsexits(
"GROW_ARRAY_REAL",err,error)
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine reallocate_real(array, newSize, errorMessage, ERR, ERROR,)
Implements various dynamic array routines.
subroutine reallocate_2d(array, newSize1, newSize2, errorMessage, ERR, ERROR,)
subroutine, public exits(NAME)
Records the exit out of the named procedure.
This module contains all type definitions in order to avoid cyclic module references.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
subroutine reallocate_int(array, newSize, errorMessage, ERR, ERROR,)
subroutine reallocate_string(array, newSize, errorMessage, ERR, ERROR,)
subroutine grow_array_real(array, delta, errorMessage, ERR, ERROR,)
Flags an error condition.
subroutine grow_array_int(array, delta, errorMessage, ERR, ERROR,)