Skip to content

Commit 6d35d93

Browse files
Merge pull request #2202 from SciML/initialize_size
Fix initialization size to not try/catch
2 parents 6a6efe5 + aa02da7 commit 6d35d93

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/OrdinaryDiffEq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ import ADTypes: AbstractADType,
108108
import Polyester
109109
using MacroTools, Adapt
110110

111-
using SciMLStructures: canonicalize, Tunable
111+
using SciMLStructures: canonicalize, Tunable, isscimlstructure
112112

113113
const CompiledFloats = Union{Float32, Float64,
114114
ForwardDiff.Dual{

src/initialize_dae.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,10 @@ function _initialize_dae!(integrator, prob::ODEProblem,
528528
if isAD
529529
csize = count(algebraic_vars)
530530
if !(p isa SciMLBase.NullParameters) && typeof(_u) !== typeof(u)
531-
try
531+
if isscimlstructure(p)
532532
csize = max(csize, length(canonicalize(Tunable(), p)[1]))
533-
catch
533+
else
534+
csize = max(csize, length(p))
534535
end
535536
end
536537
chunk = ForwardDiff.pickchunksize(csize)

0 commit comments

Comments
 (0)