Skip to content

Commit

Permalink
Move StateKind trait to Continuations
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jun 20, 2018
1 parent ab8e81b commit f2c6baf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/Bifurcations.jl
Expand Up @@ -11,6 +11,10 @@ import .Continuations: get_prob_cache, get_u0, residual!, residual_jacobian!,
residual, isindomain
const _C = AbstractProblemCache

# StateKind trait:
using .Continuations: statekind, MutableState, ImmutableState
import .Continuations: StateKind

include("codim1/codim1.jl")
using .Codim1: timekind, Continuous, Discrete
import .Codim1: TimeKind
Expand Down
8 changes: 8 additions & 0 deletions src/continuations/base.jl
@@ -1,3 +1,11 @@
abstract type StateKind end
struct MutableState <: StateKind end
struct ImmutableState <: StateKind end

statekind(::T) where T = StateKind(T)
# TODO: Use StateKind everywhere instead of boolean iip type parameter.


"""
Definition of continuation problem.
Expand Down
9 changes: 0 additions & 9 deletions src/diffeq.jl
Expand Up @@ -4,15 +4,6 @@ using Setfield: Lens, set, get
const DEP{iip} = AbstractODEProblem{uType, tType, iip} where {uType, tType}


abstract type StateKind end
struct MutableState <: StateKind end
struct ImmutableState <: StateKind end

statekind(::T) where T = StateKind(T)
# TODO: Move StateKind to continuations/base.jl and use it everywhere.
# It's only used in here at the moment.


TimeKind(::Type{<: DiscreteProblem}) = Discrete()
TimeKind(::Type{<: AbstractODEProblem}) = Continuous()
StateKind(::Type{<: DEP{true}}) = MutableState()
Expand Down

0 comments on commit f2c6baf

Please sign in to comment.