Skip to content

Commit

Permalink
inplace interpolations for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Feb 1, 2017
1 parent 4afff38 commit e04accf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/integrators/integrator_interface.jl
Expand Up @@ -5,15 +5,13 @@
if t < integrator.tprev
error("Current interpolant only works between tprev and t")
elseif t != integrator.t
new_u = integrator(t)
integrator.dtnew = integrator.t - t
perform_rswm_rejection!(integrator)

if typeof(integrator.u) <: AbstractArray
recursivecopy!(integrator.u,new_u)
integrator(integrator.u,t)
else
integrator.u = new_u
integrator.u = integrator(t)
end
integrator.dtnew = integrator.t - t
perform_rswm_rejection!(integrator) #this only changes dt and noise, so no interpolation problems
integrator.t = t
# reeval_internals_due_to_modification!(integrator) # Not necessary for linear interp
if T
Expand Down
4 changes: 2 additions & 2 deletions src/integrators/integrator_utils.jl
Expand Up @@ -74,9 +74,9 @@ end
curt = pop!(integrator.opts.saveat)
if integrator.opts.saveat!=integrator.t # If <t, interpolate
Θ = (curt - integrator.tprev)/integrator.dt
val = sde_interpolant(Θ,integrator)
val = sde_interpolant(Θ,integrator,indices(integrator.uprev),Val{0}) # out of place, but force copy later
copyat_or_push!(integrator.sol.t,integrator.saveiter,curt)
copyat_or_push!(integrator.sol.u,integrator.saveiter,val)
copyat_or_push!(integrator.sol.u,integrator.saveiter,val,Val{false})
if typeof(integrator.alg) <: StochasticEqCompositeAlgorithm
copyat_or_push!(integrator.sol.alg_choice,integrator.saveiter,integrator.cache.current)
end
Expand Down

0 comments on commit e04accf

Please sign in to comment.