Skip to content

Commit

Permalink
how about now
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Nov 15, 2023
1 parent b3d70d3 commit ffb077f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ADTypes = "0.1, 0.2"
Adapt = "1.1, 2.0, 3.0"
ArrayInterface = "6, 7"
DataStructures = "0.18"
DiffEqBase = "6.128.2"
DiffEqBase = "6.139"
DocStringExtensions = "0.8, 0.9"
ExponentialUtilities = "1.22"
FastBroadcast = "0.1.9, 0.2"
Expand Down
8 changes: 2 additions & 6 deletions src/initdt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@
f(f₀, u0, p, t)
else
# TODO: use more caches
f₀ = first(get_tmp_cache(integrator))
if u0 isa Array && eltype(u0) isa Number
fill!(f₀, zero(T))
else
f₀ = zero.(f₀)
end
f₀ = DiffEqBase._rate_prototype(u0, t, one(t))
f₀ = zero.(f₀)
f(f₀, u0, p, t)
end

Expand Down
14 changes: 3 additions & 11 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,12 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
dtmax > zero(dtmax) && tdir < 0 && (dtmax *= tdir) # Allow positive dtmax, but auto-convert
# dtmin is all abs => does not care about sign already.

if !isdae && isinplace(prob) && u isa AbstractArray && eltype(u) <: Number &&
uBottomEltypeNoUnits == uBottomEltype && tType == tTypeNoUnits # Could this be more efficient for other arrays?
rate_prototype = recursivecopy(u)
elseif prob isa DAEProblem
if prob isa DAEProblem
rate_prototype = prob.du0
else
if (uBottomEltypeNoUnits == uBottomEltype && tType == tTypeNoUnits) ||
eltype(u) <: Enum
rate_prototype = u
else # has units!
rate_prototype = u / oneunit(tType)
end
rate_prototype = DiffEqBase._rate_prototype(u, t, one(t))
end
rateType = typeof(rate_prototype) ## Can be different if united
rateType = typeof(rate_prototype) ## Can be different if unitful

if isdae
if uBottomEltype == uBottomEltypeNoUnits
Expand Down

0 comments on commit ffb077f

Please sign in to comment.