Skip to content

Commit c36847f

Browse files
Merge pull request #957 from vyudu/fix_initialization_status
Add ConstructionBase constructor for ImplicitDiscreteProblem
2 parents e45d1ef + 4dce830 commit c36847f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/problems/implicit_discrete_problems.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct ImplicitDiscreteProblem{uType, tType, isinplace, P, F, K} <:
7878
tspan::tType
7979
"""The parameter values of the function."""
8080
p::P
81-
""" A callback to be applied to every solver which uses the problem."""
81+
"""A callback to be applied to every solver which uses the problem."""
8282
kwargs::K
8383
@add_kwonly function ImplicitDiscreteProblem{iip}(f::ImplicitDiscreteFunction{
8484
iip,
@@ -120,6 +120,17 @@ function ImplicitDiscreteProblem(f, u0, tspan, p = NullParameters();
120120
ImplicitDiscreteProblem(ImplicitDiscreteFunction{iip}(f), u0, tspan, p; kwargs...)
121121
end
122122

123+
function ConstructionBase.constructorof(::Type{P}) where {P <: ImplicitDiscreteProblem}
124+
function ctor(f, u0, tspan, p, kw)
125+
if f isa AbstractDiscreteFunction
126+
iip = isinplace(f)
127+
else
128+
iip = isinplace(f, 5)
129+
end
130+
return ImplicitDiscreteProblem{iip}(f, u0, tspan, p; kw...)
131+
end
132+
end
133+
123134
@doc doc"""
124135
125136
Holds information on what variables to alias

test/downstream/modelingtoolkit_remake.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ push!(probs, discprob)
8585
[0 ~ x^3 * β + y^3 * ρ - σ, 0 ~ x^2 + 2x * y + y^2, 0 ~ z^2 - 4z + 4],
8686
[x, y, z], [σ, β, ρ])
8787
sccprob = SCCNonlinearProblem(sys, u0, p)
88+
@test_nowarn SciMLBase.initialization_status(sccprob)
8889
push!(syss, sys)
8990
push!(probs, sccprob)
9091

0 commit comments

Comments
 (0)