Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DDEProblem mutable #723

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/problems/dde_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ prob = DDEProblemLibrary.prob_dde_constant_1delay_ip
sol = solve(prob)
```
"""
struct DDEProblem{uType, tType, lType, lType2, isinplace, P, F, H, K, PT} <:
mutable struct DDEProblem{uType, tType, lType, lType2, isinplace, P, F, H, K, PT} <:
AbstractDDEProblem{uType, tType, lType, isinplace}
f::F
u0::uType
Expand Down Expand Up @@ -259,6 +259,16 @@ function DDEProblem(f::AbstractDDEFunction, args...; kwargs...)
DDEProblem{isinplace(f)}(f, args...; kwargs...)
end

function Base.setproperty!(prob::DDEProblem, s::Symbol, v)
@warn "Mutation of DDEProblem detected. DDEProblem is 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::DDEProblem, s::Symbol, v, order::Symbol)
@warn "Mutation of DDEProblem detected. DDEProblem is 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

"""
$(TYPEDEF)
"""
Expand Down
Loading