diff --git a/src/encounter/encounter_check.f90 b/src/encounter/encounter_check.f90 index 9c5570508..e178aa4f6 100644 --- a/src/encounter/encounter_check.f90 +++ b/src/encounter/encounter_check.f90 @@ -989,22 +989,14 @@ module subroutine encounter_check_sweep_aabb_double_list(self, n1, n2, nenc, ind call timer%stop() write(*,*) "sweep double: ",timer%count_stop_step - timer%count_start_step - call timer%reset() - call timer%start() call encounter_check_collapse_ragged_list(lenc, ntot, nenc, index1, index2) - call timer%stop() - write(*,*) "collapse rag: ",timer%count_stop_step - timer%count_start_step - call timer%reset() - call timer%start() ! Reorder the pairs and sort the first index in order to remove any duplicates do concurrent(k = 1:nenc, index2(k) < index1(k)) i = index2(k) index2(k) = index1(k) index1(k) = i end do - call timer%stop() - write(*,*) "reorder arr : ",timer%count_stop_step - timer%count_start_step return end subroutine encounter_check_sweep_aabb_double_list @@ -1146,7 +1138,6 @@ subroutine encounter_check_sweep_aabb_one_double_list(i, n1, n2, ntot, ext_ind, logical, dimension(:), intent(out) :: lencounteri !! Encounter list for the ith body ! Internals integer(I4B) :: j, jbox, dim, jlo, jhi - logical, dimension(2:SWEEPDIM) :: lenc integer(I4B), dimension(:), allocatable :: box lencounteri(:) = .false. @@ -1157,14 +1148,12 @@ subroutine encounter_check_sweep_aabb_one_double_list(i, n1, n2, ntot, ext_ind, where(box(:) > ntot) box(:) = box(:) - ntot endwhere - do concurrent(jbox = jlo:jhi) ! Sweep forward until the end of the interval + + do concurrent (jbox = jlo:jhi) j = box(jbox) if (((i <= n1) .and. (j <= n1)) .or. ((i > n1) .and. (j > n1))) cycle ! only pairs from the two different lists allowed - ! Check the y-dimension - do dim = 2, SWEEPDIM - lenc(dim) = (iend(dim,j) > ibegi(dim)) .and. (ibeg(dim,j) < iendi(dim)) - end do - lencounteri(j) = all(lenc(:)) + ! Check the other dimensions + lencounteri(j) = all((iend(2:SWEEPDIM,j) > ibegi(2:SWEEPDIM)) .and. (ibeg(2:SWEEPDIM,j) < iendi(2:SWEEPDIM))) end do return @@ -1184,7 +1173,6 @@ pure subroutine encounter_check_sweep_aabb_one_single_list(n, ext_ind, ibegi, ie logical, dimension(:), intent(out) :: lencounteri !! Encounter list for the ith body ! Internals integer(I4B) :: j, jbox, dim, jlo, jhi - logical, dimension(2:SWEEPDIM) :: lenc integer(I4B), dimension(:), allocatable :: box lencounteri(:) = .false. @@ -1202,10 +1190,7 @@ pure subroutine encounter_check_sweep_aabb_one_single_list(n, ext_ind, ibegi, ie do concurrent(jbox = jlo:jhi) ! Sweep forward until the end of the interval j = box(jbox) ! Check the other dimensions - do dim = 2, SWEEPDIM - lenc(dim) = (iend(dim,j) > ibegi(dim)) .and. (ibeg(dim,j) < iendi(dim)) - end do - lencounteri(j) = all(lenc(:)) + lencounteri(j) = all((iend(2:SWEEPDIM,j) > ibegi(2:SWEEPDIM)) .and. (ibeg(2:SWEEPDIM,j) < iendi(2:SWEEPDIM))) end do return diff --git a/src/modules/encounter_classes.f90 b/src/modules/encounter_classes.f90 index 4965f14f1..1c182619b 100644 --- a/src/modules/encounter_classes.f90 +++ b/src/modules/encounter_classes.f90 @@ -7,7 +7,7 @@ module encounter_classes implicit none public - integer(I4B), parameter :: SWEEPDIM = 2 + integer(I4B), parameter :: SWEEPDIM = 3 type :: encounter_list integer(I4B) :: nenc = 0 !! Total number of encounters