1274 type(CharacterStringType), dimension(:), pointer, contiguous, &
1275 intent(inout) :: acharstr1d
1276 integer(I4B), intent(in) :: ilen
1277 integer(I4B), intent(in) :: nrow
1278 character(len=*), intent(in) :: name
1279 character(len=*), intent(in) :: mem_path
1280
1281 type(MemoryType), pointer :: mt
1282 logical(LGP) :: found
1283 type(CharacterStringType), dimension(:), allocatable :: astrtemp
1284 character(len=ilen) :: string
1285 integer(I4B) :: istat
1286 integer(I4B) :: isize
1287 integer(I4B) :: isize_old
1288 integer(I4B) :: nrow_old
1289 integer(I4B) :: n
1290
1291
1292 string = ''
1293
1294
1295 call get_from_memorystore(name, mem_path, mt, found)
1296
1297
1298 if (found) then
1299 isize_old = mt%isize
1300 if (isize_old > 0) then
1301 nrow_old = size(acharstr1d)
1302 else
1303 nrow_old = 0
1304 end if
1305
1306
1307 isize = nrow
1308
1309
1310 allocate (astrtemp(nrow), stat=istat, errmsg=errmsg)
1311 if (istat /= 0) then
1312 call allocate_error(name, mem_path, istat, isize)
1313 end if
1314
1315
1316 do n = 1, min(nrow_old, nrow)
1317 astrtemp(n) = acharstr1d(n)
1318 call acharstr1d(n)%destroy()
1319 end do
1320
1321
1322 do n = nrow + 1, nrow_old
1323 call acharstr1d(n)%destroy()
1324 end do
1325
1326
1327 do n = nrow_old + 1, nrow
1328 astrtemp(n) = string
1329 end do
1330
1331
1332 deallocate (acharstr1d)
1333
1334
1335 allocate (acharstr1d(nrow), stat=istat, errmsg=errmsg)
1336 if (istat /= 0) then
1337 call allocate_error(name, mem_path, istat, isize)
1338 end if
1339
1340
1341 do n = 1, nrow
1342 acharstr1d(n) = astrtemp(n)
1343 call astrtemp(n)%destroy()
1344 end do
1345
1346
1347 deallocate (astrtemp)
1348
1349
1350 mt%acharstr1d => acharstr1d
1351 mt%element_size = ilen
1352 mt%isize = isize
1353 mt%nrealloc = mt%nrealloc + 1
1354 mt%master = .true.
1355 nvalues_astr = nvalues_astr + isize - isize_old
1356 write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, nrow
1357 else
1358 errmsg = "Programming error, variable '"//trim(name)//"' from '"// &
1359 trim(mem_path)//"' is not defined in the memory manager. Use "// &
1360 "mem_allocate instead."
1361 call store_error(errmsg, terminate=.true.)
1362 end if