2D AMRCLAW
Functions/Subroutines
resize_alloc.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine resize_storage (new_size, status)
 

Function/Subroutine Documentation

◆ resize_storage()

subroutine resize_storage ( integer, intent(in)  new_size,
integer, intent(out)  status 
)

Definition at line 18 of file resize_alloc.f90.

References amr_module::alloc, and amr_module::memsize.

Referenced by igetsp().

18 
19  use amr_module
20  implicit none
21 
22  integer, intent(out) :: status
23  integer, intent(in) :: new_size
24 
25  real(kind=8), allocatable, target, dimension(:) :: new_storage
26 
27 
28  if (memsize < new_size) then
29  print *, "Expanding storage from ", memsize," to ", new_size
30  allocate(new_storage(new_size),stat=status)
31  if (status > 0) then
32  return
33  endif
34 ! new_storage(1:memsize) = storage !old way, changed mjb sept. 2014
35  new_storage(1:memsize) = alloc ! new way, use allocatable, not pointer
36 
37 ! call move_alloc(new_storage,storage)
38  call move_alloc(new_storage,alloc)
39 
40 ! alloc => storage
41  memsize = new_size
42  else
43  print *,'new_size < memsize,'
44  print *,'new_size = ',new_size
45  print *,'memsize = ',memsize
46  stop
47  endif
48 
49  return
50 
integer memsize
Definition: amr_module.f90:219
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
real(kind=8), dimension(:), allocatable alloc
Definition: amr_module.f90:218
Here is the caller graph for this function: