diff --git a/Project.toml b/Project.toml index dd4ec9f..a776b19 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DelayDiffEq" uuid = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb" authors = ["Chris Rackauckas "] -version = "5.47.4" +version = "5.48.0" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/integrators/type.jl b/src/integrators/type.jl index eaa1f44..42ff7fa 100644 --- a/src/integrators/type.jl +++ b/src/integrators/type.jl @@ -28,143 +28,215 @@ function (integrator::HistoryODEIntegrator)(val::AbstractArray, OrdinaryDiffEq.current_interpolant!(val, t, integrator, idxs, deriv) end -mutable struct DDEIntegrator{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, - tdirType, - ksEltype, SolType, F, CacheType, IType, FP, O, dAbsType, - dRelType, H, - tstopsType, discType, FSALType, EventErrorType, - CallbackCacheType, DV} <: - AbstractDDEIntegrator{algType, IIP, uType, tType} - sol::SolType - u::uType - k::ksEltype - t::tType - dt::tType - f::F - p::P - uprev::uType - uprev2::uType - tprev::tType - prev_idx::Int - prev2_idx::Int - fpsolver::FP - order_discontinuity_t0::Int - "Discontinuities tracked by callback." - tracked_discontinuities::Vector{Discontinuity{tType, Int}} - discontinuity_interp_points::Int - discontinuity_abstol::dAbsType - discontinuity_reltol::dRelType - "Future time stops for propagated discontinuities." - tstops_propagated::tstopsType - "Future propagated discontinuities." - d_discontinuities_propagated::discType - alg::algType - dtcache::tType - dtchangeable::Bool - dtpropose::tType - tdir::tdirType - eigen_est::eigenType - EEst::tTypeNoUnits - qold::tTypeNoUnits - q11::tTypeNoUnits - erracc::tTypeNoUnits - dtacc::tType - success_iter::Int - iter::Int - saveiter::Int - saveiter_dense::Int - cache::CacheType - callback_cache::CallbackCacheType - kshortsize::Int - force_stepfail::Bool - last_stepfail::Bool - just_hit_tstop::Bool - do_error_check::Bool - event_last_time::Int - vector_event_last_time::Int - last_event_error::EventErrorType - accept_step::Bool - isout::Bool - reeval_fsal::Bool - u_modified::Bool - isdae::Bool - opts::O - stats::SciMLBase.DEStats - history::H - differential_vars::DV - integrator::IType - fsalfirst::FSALType - fsallast::FSALType +@static if isdefined(OrdinaryDiffEq, :get_fsalfirstlast) + mutable struct DDEIntegrator{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, + tdirType, + ksEltype, SolType, F, CacheType, IType, FP, O, dAbsType, + dRelType, H, + tstopsType, discType, FSALType, EventErrorType, + CallbackCacheType, DV} <: + AbstractDDEIntegrator{algType, IIP, uType, tType} + sol::SolType + u::uType + k::ksEltype + t::tType + dt::tType + f::F + p::P + uprev::uType + uprev2::uType + tprev::tType + prev_idx::Int + prev2_idx::Int + fpsolver::FP + order_discontinuity_t0::Int + "Discontinuities tracked by callback." + tracked_discontinuities::Vector{Discontinuity{tType, Int}} + discontinuity_interp_points::Int + discontinuity_abstol::dAbsType + discontinuity_reltol::dRelType + "Future time stops for propagated discontinuities." + tstops_propagated::tstopsType + "Future propagated discontinuities." + d_discontinuities_propagated::discType + alg::algType + dtcache::tType + dtchangeable::Bool + dtpropose::tType + tdir::tdirType + eigen_est::eigenType + EEst::tTypeNoUnits + qold::tTypeNoUnits + q11::tTypeNoUnits + erracc::tTypeNoUnits + dtacc::tType + success_iter::Int + iter::Int + saveiter::Int + saveiter_dense::Int + cache::CacheType + callback_cache::CallbackCacheType + kshortsize::Int + force_stepfail::Bool + last_stepfail::Bool + just_hit_tstop::Bool + do_error_check::Bool + event_last_time::Int + vector_event_last_time::Int + last_event_error::EventErrorType + accept_step::Bool + isout::Bool + reeval_fsal::Bool + u_modified::Bool + isdae::Bool + opts::O + stats::SciMLBase.DEStats + history::H + differential_vars::DV + integrator::IType + fsalfirst::FSALType + fsallast::FSALType + end + +else + mutable struct DDEIntegrator{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, + tdirType, + ksEltype, SolType, F, CacheType, IType, FP, O, dAbsType, + dRelType, H, + tstopsType, discType, FSALType, EventErrorType, + CallbackCacheType, DV} <: + AbstractDDEIntegrator{algType, IIP, uType, tType} + sol::SolType + u::uType + k::ksEltype + t::tType + dt::tType + f::F + p::P + uprev::uType + uprev2::uType + tprev::tType + prev_idx::Int + prev2_idx::Int + fpsolver::FP + order_discontinuity_t0::Int + "Discontinuities tracked by callback." + tracked_discontinuities::Vector{Discontinuity{tType, Int}} + discontinuity_interp_points::Int + discontinuity_abstol::dAbsType + discontinuity_reltol::dRelType + "Future time stops for propagated discontinuities." + tstops_propagated::tstopsType + "Future propagated discontinuities." + d_discontinuities_propagated::discType + alg::algType + dtcache::tType + dtchangeable::Bool + dtpropose::tType + tdir::tdirType + eigen_est::eigenType + EEst::tTypeNoUnits + qold::tTypeNoUnits + q11::tTypeNoUnits + erracc::tTypeNoUnits + dtacc::tType + success_iter::Int + iter::Int + saveiter::Int + saveiter_dense::Int + cache::CacheType + callback_cache::CallbackCacheType + kshortsize::Int + force_stepfail::Bool + last_stepfail::Bool + just_hit_tstop::Bool + do_error_check::Bool + event_last_time::Int + vector_event_last_time::Int + last_event_error::EventErrorType + accept_step::Bool + isout::Bool + reeval_fsal::Bool + u_modified::Bool + isdae::Bool + opts::O + stats::SciMLBase.DEStats + history::H + differential_vars::DV + integrator::IType + fsalfirst::FSALType + fsallast::FSALType - # incomplete initialization without fsalfirst and fsallast - function DDEIntegrator{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, - tdirType, ksEltype, SolType, F, CacheType, IType, FP, - O, dAbsType, dRelType, H, tstopsType, discType, - FSALType, EventErrorType, CallbackCacheType, DV}(sol, u, k, t, dt, f, - p, uprev, uprev2, - tprev, prev_idx, - prev2_idx, - fpsolver, - order_discontinuity_t0, - tracked_discontinuities, - discontinuity_interp_points, - discontinuity_abstol, - discontinuity_reltol, - tstops_propagated, - d_discontinuities_propagated, - alg, dtcache, - dtchangeable, - dtpropose, tdir, - eigen_est, EEst, - qold, - q11, erracc, dtacc, - success_iter, iter, - saveiter, - saveiter_dense, - cache, - callback_cache, - kshortsize, - force_stepfail, - last_stepfail, - just_hit_tstop, - do_error_check, - event_last_time, - vector_event_last_time, - last_event_error, - accept_step, isout, - reeval_fsal, - u_modified, isdae, - opts, stats, - history, - differential_vars, - integrator) where - {algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, tdirType, ksEltype, - SolType, F, - CacheType, IType, FP, O, dAbsType, dRelType, H, tstopsType, discType, - FSALType, EventErrorType, CallbackCacheType, DV} - new{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, tdirType, ksEltype, - SolType, F, - CacheType, IType, FP, O, dAbsType, dRelType, H, tstopsType, discType, FSALType, - EventErrorType, CallbackCacheType, DV}( - sol, u, k, t, dt, f, p, uprev, uprev2, tprev, - prev_idx, prev2_idx, fpsolver, - order_discontinuity_t0, - tracked_discontinuities, - discontinuity_interp_points, - discontinuity_abstol, discontinuity_reltol, - tstops_propagated, - d_discontinuities_propagated, alg, dtcache, - dtchangeable, dtpropose, tdir, - eigen_est, EEst, qold, q11, erracc, dtacc, - success_iter, iter, saveiter, saveiter_dense, - cache, callback_cache, kshortsize, - force_stepfail, last_stepfail, - just_hit_tstop, - do_error_check, event_last_time, - vector_event_last_time, - last_event_error, accept_step, isout, - reeval_fsal, u_modified, isdae, opts, - stats, history, differential_vars, integrator) + # incomplete initialization without fsalfirst and fsallast + function DDEIntegrator{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, + tdirType, ksEltype, SolType, F, CacheType, IType, FP, + O, dAbsType, dRelType, H, tstopsType, discType, + FSALType, EventErrorType, CallbackCacheType, DV}(sol, u, k, t, dt, f, + p, uprev, uprev2, + tprev, prev_idx, + prev2_idx, + fpsolver, + order_discontinuity_t0, + tracked_discontinuities, + discontinuity_interp_points, + discontinuity_abstol, + discontinuity_reltol, + tstops_propagated, + d_discontinuities_propagated, + alg, dtcache, + dtchangeable, + dtpropose, tdir, + eigen_est, EEst, + qold, + q11, erracc, dtacc, + success_iter, iter, + saveiter, + saveiter_dense, + cache, + callback_cache, + kshortsize, + force_stepfail, + last_stepfail, + just_hit_tstop, + do_error_check, + event_last_time, + vector_event_last_time, + last_event_error, + accept_step, isout, + reeval_fsal, + u_modified, isdae, + opts, stats, + history, + differential_vars, + integrator) where + {algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, tdirType, ksEltype, + SolType, F, + CacheType, IType, FP, O, dAbsType, dRelType, H, tstopsType, discType, + FSALType, EventErrorType, CallbackCacheType, DV} + new{algType, IIP, uType, tType, P, eigenType, tTypeNoUnits, tdirType, ksEltype, + SolType, F, + CacheType, IType, FP, O, dAbsType, dRelType, H, tstopsType, discType, FSALType, + EventErrorType, CallbackCacheType, DV}( + sol, u, k, t, dt, f, p, uprev, uprev2, tprev, + prev_idx, prev2_idx, fpsolver, + order_discontinuity_t0, + tracked_discontinuities, + discontinuity_interp_points, + discontinuity_abstol, discontinuity_reltol, + tstops_propagated, + d_discontinuities_propagated, alg, dtcache, + dtchangeable, dtpropose, tdir, + eigen_est, EEst, qold, q11, erracc, dtacc, + success_iter, iter, saveiter, saveiter_dense, + cache, callback_cache, kshortsize, + force_stepfail, last_stepfail, + just_hit_tstop, + do_error_check, event_last_time, + vector_event_last_time, + last_event_error, accept_step, isout, + reeval_fsal, u_modified, isdae, opts, + stats, history, differential_vars, integrator) + end end end diff --git a/src/solve.jl b/src/solve.jl index 8e93ad7..30cef58 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -396,7 +396,9 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractDDEProblem, erracc = QT(1) dtacc = tType(1) - integrator = DDEIntegrator{typeof(alg.alg), isinplace(prob), typeof(u0), tType, + if isdefined(OrdinaryDiffEq, :get_fsalfirstlast) + fsalfirst, fsallast = OrdinaryDiffEq.get_fsalfirstlast(cache,rate_prototype) + integrator = DDEIntegrator{typeof(alg.alg), isinplace(prob), typeof(u0), tType, typeof(p), typeof(eigen_est), QT, typeof(tdir), typeof(k), typeof(sol), typeof(f_with_history), typeof(cache), @@ -459,7 +461,73 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractDDEProblem, stats, history, differential_vars, - ode_integrator) + ode_integrator, fsalfirst, fsallast) + else + integrator = DDEIntegrator{typeof(alg.alg), isinplace(prob), typeof(u0), tType, + typeof(p), + typeof(eigen_est), QT, typeof(tdir), typeof(k), typeof(sol), + typeof(f_with_history), typeof(cache), + typeof(ode_integrator), typeof(fpsolver), + typeof(opts), typeof(discontinuity_abstol), + typeof(discontinuity_reltol), typeof(history), + typeof(tstops_propagated), + typeof(d_discontinuities_propagated), + OrdinaryDiffEq.fsal_typeof(alg.alg, rate_prototype), + typeof(last_event_error), typeof(callback_cache), + typeof(differential_vars)}(sol, u, k, + t0, + tType(dt), + f_with_history, + p, + uprev, + uprev2, + tprev, + prev_idx, + prev2_idx, + fpsolver, + order_discontinuity_t0, + tracked_discontinuities, + discontinuity_interp_points, + discontinuity_abstol, + discontinuity_reltol, + tstops_propagated, + d_discontinuities_propagated, + alg.alg, + dtcache, + dtchangeable, + dtpropose, + tdir, + eigen_est, + EEst, + QT(qoldinit), + q11, + erracc, + dtacc, + success_iter, + iter, + length(ts), + length(ts), + cache, + callback_cache, + kshortsize, + force_stepfail, + last_stepfail, + just_hit_tstop, + do_error_check, + event_last_time, + vector_event_last_time, + last_event_error, + accept_step, + isout, + reeval_fsal, + u_modified, + isdae, + opts, + stats, + history, + differential_vars, + ode_integrator) + end # initialize DDE integrator if initialize_integrator