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

Commit

Permalink
Fixed array indexing problem when re-indexing the pl-pl encounter lis…
Browse files Browse the repository at this point in the history
…ts after a rearray operation.
  • Loading branch information
daminton committed Aug 28, 2021
1 parent 8823057 commit 24ad0d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ module subroutine symba_util_rearray_pl(self, system, param)
class(symba_parameters), intent(in) :: param !! Current run configuration parameters
! Internals
class(symba_pl), allocatable :: tmp !! The discarded body list.
integer(I4B) :: i, j, k, npl
integer(I4B) :: i, j, k, npl, nencmin
logical, dimension(:), allocatable :: lmask
class(symba_plplenc), allocatable :: plplenc_old
logical :: lencounter
Expand Down Expand Up @@ -500,8 +500,10 @@ module subroutine symba_util_rearray_pl(self, system, param)
call move_alloc(levelm_orig_pl, pl%levelm)
call move_alloc(nplenc_orig_pl, pl%nplenc)

! Re-index the encounter list as the index values may have changed
associate(idnew1 => system%plplenc_list%id1, idnew2 => system%plplenc_list%id2, idold1 => plplenc_old%id1, idold2 => plplenc_old%id2)
do k = 1, system%plplenc_list%nenc
nencmin = min(system%plplenc_list%nenc, plplenc_old%nenc)
do k = 1, nencmin
if ((idnew1(k) == idold1(k)) .and. (idnew2(k) == idold2(k))) then
! This is an encounter we already know about, so save the old information
system%plplenc_list%lvdotr(k) = plplenc_old%lvdotr(k)
Expand Down

0 comments on commit 24ad0d6

Please sign in to comment.