@@ -632,8 +632,9 @@ $(TYPEDFIELDS)
632
632
"""
633
633
struct ReconstructInitializeprob{G}
634
634
"""
635
- A function which when called on the original problem returns the parameter object of
636
- the initialization problem.
635
+ A function which when given the original problem and initialization problem, returns
636
+ the parameter object of the initialization problem with values copied from the
637
+ original.
637
638
"""
638
639
getter:: G
639
640
end
@@ -693,14 +694,18 @@ function ReconstructInitializeprob(
693
694
end
694
695
getters = (tunable_getter, Returns (SizedVector {0, Float64} ()), rest_getters... )
695
696
getter = let getters = getters
696
- function _getter (valp)
697
+ function _getter (valp, initprob )
697
698
MTKParameters (getters[1 ](valp), getters[2 ](valp), getters[3 ](valp),
698
- getters[4 ](valp), getters[5 ](valp), ( ))
699
+ getters[4 ](valp), getters[5 ](valp), copy .( parameter_values (initprob) . caches ))
699
700
end
700
701
end
701
702
else
702
703
syms = parameters (dstsys)
703
- getter = concrete_getu (srcsys, syms)
704
+ getter = let inner = concrete_getu (srcsys, syms)
705
+ function _getter2 (valp, initprob)
706
+ inner (valp)
707
+ end
708
+ end
704
709
end
705
710
return ReconstructInitializeprob (getter)
706
711
end
@@ -712,7 +717,7 @@ Copy values from `srcvalp` to `dstvalp`. Returns the new `u0` and `p`.
712
717
"""
713
718
function (rip:: ReconstructInitializeprob )(srcvalp, dstvalp)
714
719
# copy parameters
715
- newp = rip. getter (srcvalp)
720
+ newp = rip. getter (srcvalp, dstvalp )
716
721
# no `u0`, so no type-promotion
717
722
if state_values (dstvalp) === nothing
718
723
return nothing , newp
0 commit comments