Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Nov 14, 2016
1 parent bda5885 commit 1cb297f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 54 deletions.
10 changes: 5 additions & 5 deletions src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ module DiffEqBase
abstract SensitivityFunction <: ParameterizedFunction

include("utils.jl")
include("solutions.jl")
include("ode_algorithms.jl")
include("ode_default_alg.jl")
include("plotrecipes.jl")
include("solutions/ode_solutions.jl")
include("algorithms/ode_algorithms.jl")
include("algorithms/ode_default_alg.jl")
include("solutions/solution_interface.jl")
include("tableaus.jl")
include("problems.jl")
include("problems/ode_problems.jl")

function solve end

Expand Down
File renamed without changes.
File renamed without changes.
Empty file.
3 changes: 0 additions & 3 deletions src/parameterized.jl

This file was deleted.

File renamed without changes.
46 changes: 0 additions & 46 deletions src/solutions.jl → src/solutions/ode_solutions.jl
Original file line number Diff line number Diff line change
@@ -1,49 +1,3 @@
### Abstract Interface

Base.length(sol::DESolution) = length(sol.u) # Must be on u for the test solutions!
Base.endof(sol::DESolution) = length(sol)
Base.getindex(sol::DESolution,i::Int) = sol.u[i]
Base.getindex(sol::DESolution,i::Int,I::Int...) = sol.u[i][I...]
Base.getindex(sol::DESolution,::Colon) = sol.u
Base.getindex(sol::DESolution,::Colon,i::Int...) = [sol.u[j][i...] for j in eachindex(sol)]
eachindex(sol::DESolution) = eachindex(sol.t)
tuples(sol::DESolution) = tuple.(sol.t,sol.u)

function start(sol::DESolution)
sol.tslocation = 1
1
end

function next(sol::DESolution,state)
state += 1
sol.tslocation = state
(sol,state)
end

function done(sol::DESolution,state)
state >= length(sol)
end

function eltype(sol::DESolution)
if typeof(sol[1]) <: AbstractArray
return typeof(sol[1][1])
else
return typeof(sol[1])
end
end

function print(io::IO, sol::DESolution)
println(io,"$(typeof(sol))")
println(io,"u: $(sol.u)")
println(io,"t: $(sol.t)")
nothing
end

function show(io::IO,sol::DESolution)
print(io,"$(typeof(sol))")
end


### Concrete Types

type ODESolution{uType,tType,rateType,P,A} <: AbstractODESolution
Expand Down
45 changes: 45 additions & 0 deletions src/plotrecipes.jl → src/solutions/solution_interface.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
### Abstract Interface

Base.length(sol::DESolution) = length(sol.u) # Must be on u for the test solutions!
Base.endof(sol::DESolution) = length(sol)
Base.getindex(sol::DESolution,i::Int) = sol.u[i]
Base.getindex(sol::DESolution,i::Int,I::Int...) = sol.u[i][I...]
Base.getindex(sol::DESolution,::Colon) = sol.u
Base.getindex(sol::DESolution,::Colon,i::Int...) = [sol.u[j][i...] for j in eachindex(sol)]
eachindex(sol::DESolution) = eachindex(sol.t)
tuples(sol::DESolution) = tuple.(sol.t,sol.u)

function start(sol::DESolution)
sol.tslocation = 1
1
end

function next(sol::DESolution,state)
state += 1
sol.tslocation = state
(sol,state)
end

function done(sol::DESolution,state)
state >= length(sol)
end

function eltype(sol::DESolution)
if typeof(sol[1]) <: AbstractArray
return typeof(sol[1][1])
else
return typeof(sol[1])
end
end

function print(io::IO, sol::DESolution)
println(io,"$(typeof(sol))")
println(io,"u: $(sol.u)")
println(io,"t: $(sol.t)")
nothing
end

function show(io::IO,sol::DESolution)
print(io,"$(typeof(sol))")
end

@recipe function f(sol::AbstractODESolution;sensitivity=false,plot_analytic=false,denseplot=true,plotdensity=100)
plotseries = Vector{Any}(0)
if typeof(sol) <: AbstractSDESolution; denseplot=false; end
Expand Down

0 comments on commit 1cb297f

Please sign in to comment.