Skip to content

Commit

Permalink
stronger typing of interpolations, callback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jan 8, 2017
1 parent e70fbdb commit 0fd1c7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
immutable Callback{F1,F2,T,T2} <: DECallback
immutable Callback{F1,F2,F3,T,T2} <: DECallback
condition::F1
affect!::F2
affect_neg!::F3
rootfind::Bool
interp_points::Int
save_positions::Tuple{Bool,Bool}
Expand All @@ -9,8 +10,10 @@ immutable Callback{F1,F2,T,T2} <: DECallback
end

Callback(condition,affect!,
rootfind,interp_points,
rootfind,
save_positions;
abstol=1e-14,reltol=0) = Callback(condition,affect!,
affect_neg! = affect!,
interp_points=10,
abstol=1e-14,reltol=0) = Callback(condition,affect!,affect_neg!,
rootfind,interp_points,
save_positions,abstol,reltol)
6 changes: 3 additions & 3 deletions src/problems/ode_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ type ODEProblem{uType,tType,isinplace,F} <: AbstractODEProblem{uType,tType,isinp
tspan::Tuple{tType,tType}
end

type ODETestProblem{uType,tType,isinplace,F} <: AbstractODETestProblem{uType,tType,isinplace,F}
type ODETestProblem{uType,AType,tType,isinplace,F} <: AbstractODETestProblem{uType,tType,isinplace,F}
f::F
u0::uType
analytic::Base.Callable
analytic::AType
tspan::Tuple{tType,tType}
end

Expand All @@ -16,7 +16,7 @@ function ODEProblem(f,u0,tspan; iip = isinplace(f,3))
end

function ODETestProblem(f,u0,analytic,tspan=(0.0,1.0); iip = isinplace(f,3))
ODETestProblem{typeof(u0),eltype(tspan),iip,typeof(f)}(f,u0,analytic,tspan)
ODETestProblem{typeof(u0),typeof(analytic),eltype(tspan),iip,typeof(f)}(f,u0,analytic,tspan)
end

function print{uType,tType,isinplace,F}(io::IO, prob::AbstractODEProblem{uType,tType,isinplace,F})
Expand Down
8 changes: 4 additions & 4 deletions src/solutions/ode_solutions.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
### Concrete Types

type ODESolution{uType,tType,rateType,P,A} <: AbstractODESolution
type ODESolution{uType,tType,rateType,P,A,IType} <: AbstractODESolution
u::uType
t::tType
k::rateType
prob::P
alg::A
interp::Function
interp::IType
dense::Bool
tslocation::Int
end
(sol::ODESolution)(t) = sol.interp(t)

type ODETestSolution{uType,uType2,uEltype,tType,rateType,P,A} <: AbstractODETestSolution
type ODETestSolution{uType,uType2,uEltype,tType,rateType,P,A,IType} <: AbstractODETestSolution
u::uType
u_analytic::uType2
errors::Dict{Symbol,uEltype}
t::tType
k::rateType
prob::P
alg::A
interp::Function
interp::IType
dense::Bool
tslocation::Int
end
Expand Down

0 comments on commit 0fd1c7a

Please sign in to comment.