Skip to content

Commit 02d4a08

Browse files
feat: implement constructorof for ODEProblem
1 parent 8723590 commit 02d4a08

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/problems/ode_problems.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ function Base.setproperty!(prob::ODEProblem, s::Symbol, v, order::Symbol)
174174
Base.setfield!(prob, s, v, order)
175175
end
176176

177+
function ConstructionBase.constructorof(::Type{P}) where {P <: ODEProblem}
178+
function ctor(f, u0, tspan, p, kw, pt)
179+
if f isa AbstractODEFunction
180+
iip = isinplace(f)
181+
else
182+
iip = isinplace(f, 4)
183+
end
184+
return ODEProblem{iip}(f, u0, tspan, p, pt; kw...)
185+
end
186+
end
187+
177188
"""
178189
ODEProblem(f::ODEFunction,u0,tspan,p=NullParameters(),callback=CallbackSet())
179190

0 commit comments

Comments
 (0)