grow_accum Subroutine

private subroutine grow_accum(am, ar, ae, amt, zcap)

Double cell accumulation buffers of loadkipp, keeping contents.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), allocatable :: am(:)

Mass coordinate of each cell.

real(kind=real64), intent(inout), allocatable :: ar(:)

Radius coordinate of each cell.

real(kind=real64), intent(inout), allocatable :: ae(:)

Energy rate of each cell.

integer(kind=int32), intent(inout), allocatable :: amt(:)

Mixing code of each cell.

integer(kind=int32), intent(inout) :: zcap

Cell capacity, doubled.


Source Code

   subroutine grow_accum(am, ar, ae, amt, zcap)
      !! Double cell accumulation buffers of `loadkipp`, keeping contents.
      ! Arguments
      real(real64), allocatable, intent(inout) :: am(:)
         !! Mass coordinate of each cell.
      real(real64), allocatable, intent(inout) :: ar(:)
         !! Radius coordinate of each cell.
      real(real64), allocatable, intent(inout) :: ae(:)
         !! Energy rate of each cell.
      integer(int32), allocatable, intent(inout) :: amt(:)
         !! Mixing code of each cell.
      integer(int32), intent(inout) :: zcap
         !! Cell capacity, doubled.
      real(real64), allocatable :: t(:)
      integer(int32), allocatable :: ti(:)
      integer(int32) :: old

      old = zcap
      zcap = zcap*2
      allocate (t(zcap)); t(1:old) = am; call move_alloc(t, am)
      allocate (t(zcap)); t(1:old) = ar; call move_alloc(t, ar)
      allocate (t(zcap)); t(1:old) = ae; call move_alloc(t, ae)
      allocate (ti(zcap)); ti(1:old) = amt; call move_alloc(ti, amt)
   end subroutine grow_accum