Skip to content

Commit

Permalink
Move Continuation{Solver,Solution} to top-level
Browse files Browse the repository at this point in the history
Initially, I thought it's nice to have Bifurcations.Continuations usable
as a separate package since numerical continuation without (say)
stability analysis may be handy.  However, solution containers etc.
requires a tight coupling to the bifurcation problem (e.g., storing
Jacobian and its eigenproblem solutions).  I can probably define a very
general solution container but it's not a good idea to do at the moment
as I don't know what I need.  So, let's pull ContinuationSolution,
ContinuationSolver and other related stuff out of the sub-module
Bifurcations.Continuations.
  • Loading branch information
tkf committed Jun 18, 2018
1 parent 1e90247 commit 7103447
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 9 deletions.
18 changes: 16 additions & 2 deletions src/Bifurcations.jl
Expand Up @@ -2,15 +2,29 @@ module Bifurcations

# Re-export methods from DifferentialEquations extended here:
export init, solve, solve!, step!
using DiffEqBase: init, solve, solve!, step!
# see: continuations/interface.jl
import DiffEqBase: init, solve, solve!, step!
# see: solver.jl

include("continuations/continuations.jl")

# Continuation algorithm interface:
using .Continuations: ContinuationCache, ContinuationOptions,
predictor_corrector_step!, new_branches!
# TODO: Reconsider what/how `.Continuations` module "exposes"
# continuation algorithm/method/solver interface. For example, should
# `predictor_corrector_step!` be renamed to `step!`?

# Continuation problem interface:
using .Continuations: AbstractContinuationProblem, AbstractProblemCache
import .Continuations: get_prob_cache, get_u0, residual!, residual_jacobian!,
residual, isindomain
const _C = AbstractProblemCache

include("utils.jl")

include("solution.jl")
include("solver.jl")

include("fixedpoint.jl")
include("diffeq.jl")
include("examples/examples.jl")
Expand Down
10 changes: 9 additions & 1 deletion src/continuations/branching.jl
Expand Up @@ -95,7 +95,15 @@ function solve_simple_bifurcation!(cache, opts, u0, tJ, L, Q)
end


function new_branches!(cache, opts, sbint::SimpleBifurcationInterval)
function new_branches!(
cache::ContinuationCache,
opts::ContinuationOptions,
sbint)
# TODO: `sbint` is expected to be a `SimpleBifurcationInterval`
# but it is defined in "down stream". I should turn this into a
# function with "flat" arguments: `new_branches!(cache, opts, u0,
# u1, direction, h)`.

u0, tJ, L, Q = find_simple_bifurcation!(cache, opts, sbint)
# TODO: handle not-found case

Expand Down
3 changes: 0 additions & 3 deletions src/continuations/continuations.jl
@@ -1,10 +1,7 @@
module Continuations
import DiffEqBase: solve, solve!, init, step!
include("utils.jl")
include("base.jl")
include("euler_newton.jl")
include("solution.jl")
include("interface.jl")
include("zero_point.jl")
include("branching.jl")
end
2 changes: 0 additions & 2 deletions src/plotting.jl
@@ -1,7 +1,5 @@
using RecipesBase

using .Continuations: ContinuationSolution, sweeps_as_vectors

@recipe function f(sol::ContinuationSolution; vars = (0, 1))
ix, iy = vars
xs = sweeps_as_vectors(sol, ix)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/utils.jl
@@ -0,0 +1,2 @@
using .Continuations: isalmostzero
# [[./continuations/utils.jl]]
2 changes: 1 addition & 1 deletion test/test_normal_form.jl
Expand Up @@ -2,7 +2,7 @@ module TestNormalForm

using Base.Test
using Bifurcations
using Bifurcations.Continuations: sweeps_as_vectors
using Bifurcations: sweeps_as_vectors
using Bifurcations.Examples: Pitchfork, Transcritical

@testset "$normal" for normal in [Pitchfork, Transcritical]
Expand Down

0 comments on commit 7103447

Please sign in to comment.