Skip to content

Commit

Permalink
Merge pull request #907 from AayushSabharwal/as/discprob-ctor
Browse files Browse the repository at this point in the history
feat: add `constructorof` for `DiscreteProblem`
  • Loading branch information
ChrisRackauckas authored Jan 16, 2025
2 parents 7ed01df + c081f78 commit 234dd64
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/problems/discrete_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ struct DiscreteProblem{uType, tType, isinplace, P, F, K} <:
end
end

function ConstructionBase.constructorof(::Type{P}) where {P <: DiscreteProblem}
function ctor(f, u0, tspan, p, kw)
if f isa AbstractDiscreteFunction
iip = isinplace(f)
else
iip = isinplace(f, 4)
end
return DiscreteProblem{iip}(f, u0, tspan, p; kw...)
end
end

"""
DiscreteProblem{isinplace}(f,u0,tspan,p=NullParameters(),callback=nothing)
Expand Down

0 comments on commit 234dd64

Please sign in to comment.