diff --git a/src/problems/ode_problems.jl b/src/problems/ode_problems.jl index 20949d644..ce4425db3 100644 --- a/src/problems/ode_problems.jl +++ b/src/problems/ode_problems.jl @@ -94,7 +94,7 @@ prob = ODEProblemLibrary.prob_ode_linear sol = solve(prob) ``` """ -struct ODEProblem{uType, tType, isinplace, P, F, K, PT} <: +mutable struct ODEProblem{uType, tType, isinplace, P, F, K, PT} <: AbstractODEProblem{uType, tType, isinplace} """The ODE is `du = f(u,p,t)` for out-of-place and f(du,u,p,t) for in-place.""" f::F @@ -162,6 +162,16 @@ struct ODEProblem{uType, tType, isinplace, P, F, K, PT} <: end TruncatedStacktraces.@truncate_stacktrace ODEProblem 3 1 2 +function Base.setproperty!(prob::ODEProblem, s::Symbol, v) + @warn "Mutation of ODEProblem detected. SciMLBase v2.0 has made ODEProblem temporarily mutable in order to allow for interfacing with EnzymeRules due to a current limitation in the rule system. This change is only intended to be temporary and ODEProblem will return to being a struct in a later non-breaking release. Do not rely on this behavior, use with caution." + Base.setfield!(prob, s, v) +end + +function Base.setproperty!(prob::ODEProblem, s::Symbol, v, order::Symbol) + @warn "Mutation of ODEProblem detected. SciMLBase v2.0 has made ODEProblem temporarily mutable in order to allow for interfacing with EnzymeRules due to a current limitation in the rule system. This change is only intended to be temporary and ODEProblem will return to being a struct in a later non-breaking release. Do not rely on this behavior, use with caution." + Base.setfield!(prob, s, v, order) +end + """ ODEProblem(f::ODEFunction,u0,tspan,p=NullParameters(),callback=CallbackSet())