From e720b0fd9d2286a77912735dc27846c204e50d71 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Fri, 29 Jun 2018 20:54:40 -0700 Subject: [PATCH] Warn simple bifurcations in new_branches! --- src/continuations/branching.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/continuations/branching.jl b/src/continuations/branching.jl index 6ea6c12..0e91bef 100644 --- a/src/continuations/branching.jl +++ b/src/continuations/branching.jl @@ -154,13 +154,23 @@ function new_branches!(cache, opts, sbint::SimpleBifurcationInterval) args = (sbint.h, sbint.direction) u1, h1 = predictor_corrector_step!(cache, opts, u0, tv, args...) + simple_bifurcation1 = cache.simple_bifurcation u2, h2 = predictor_corrector_step!(cache, opts, u0, -tv, args...) + simple_bifurcation2 = cache.simple_bifurcation # TODO: Make error message creation lazy; i.e., store the points # and vectors in a custom exception type and construct the message # in showerror. parallel_to_old = du -> abs(du ⋅ tv0) > abs(du ⋅ tv) failures = [] + if simple_bifurcation1 || simple_bifurcation2 + push!(failures, "Simple bifurcation during the first corrector.") + if ! simple_bifurcation1 + push!(failures, "Only the second branch had simple bifurcation.") + elseif ! simple_bifurcation2 + push!(failures, "Only the first branch had simple bifurcation.") + end + end if parallel_to_old(u1 .- u0) || parallel_to_old(u2 .- u0) push!(failures, string( "New branch candidates are more parallel to the old curve",