Skip to content

Commit a5e1e02

Browse files
committed
remove instances of
1 parent 6951e65 commit a5e1e02

File tree

9 files changed

+30
-43
lines changed

9 files changed

+30
-43
lines changed

src/systems/discrete_system/discrete_system.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ function SciMLBase.DiscreteProblem(
302302
parammap = SciMLBase.NullParameters();
303303
eval_module = @__MODULE__,
304304
eval_expression = false,
305-
use_union = false,
306305
kwargs...
307306
)
308307
if !iscomplete(sys)

src/systems/discrete_system/implicit_discrete_system.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ function SciMLBase.ImplicitDiscreteProblem(
321321
parammap = SciMLBase.NullParameters();
322322
eval_module = @__MODULE__,
323323
eval_expression = false,
324-
use_union = false,
325324
kwargs...
326325
)
327326
if !iscomplete(sys)

src/systems/jumps/jumpsystem.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ end
383383
```julia
384384
DiffEqBase.DiscreteProblem(sys::JumpSystem, u0map, tspan,
385385
parammap = DiffEqBase.NullParameters;
386-
use_union = true,
387386
kwargs...)
388387
```
389388
@@ -403,7 +402,6 @@ dprob = DiscreteProblem(complete(js), u₀map, tspan, parammap)
403402
"""
404403
function DiffEqBase.DiscreteProblem(sys::JumpSystem, u0map, tspan::Union{Tuple, Nothing},
405404
parammap = DiffEqBase.NullParameters();
406-
use_union = true,
407405
eval_expression = false,
408406
eval_module = @__MODULE__,
409407
kwargs...)
@@ -416,7 +414,7 @@ function DiffEqBase.DiscreteProblem(sys::JumpSystem, u0map, tspan::Union{Tuple,
416414
end
417415

418416
_f, u0, p = process_SciMLProblem(EmptySciMLFunction, sys, u0map, parammap;
419-
t = tspan === nothing ? nothing : tspan[1], use_union, tofloat = false, check_length = false, build_initializeprob = false)
417+
t = tspan === nothing ? nothing : tspan[1], tofloat = false, check_length = false, build_initializeprob = false)
420418
f = DiffEqBase.DISCRETE_INPLACE_DEFAULT
421419

422420
observedfun = ObservedFunctionCache(
@@ -451,14 +449,13 @@ struct DiscreteProblemExpr{iip} end
451449

452450
function DiscreteProblemExpr{iip}(sys::JumpSystem, u0map, tspan::Union{Tuple, Nothing},
453451
parammap = DiffEqBase.NullParameters();
454-
use_union = true,
455452
kwargs...) where {iip}
456453
if !iscomplete(sys)
457454
error("A completed `JumpSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `DiscreteProblemExpr`")
458455
end
459456

460457
_, u0, p = process_SciMLProblem(EmptySciMLFunction, sys, u0map, parammap;
461-
t = tspan === nothing ? nothing : tspan[1], use_union, tofloat = false, check_length = false)
458+
t = tspan === nothing ? nothing : tspan[1], tofloat = false, check_length = false)
462459
# identity function to make syms works
463460
quote
464461
f = DiffEqBase.DISCRETE_INPLACE_DEFAULT
@@ -475,7 +472,6 @@ end
475472
```julia
476473
DiffEqBase.ODEProblem(sys::JumpSystem, u0map, tspan,
477474
parammap = DiffEqBase.NullParameters;
478-
use_union = true,
479475
kwargs...)
480476
```
481477
@@ -497,7 +493,6 @@ oprob = ODEProblem(complete(js), u₀map, tspan, parammap)
497493
"""
498494
function DiffEqBase.ODEProblem(sys::JumpSystem, u0map, tspan::Union{Tuple, Nothing},
499495
parammap = DiffEqBase.NullParameters();
500-
use_union = false,
501496
eval_expression = false,
502497
eval_module = @__MODULE__,
503498
kwargs...)
@@ -517,7 +512,7 @@ function DiffEqBase.ODEProblem(sys::JumpSystem, u0map, tspan::Union{Tuple, Nothi
517512
build_initializeprob = false, kwargs...)
518513
else
519514
_, u0, p = process_SciMLProblem(EmptySciMLFunction, sys, u0map, parammap;
520-
t = tspan === nothing ? nothing : tspan[1], use_union, tofloat = false,
515+
t = tspan === nothing ? nothing : tspan[1], tofloat = false,
521516
check_length = false)
522517
f = (du, u, p, t) -> (du .= 0; nothing)
523518
observedfun = ObservedFunctionCache(sys; eval_expression, eval_module,

src/systems/optimization/optimizationsystem.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
295295
cons_sparse = false, checkbounds = false,
296296
linenumbers = true, parallel = SerialForm(),
297297
eval_expression = false, eval_module = @__MODULE__,
298-
use_union = false,
299298
checks = true,
300299
kwargs...) where {iip}
301300
if !iscomplete(sys)
@@ -338,10 +337,10 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
338337
elseif has_index_cache(sys) && get_index_cache(sys) !== nothing
339338
p = MTKParameters(sys, parammap, u0map)
340339
else
341-
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat = false, use_union)
340+
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat = false)
342341
end
343-
lb = varmap_to_vars(dvs .=> lb, dvs; defaults = defs, tofloat = false, use_union)
344-
ub = varmap_to_vars(dvs .=> ub, dvs; defaults = defs, tofloat = false, use_union)
342+
lb = varmap_to_vars(dvs .=> lb, dvs; defaults = defs, tofloat = false)
343+
ub = varmap_to_vars(dvs .=> ub, dvs; defaults = defs, tofloat = false)
345344

346345
if !isnothing(lb) && all(lb .== -Inf) && !isnothing(ub) && all(ub .== Inf)
347346
lb = nothing
@@ -538,7 +537,6 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0map,
538537
checkbounds = false,
539538
linenumbers = false, parallel = SerialForm(),
540539
eval_expression = false, eval_module = @__MODULE__,
541-
use_union = false,
542540
kwargs...) where {iip}
543541
if !iscomplete(sys)
544542
error("A completed `OptimizationSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `OptimizationProblemExpr`")
@@ -578,10 +576,10 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0map,
578576
if has_index_cache(sys) && get_index_cache(sys) !== nothing
579577
p = MTKParameters(sys, parammap, u0map)
580578
else
581-
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat = false, use_union)
579+
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat = false)
582580
end
583-
lb = varmap_to_vars(dvs .=> lb, dvs; defaults = defs, tofloat = false, use_union)
584-
ub = varmap_to_vars(dvs .=> ub, dvs; defaults = defs, tofloat = false, use_union)
581+
lb = varmap_to_vars(dvs .=> lb, dvs; defaults = defs, tofloat = false)
582+
ub = varmap_to_vars(dvs .=> ub, dvs; defaults = defs, tofloat = false)
585583

586584
if !isnothing(lb) && all(lb .== -Inf) && !isnothing(ub) && all(ub .== Inf)
587585
lb = nothing

src/systems/parameter_buffer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This requires that `complete` has been called on the system (usually via
2727
the default behavior).
2828
"""
2929
function MTKParameters(
30-
sys::AbstractSystem, p, u0 = Dict(); tofloat = false, use_union = false,
30+
sys::AbstractSystem, p, u0 = Dict(); tofloat = false,
3131
t0 = nothing, substitution_limit = 1000)
3232
ic = if has_index_cache(sys) && get_index_cache(sys) !== nothing
3333
get_index_cache(sys)

src/systems/problem_utils.jl

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,17 @@ in `varmap`. Does not perform symbolic substitution in the values of `varmap`.
333333
334334
Keyword arguments:
335335
- `tofloat`: Convert values to floating point numbers using `float`.
336-
- `use_union`: Use a `Union`-typed array if the values have heterogeneous types.
337336
- `container_type`: The type of container to use for the values.
338337
- `toterm`: The `toterm` method to use for converting symbolics.
339338
- `promotetoconcrete`: whether the promote to a concrete buffer (respecting
340-
`tofloat` and `use_union`). Defaults to `container_type <: AbstractArray`.
339+
`tofloat`). Defaults to `container_type <: AbstractArray`.
341340
- `check`: Error if any variables in `vars` do not have a mapping in `varmap`. Uses
342341
[`missingvars`](@ref) to perform the check.
343342
- `allow_symbolic` allows the returned array to contain symbolic values. If this is `true`,
344343
`promotetoconcrete` is set to `false`.
345344
"""
346345
function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
347-
tofloat = true, use_union = true, container_type = Array,
346+
tofloat = true, container_type = Array,
348347
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false)
349348
isempty(vars) && return nothing
350349

@@ -366,7 +365,7 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
366365

367366
promotetoconcrete === nothing && (promotetoconcrete = container_type <: AbstractArray)
368367
if promotetoconcrete && !allow_symbolic
369-
vals = promote_to_concrete(vals; tofloat = tofloat, use_union = use_union)
368+
vals = promote_to_concrete(vals; tofloat = tofloat, use_union = false)
370369
end
371370

372371
if isempty(vals)
@@ -704,8 +703,7 @@ Keyword arguments:
704703
- `fully_determined`: Override whether the initialization system is fully determined.
705704
- `check_initialization_units`: Enable or disable unit checks when constructing the
706705
initialization problem.
707-
- `tofloat`, `use_union`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and
708-
possibly `p`).
706+
- `tofloat`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and possibly `p`).
709707
- `u0_constructor`: A function to apply to the `u0` value returned from `better_varmap_to_vars`
710708
to construct the final `u0` value.
711709
- `du0map`: A map of derivatives to values. See `implicit_dae`.
@@ -735,7 +733,7 @@ function process_SciMLProblem(
735733
implicit_dae = false, t = nothing, guesses = AnyDict(),
736734
warn_initialize_determined = true, initialization_eqs = [],
737735
eval_expression = false, eval_module = @__MODULE__, fully_determined = nothing,
738-
check_initialization_units = false, tofloat = true, use_union = false,
736+
check_initialization_units = false, tofloat = true,
739737
u0_constructor = identity, du0map = nothing, check_length = true,
740738
symbolic_u0 = false, warn_cyclic_dependency = false,
741739
circular_dependency_max_cycle_length = length(all_symbols(sys)),
@@ -814,8 +812,7 @@ function process_SciMLProblem(
814812
evaluate_varmap!(op, dvs; limit = substitution_limit)
815813

816814
u0 = better_varmap_to_vars(
817-
op, dvs; tofloat, use_union = false,
818-
container_type = u0Type, allow_symbolic = symbolic_u0)
815+
op, dvs; tofloat, container_type = u0Type, allow_symbolic = symbolic_u0)
819816

820817
if u0 !== nothing
821818
u0 = u0_constructor(u0)
@@ -840,7 +837,7 @@ function process_SciMLProblem(
840837
if is_split(sys)
841838
p = MTKParameters(sys, op)
842839
else
843-
p = better_varmap_to_vars(op, ps; tofloat, use_union, container_type = pType)
840+
p = better_varmap_to_vars(op, ps; tofloat, container_type = pType)
844841
end
845842

846843
if implicit_dae && du0map !== nothing
@@ -909,15 +906,14 @@ end
909906
##############
910907

911908
"""
912-
u0, p, defs = get_u0_p(sys, u0map, parammap; use_union=true, tofloat=true)
909+
u0, p, defs = get_u0_p(sys, u0map, parammap; tofloat=true)
913910
914911
Take dictionaries with initial conditions and parameters and convert them to numeric arrays `u0` and `p`. Also return the merged dictionary `defs` containing the entire operating point.
915912
"""
916913
function get_u0_p(sys,
917914
u0map,
918915
parammap = nothing;
919916
t0 = nothing,
920-
use_union = true,
921917
tofloat = true,
922918
symbolic_u0 = false)
923919
dvs = unknowns(sys)
@@ -956,19 +952,19 @@ function get_u0_p(sys,
956952
end
957953

958954
if symbolic_u0
959-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = false, use_union = false)
955+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = false)
960956
else
961-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, use_union)
957+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true)
962958
end
963-
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat, use_union)
959+
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat)
964960
p = p === nothing ? SciMLBase.NullParameters() : p
965961
t0 !== nothing && delete!(defs, get_iv(sys))
966962
u0, p, defs
967963
end
968964

969965
function get_u0(
970966
sys, u0map, parammap = nothing; symbolic_u0 = false,
971-
toterm = default_toterm, t0 = nothing, use_union = true)
967+
toterm = default_toterm, t0 = nothing)
972968
dvs = unknowns(sys)
973969
ps = parameters(sys)
974970
defs = defaults(sys)
@@ -991,9 +987,9 @@ function get_u0(
991987
defs = mergedefaults(defs, obsmap, u0map, dvs)
992988
if symbolic_u0
993989
u0 = varmap_to_vars(
994-
u0map, dvs; defaults = defs, tofloat = false, use_union = false, toterm)
990+
u0map, dvs; defaults = defs, tofloat = false, toterm)
995991
else
996-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, use_union, toterm)
992+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, toterm)
997993
end
998994
t0 !== nothing && delete!(defs, get_iv(sys))
999995
return u0, defs

src/variables.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ applicable.
158158
"""
159159
function varmap_to_vars(varmap, varlist; defaults = Dict(), check = true,
160160
toterm = default_toterm, promotetoconcrete = nothing,
161-
tofloat = true, use_union = true)
161+
tofloat = true)
162162
varlist = collect(map(unwrap, varlist))
163163

164164
# Edge cases where one of the arguments is effectively empty.
@@ -194,7 +194,7 @@ function varmap_to_vars(varmap, varlist; defaults = Dict(), check = true,
194194

195195
promotetoconcrete === nothing && (promotetoconcrete = container_type <: AbstractArray)
196196
if promotetoconcrete
197-
vals = promote_to_concrete(vals; tofloat = tofloat, use_union = use_union)
197+
vals = promote_to_concrete(vals; tofloat = tofloat, use_union = false)
198198
end
199199

200200
if isempty(vals)

test/odesystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ let
736736

737737
pmap = [k1 => 1, k2 => 1]
738738
tspan = (0.0, 1.0)
739-
prob = ODEProblem(sys, u0map, tspan, pmap)
739+
prob = ODEProblem(sys, u0map, tspan, pmap);
740740
@test eltype(vcat(prob.p...)) === Float64
741741

742742
prob = ODEProblem(sys, u0map, tspan, pmap)
@@ -745,7 +745,7 @@ let
745745
# No longer supported, Tuple used instead
746746
# pmap = Pair{Any, Union{Int, Float64}}[k1 => 1, k2 => 1.0]
747747
# tspan = (0.0, 1.0)
748-
# prob = ODEProblem(sys, u0map, tspan, pmap, use_union = true)
748+
# prob = ODEProblem(sys, u0map, tspan, pmap)
749749
# @test eltype(prob.p) === Union{Float64, Int}
750750
end
751751

@@ -1208,7 +1208,7 @@ end
12081208
sys = structural_simplify(ODESystem([D(x) ~ P], t, [x], [P]; name = :sys))
12091209

12101210
function x_at_1(P)
1211-
prob = ODEProblem(sys, [x => P], (0.0, 1.0), [sys.P => P], use_union = false)
1211+
prob = ODEProblem(sys, [x => P], (0.0, 1.0), [sys.P => P])
12121212
return solve(prob, Tsit5())(1.0)
12131213
end
12141214

test/split_parameters.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ sol = solve(prob, ImplicitEuler());
123123
# ------------------------ Mixed Type Conserved
124124

125125
prob = ODEProblem(
126-
sys, [], tspan, []; tofloat = false, use_union = true, build_initializeprob = false)
126+
sys, [], tspan, []; tofloat = false, build_initializeprob = false)
127127

128128
@test prob.p isa Vector{Union{Float64, Int64}}
129129
sol = solve(prob, ImplicitEuler());

0 commit comments

Comments
 (0)