Skip to content

Commit

Permalink
Deprecate _adapt_domain & domain annotation
Browse files Browse the repository at this point in the history
Abstraction: let users choose
  • Loading branch information
singularitti committed Oct 1, 2019
1 parent aaa80df commit bc13999
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/Find.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,21 @@ function _whose_zero(
return v::Real -> apply(form, eos, v) - y
end # function _whose_zero

function _adapt_domain(domain::Union{AbstractVector,Tuple}, method::AbstractBracketing)
return minimum(domain), maximum(domain)
end # function _adapt_domain
function _adapt_domain(
domain::Union{AbstractVector,Tuple},
method::Union{
AbstractNonBracketing,
AbstractHalleyLikeMethod,
AbstractNewtonLikeMethod,
},
)
return Statistics.median(domain)
end # function _adapt_domain

function findvolume(
form::EquationForm,
eos::EquationOfState,
y,
domain::Union{AbstractVector,Tuple},
x0,
method,
)
f = _whose_zero(form, eos, y)
return find_zero(f, _adapt_domain(domain), method)
return find_zero(f, x0, method)
end # function findvolume
function findvolume(
form::EquationForm,
eos::EquationOfState,
y,
domain::Union{AbstractVector,Tuple},
x0,
)
for T in [
subtypes(AbstractAlefeldPotraShi)
Expand All @@ -89,7 +75,7 @@ function findvolume(
]
@info("Using method \"$T\"...")
try
return findvolume(form, eos, y, domain, T())
return findvolume(form, eos, y, x0, T())
catch e
@info("Method \"$T\" failed because of $e.")
continue
Expand Down

0 comments on commit bc13999

Please sign in to comment.