Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed wrong object
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 10, 2022
1 parent ec08c01 commit 076126b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -888,27 +888,27 @@ subroutine symba_util_save_collision(system, snapshot)
system%collision_history%iframe = system%collision_history%iframe + 1

! Check to make sure the current encounter_history object is big enough. If not, grow it by a factor of 2
nnew = system%encounter_history%iframe
nold = system%encounter_history%nframes
nnew = system%collision_history%iframe
nold = system%collision_history%nframes

if (nnew > nold) then
nbig = nold
do while (nbig < nnew)
nbig = nbig * 2
end do
allocate(encounter_storage(nbig) :: tmp)
tmp%tvals(1:nold) = system%encounter_history%tvals(1:nold)
tmp%tvals(1:nold) = system%collision_history%tvals(1:nold)
tmp%tvals(nold+1:nbig) = huge(1.0_DP)
tmp%tslot(1:nold) = system%encounter_history%tslot(1:nold)
tmp%tslot(1:nold) = system%collision_history%tslot(1:nold)
tmp%tslot(nold+1:nbig) = 0
tmp%iframe = system%encounter_history%iframe
call move_alloc(system%encounter_history%nc, tmp%nc)
tmp%iframe = system%collision_history%iframe
call move_alloc(system%collision_history%nc, tmp%nc)

do i = 1, nold
if (allocated(system%encounter_history%frame(i)%item)) call move_alloc(system%encounter_history%frame(i)%item, tmp%frame(i)%item)
if (allocated(system%collision_history%frame(i)%item)) call move_alloc(system%collision_history%frame(i)%item, tmp%frame(i)%item)
end do
deallocate(system%encounter_history)
call move_alloc(tmp,system%encounter_history)
deallocate(system%collision_history)
call move_alloc(tmp,system%collision_history)
nnew = nbig
end if

Expand Down

0 comments on commit 076126b

Please sign in to comment.