Skip to content

Commit 234dd64

Browse files
Merge pull request #907 from AayushSabharwal/as/discprob-ctor
feat: add `constructorof` for `DiscreteProblem`
2 parents 7ed01df + c081f78 commit 234dd64

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/problems/discrete_problems.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ struct DiscreteProblem{uType, tType, isinplace, P, F, K} <:
122122
end
123123
end
124124

125+
function ConstructionBase.constructorof(::Type{P}) where {P <: DiscreteProblem}
126+
function ctor(f, u0, tspan, p, kw)
127+
if f isa AbstractDiscreteFunction
128+
iip = isinplace(f)
129+
else
130+
iip = isinplace(f, 4)
131+
end
132+
return DiscreteProblem{iip}(f, u0, tspan, p; kw...)
133+
end
134+
end
135+
125136
"""
126137
DiscreteProblem{isinplace}(f,u0,tspan,p=NullParameters(),callback=nothing)
127138

0 commit comments

Comments
 (0)