diff --git a/src/LSODA.jl b/src/LSODA.jl index 942f2d7..d665658 100644 --- a/src/LSODA.jl +++ b/src/LSODA.jl @@ -5,6 +5,16 @@ module LSODA using Compat, DiffEqBase import DiffEqBase: solve +const warnkeywords = + (:save_idxs, :d_discontinuities, :isoutofdomain, :unstable_check, + :calck, :progress, :timeseries_steps, :dense, + :dtmin, :dtmax, + :internalnorm, :gamma, :beta1, :beta2, :qmax, :qmin, :qoldinit) + +function __init__() + const global warnlist = Set(warnkeywords) +end + @compat abstract type LSODAAlgorithm <: AbstractODEAlgorithm end immutable lsoda <: LSODAAlgorithm end diff --git a/src/common.jl b/src/common.jl index bce1e1a..6120c29 100644 --- a/src/common.jl +++ b/src/common.jl @@ -4,6 +4,8 @@ function solve{uType,tType,isinplace}( prob::AbstractODEProblem{uType,tType,isinplace}, alg::LSODAAlgorithm, timeseries=[],ts=[],ks=[]; + + verbose=true, abstol=1/10^6,reltol=1/10^3, tstops=Float64[], saveat=Float64[],maxiter=Int(1e5), @@ -13,6 +15,8 @@ function solve{uType,tType,isinplace}( save_timeseries = nothing, userdata=nothing,kwargs...) + verbose && !isempty(kwargs) && check_keywords(alg, kwargs, warnlist) + if save_timeseries != nothing warn("save_timeseries is deprecated. Use save_everystep instead") _save_everystep = save_timeseries @@ -31,20 +35,20 @@ function solve{uType,tType,isinplace}( T = tspan[end] if typeof(saveat) <: Number - saveat_vec = convert(Vector{tType},saveat+tspan[1]:saveat:(tspan[end]-saveat)) - # Exclude the endpoint because of floating point issues + saveat_vec = convert(Vector{tType},saveat+tspan[1]:saveat:(tspan[end]-saveat)) + # Exclude the endpoint because of floating point issues else - saveat_vec = convert(Vector{tType},collect(saveat)) + saveat_vec = convert(Vector{tType},collect(saveat)) end if !isempty(saveat_vec) && saveat_vec[end] == tspan[2] - pop!(saveat_vec) + pop!(saveat_vec) end if !isempty(saveat_vec) && saveat_vec[1] == tspan[1] - save_ts = sort(unique([saveat_vec;T])) + save_ts = sort(unique([saveat_vec;T])) else - save_ts = sort(unique([t0;saveat_vec;T])) + save_ts = sort(unique([t0;saveat_vec;T])) end if T < save_ts[end] @@ -94,15 +98,15 @@ function solve{uType,tType,isinplace}( rtol = ones(Float64,neq) if typeof(abstol) == Float64 - atol *= abstol + atol *= abstol else - atol = copy(abstol) + atol = copy(abstol) end if typeof(reltol) == Float64 - rtol *= reltol + rtol *= reltol else - rtol = copy(reltol) + rtol = copy(reltol) end opt = lsoda_opt_t() @@ -110,9 +114,9 @@ function solve{uType,tType,isinplace}( opt.rtol = pointer(rtol) opt.atol = pointer(atol) if save_everystep - itask_tmp = 2 + itask_tmp = 2 else - itask_tmp = 1 + itask_tmp = 1 end opt.itask = itask_tmp