Skip to content

Commit 12b8832

Browse files
Merge pull request #740 from AayushSabharwal/as/fix-remake-specialization
fix: fix `remake` changing specialization of `ODEFunction`
2 parents 9978e5b + d2c7570 commit 12b8832

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/remake.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,20 @@ function remake(prob::ODEProblem; f = missing,
125125
end
126126
else
127127
_f = prob.f
128-
@reset _f.initializeprob = initializeprob
129-
@reset _f.initializeprobmap = initializeprobmap
128+
if __has_initializeprob(_f)
129+
props = getproperties(_f)
130+
@reset props.initializeprob = initializeprob
131+
props = values(props)
132+
_f = parameterless_type(_f){
133+
iip, specialization(_f), map(typeof, props)...}(props...)
134+
end
135+
if __has_initializeprobmap(_f)
136+
props = getproperties(_f)
137+
@reset props.initializeprobmap = initializeprobmap
138+
props = values(props)
139+
_f = parameterless_type(_f){
140+
iip, specialization(_f), map(typeof, props)...}(props...)
141+
end
130142
end
131143
elseif f isa AbstractODEFunction
132144
_f = f

0 commit comments

Comments
 (0)