Skip to content

Commit

Permalink
Merge pull request #96 from MineralsCloud:choose-volume
Browse files Browse the repository at this point in the history
Fix `_choose`
  • Loading branch information
singularitti authored Jan 17, 2022
2 parents 74e11d9 + 1299e80 commit 2aaf093
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/EquationOfStateWorkflow/actions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,9 @@ customizer(params::Parameters, pressure::Pressure, timefmt = "Y-m-d_H:M:S") =
function _choose(possible_volumes, pressure, eos)
v0 = getparam(eos).v0
filtered = if pressure >= zero(pressure) # If pressure is greater than zero,
filter(<(v0), possible_volumes) # the volume could only be smaller than `v0`.
filter(<=(v0), possible_volumes) # the volume could only be smaller than `v0`.
else
filter(>(v0), possible_volumes)
filter(v -> 1 < v / v0 <= 3, possible_volumes)
end
return only(filtered)
end

function _interactive_choose(volumes)
options = string.(volumes)
menu = RadioMenu(options)
choice = request("Choose the desired volume:", menu)
choice == -1 ? throw(InterruptException()) : volumes[choice]
end

0 comments on commit 2aaf093

Please sign in to comment.