mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Removed redundancy in binary search
This commit is contained in:
parent
68b654b403
commit
42ca8df692
1 changed files with 6 additions and 9 deletions
|
|
@ -41,10 +41,9 @@ contains
|
|||
do while (R - L > 1)
|
||||
! Find values at midpoint
|
||||
array_index = L + (R - L)/2
|
||||
testval = array(array_index)
|
||||
if (val >= testval) then
|
||||
if (val >= array(array_index)) then
|
||||
L = array_index
|
||||
elseif (val < testval) then
|
||||
else
|
||||
R = array_index
|
||||
end if
|
||||
|
||||
|
|
@ -83,10 +82,9 @@ contains
|
|||
do while (R - L > 1)
|
||||
! Find values at midpoint
|
||||
array_index = L + (R - L)/2
|
||||
testval = array(array_index)
|
||||
if (val >= testval) then
|
||||
if (val >= array(array_index)) then
|
||||
L = array_index
|
||||
elseif (val < testval) then
|
||||
else
|
||||
R = array_index
|
||||
end if
|
||||
|
||||
|
|
@ -125,10 +123,9 @@ contains
|
|||
do while (R - L > 1)
|
||||
! Find values at midpoint
|
||||
array_index = L + (R - L)/2
|
||||
testval = array(array_index)
|
||||
if (val >= testval) then
|
||||
if (val >= array(array_index)) then
|
||||
L = array_index
|
||||
elseif (val < testval) then
|
||||
else
|
||||
R = array_index
|
||||
end if
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue