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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 22, 2021
2 parents 7692b51 + ea8a0f6 commit a08add9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/encounter/encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ subroutine encounter_check_all_sort_and_sweep_plplm(nplm, nplt, xplm, vplm, xplt

ntot_last = ntot
end if

!$omp parallel do default(private) schedule(static) &
!$omp shared(xplm, xplt, vplm, vplt, rencm, renct, boundingbox) &
!$omp firstprivate(dt, nplm, nplt, ntot)
Expand Down
46 changes: 30 additions & 16 deletions src/util/util_sort.f90
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ module pure subroutine util_sort_dp(arr)
do i = 2, n
tmp = arr(i)
j = i - 1
do while ((j >= 1) .and. (arr(j) > tmp))
do while ((j > 1) .and. (arr(j) > tmp))
arr(j + 1) = arr(j)
j = j - 1
end do
if ((j == 1) .and. (arr(j) > tmp)) then
arr(j + 1) = arr(j)
j = j - 1
end if
arr(j + 1) = tmp
end do

Expand Down Expand Up @@ -108,11 +112,14 @@ module pure subroutine util_sort_index_dp(arr, ind)
do i = 2, n
itmp = ind(i)
j = i - 1
do while ((j >= 2) .and. (arr(ind(j)) > itmp))
do while ((j > 1) .and. (arr(ind(j)) > arr(itmp)))
ind(j + 1) = ind(j)
j = j - 1
end do
if ((j == 1) .and. (arr(ind(1)) > itmp)) ind(2) = ind(1)
if ((j == 1) .and. (arr(ind(j)) > arr(itmp))) then
ind(j + 1) = ind(j)
j = j - 1
end if
ind(j + 1) = itmp
end do

Expand All @@ -137,10 +144,14 @@ module pure subroutine util_sort_i4b(arr)
do i = 2, n
tmp = arr(i)
j = i - 1
do while ((j >= 1) .and. (arr(j) > tmp))
do while ((j > 1) .and. (arr(j) > tmp))
arr(j + 1) = arr(j)
j = j - 1
end do
if ((j == 1) .and. (arr(j) > tmp)) then
arr(j + 1) = arr(j)
j = j - 1
end if
arr(j + 1) = tmp
end do

Expand Down Expand Up @@ -168,21 +179,17 @@ module pure subroutine util_sort_index_i4b(arr, ind)
allocate(ind(n))
ind = [(i, i=1, n)]
end if

itmp = ind(2)
if (arr(ind(1)) > itmp) then
ind(2) = ind(1)
ind(1) = itmp
end if

do i = 2, n
itmp = ind(i)
j = i - 1
do while ((j >= 2) .and. (arr(ind(j)) > itmp))
do while ((j > 1) .and. (arr(ind(j)) > arr(itmp)))
ind(j + 1) = ind(j)
j = j - 1
end do
if ((j == 1) .and. (arr(ind(1)) > itmp)) ind(2) = ind(1)
if ((j == 1) .and. (arr(ind(j)) > arr(itmp))) then
ind(j + 1) = ind(j)
j = j - 1
end if
ind(j + 1) = itmp
end do

Expand All @@ -207,10 +214,14 @@ module pure subroutine util_sort_sp(arr)
do i = 2, n
tmp = arr(i)
j = i - 1
do while ((j >= 1) .and. (arr(j) > tmp))
do while ((j > 1) .and. (arr(j) > tmp))
arr(j + 1) = arr(j)
j = j - 1
end do
if ((j == 1) .and. (arr(j) > tmp)) then
arr(j + 1) = arr(j)
j = j - 1
end if
arr(j + 1) = tmp
end do

Expand Down Expand Up @@ -241,11 +252,14 @@ module pure subroutine util_sort_index_sp(arr, ind)
do i = 2, n
itmp = ind(i)
j = i - 1
do while ((j >= 2) .and. (arr(ind(j)) > itmp))
do while ((j > 1) .and. (arr(ind(j)) > arr(itmp)))
ind(j + 1) = ind(j)
j = j - 1
end do
if ((j == 1) .and. (arr(ind(1)) > itmp)) ind(2) = ind(1)
if ((j == 1) .and. (arr(ind(j)) > arr(itmp))) then
ind(j + 1) = ind(j)
j = j - 1
end if
ind(j + 1) = itmp
end do

Expand Down

0 comments on commit a08add9

Please sign in to comment.