Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Forets committed Sep 21, 2024
1 parent 8dd2b2a commit 3dbcab6
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Algorithms/A20/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function post(alg::A20{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...) where {N}
@unpack δ, max_order = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
# x' = Ax, x in X, or
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/ASB07/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function post(alg::ASB07{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...) where {N}
@unpack δ, approx_model, max_order, reduction_method, static, recursive, dim, ngens = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
# x' = Ax, x in X, or
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/BFFPSV18/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function post(alg::BFFPSV18{N,ST}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
@unpack δ, approx_model, vars, block_indices,
row_blocks, column_blocks = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
# x' = Ax, x in X, or
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/BOX/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function post(alg::BOX{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...) where {N}
@unpack δ, approx_model, static, dim, recursive = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/GLGM06/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function post(alg::GLGM06{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
@unpack δ, approx_model, max_order, static, dim, ngens,
preallocate, reduction_method, disjointness_method = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
# x' = Ax, x in X, or
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/INT/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function post(alg::INT{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;

@unpack δ, approx_model = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/LGG09/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function post(alg::LGG09{N,AM,VN,TN}, ivp::IVP{<:AbstractContinuousSystem}, tspa
@assert statedim(ivp) == dim(template) "the problems' dimension $(statedim(ivp)) " *
"doesn't match the dimension of the template directions, $(dim(template))"

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/ORBIT/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function post(alg::ORBIT{N,VT,AM}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...) where {N,VT,AM}
@unpack δ, approx_model = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

U = inputset(ivp)

Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/VREP/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function post(alg::VREP{N}, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...) where {N}
@unpack δ, approx_model, static, dim = alg

NSTEPS = _get_nsteps(kwargs, δ, tspan)
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
# x' = Ax, x in X, or
Expand Down
13 changes: 4 additions & 9 deletions src/Continuous/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,10 @@ function _get_T(tspan::TimeInterval; check_zero::Bool=true, check_positive::Bool
return T
end

function _get_nsteps(kwargs, δ, tspan)
if haskey(kwargs, :NSTEPS)
NSTEPS = kwargs[:NSTEPS]
else
# get time horizon from the time span imposing that it is of the form (0, T)
T = _get_T(tspan; check_zero=true, check_positive=true)
NSTEPS = ceil(Int, T / δ)
end
return NSTEPS
function compute_nsteps(δ, tspan)
# get time horizon from the time span imposing that it is of the form (0, T)
T = _get_T(tspan; check_zero=true, check_positive=true)
return NSTEPS = ceil(Int, T / δ)
end

tstart(Δt::TimeInterval) = inf(Δt)
Expand Down

0 comments on commit 3dbcab6

Please sign in to comment.