Skip to content

Commit d31eafb

Browse files
committed
add implicit discrete problem ConstructionBase constructor
1 parent fa81653 commit d31eafb

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 AbstractODEFunction
126+
iip = isinplace(f)
127+
else
128+
iip = isinplace(f, 5)
129+
end
130+
return ODEProblem{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
@@ -82,6 +82,7 @@ push!(probs, discprob)
8282
[0 ~ x^3 * β + y^3 * ρ - σ, 0 ~ x^2 + 2x * y + y^2, 0 ~ z^2 - 4z + 4],
8383
[x, y, z], [σ, β, ρ])
8484
sccprob = SCCNonlinearProblem(sys, u0, p)
85+
@test_nowarn initialization_status(sccprob)
8586
push!(syss, sys)
8687
push!(probs, sccprob)
8788

0 commit comments

Comments
 (0)