Skip to content

Commit

Permalink
fix tdir in simple integrators
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jan 3, 2020
1 parent 96c9d88 commit 3622ac7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
DiffEqBase = "6.5"
MuladdMacro = "0.2"
RecursiveArrayTools = "1.0"
Reexport = "0.2"
DiffEqBase = "6.5"
StaticArrays = "0.10, 0.11, 0.12"
MuladdMacro = "0.2"
julia = "1"

[extras]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["OrdinaryDiffEq", "Test"]
test = ["LinearAlgebra", "OrdinaryDiffEq", "Test"]
3 changes: 2 additions & 1 deletion src/functionmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mutable struct DiscreteIntegrator{F, IIP, uType,tType,P,S} <: DiffEqBase.DEInteg
p::P
sol::S
i::Int
tdir::tType
end

function DiffEqBase.__init(prob::DiscreteProblem,
Expand All @@ -72,7 +73,7 @@ function DiffEqBase.__init(prob::DiscreteProblem,
tType = typeof(prob.tspan[1])
P = typeof(prob.p)
S = typeof(sol)
DiscreteIntegrator{F, IIP, uType, tType, P, S}(prob.f,prob.u0,prob.tspan[1],copy(prob.u0),prob.p,sol,1)
DiscreteIntegrator{F, IIP, uType, tType, P, S}(prob.f,prob.u0,prob.tspan[1],copy(prob.u0),prob.p,sol,1,one(tType))
end

function DiffEqBase.step!(integrator::DiscreteIntegrator)
Expand Down
3 changes: 2 additions & 1 deletion src/tsit5/atsit5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mutable struct SimpleATsit5Integrator{IIP, S, T, P, F, N} <: DiffEqBase.Abstract
tf::T
dt::T # step size
dtnew::T
tdir::T
p::P # parameter container
u_modified::Bool
ks::Vector{S} # interpolants of the algorithm
Expand Down Expand Up @@ -117,7 +118,7 @@ function simpleatsit5_init(f::F,

integ = SAT5I{IIP, S, T, P, F, N}(
f, recursivecopy(u0), recursivecopy(u0), recursivecopy(u0), t0, t0, t0, tf, dt, dt,
p, true, ks, cs, as, btildes, rs,
sign(tf-t0), p, true, ks, cs, as, btildes, rs,
qoldinit,abstol,reltol, internalnorm
)
end
Expand Down
3 changes: 2 additions & 1 deletion src/tsit5/tsit5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mutable struct SimpleTsit5Integrator{IIP, S, T, P, F} <: DiffEqBase.AbstractODEI
t::T # current time
t0::T # initial time, only for reinit
dt::T # step size
tdir::T
p::P # parameter container
u_modified::Bool
ks::Vector{S} # interpolants of the algorithm
Expand Down Expand Up @@ -61,7 +62,7 @@ function simpletsit5_init(f::F,
!IIP && @assert S <: SArray

integ = ST5I{IIP, S, T, P, F}(
f, copy(u0), copy(u0), copy(u0), t0, t0, t0, dt, p, true, ks, cs, as, rs
f, copy(u0), copy(u0), copy(u0), t0, t0, t0, dt, sign(dt), p, true, ks, cs, as, rs
)
end

Expand Down

0 comments on commit 3622ac7

Please sign in to comment.