@@ -138,6 +138,33 @@ function OrdinaryDiffEqCore.perform_step!(integrator::DDEIntegrator)
138138 nothing
139139end
140140
141+ # DefaultCache sumtype does lazy initializations of sub-caches
142+ # Need to overload this function so that the history function has initialized caches
143+ # https://github.com/SciML/DelayDiffEq.jl/issues/329
144+ function OrdinaryDiffEqCore. perform_step! (integrator:: DDEIntegrator , cache:: OrdinaryDiffEqCore.DefaultCache , repeat_step = false )
145+ algs = integrator. alg. algs
146+ OrdinaryDiffEqCore. init_ith_default_cache (cache, algs, cache. current)
147+ if cache. current == 1
148+ integrator. history. integrator. cache. cache1 = cache. cache1
149+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache1), repeat_step)
150+ elseif cache. current == 2
151+ integrator. history. integrator. cache. cache2 = cache. cache2
152+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache2), repeat_step)
153+ elseif cache. current == 3
154+ integrator. history. integrator. cache. cache3 = cache. cache3
155+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache3), repeat_step)
156+ elseif cache. current == 4
157+ integrator. history. integrator. cache. cache4 = cache. cache4
158+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache4), repeat_step)
159+ elseif cache. current == 5
160+ integrator. history. integrator. cache. cache5 = cache. cache5
161+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache5), repeat_step)
162+ elseif cache. current == 6
163+ integrator. history. integrator. cache. cache6 = cache. cache6
164+ OrdinaryDiffEqCore. perform_step! (integrator, @inbounds (cache. cache6), repeat_step)
165+ end
166+ end
167+
141168# initialize the integrator
142169function DiffEqBase. initialize! (integrator:: DDEIntegrator )
143170 ode_integrator = integrator. integrator
0 commit comments