From f2c6baf8144ac1087b9cb5dc1224c26085b23a83 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Tue, 19 Jun 2018 19:24:52 -0700 Subject: [PATCH] Move StateKind trait to Continuations --- src/Bifurcations.jl | 4 ++++ src/continuations/base.jl | 8 ++++++++ src/diffeq.jl | 9 --------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Bifurcations.jl b/src/Bifurcations.jl index 30bbd55..6e08db0 100644 --- a/src/Bifurcations.jl +++ b/src/Bifurcations.jl @@ -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 diff --git a/src/continuations/base.jl b/src/continuations/base.jl index e75f51e..36387fe 100644 --- a/src/continuations/base.jl +++ b/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. diff --git a/src/diffeq.jl b/src/diffeq.jl index 80ecc74..6521c46 100644 --- a/src/diffeq.jl +++ b/src/diffeq.jl @@ -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()