Skip to content

Commit 9c95970

Browse files
committed
remove instances of
1 parent fca98e0 commit 9c95970

File tree

9 files changed

+37
-35
lines changed

9 files changed

+37
-35
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: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ Keyword arguments:
363363
"""
364364
function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
365365
tofloat = true, container_type = Array,
366+
<<<<<<< HEAD
366367
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false, is_initializeprob = false)
368+
=======
369+
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false)
370+
>>>>>>> a5e1e0239a (remove instances of)
367371
isempty(vars) && return nothing
368372

369373
if check
@@ -730,8 +734,12 @@ Keyword arguments:
730734
- `fully_determined`: Override whether the initialization system is fully determined.
731735
- `check_initialization_units`: Enable or disable unit checks when constructing the
732736
initialization problem.
737+
<<<<<<< HEAD
733738
- `tofloat`, `use_union`, `is_initializeprob`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and
734739
possibly `p`).
740+
=======
741+
- `tofloat`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and possibly `p`).
742+
>>>>>>> a5e1e0239a (remove instances of)
735743
- `u0_constructor`: A function to apply to the `u0` value returned from `better_varmap_to_vars`
736744
to construct the final `u0` value.
737745
- `du0map`: A map of derivatives to values. See `implicit_dae`.
@@ -761,7 +769,7 @@ function process_SciMLProblem(
761769
implicit_dae = false, t = nothing, guesses = AnyDict(),
762770
warn_initialize_determined = true, initialization_eqs = [],
763771
eval_expression = false, eval_module = @__MODULE__, fully_determined = nothing,
764-
check_initialization_units = false, tofloat = true, use_union = false,
772+
check_initialization_units = false, tofloat = true,
765773
u0_constructor = identity, du0map = nothing, check_length = true,
766774
symbolic_u0 = false, warn_cyclic_dependency = false,
767775
circular_dependency_max_cycle_length = length(all_symbols(sys)),
@@ -841,6 +849,7 @@ function process_SciMLProblem(
841849

842850
u0 = better_varmap_to_vars(
843851
<<<<<<< HEAD
852+
<<<<<<< HEAD
844853
<<<<<<< HEAD
845854
op, dvs; tofloat = true, use_union = false,
846855
container_type = u0Type, allow_symbolic = symbolic_u0, is_initializeprob)
@@ -851,6 +860,9 @@ function process_SciMLProblem(
851860
>>>>>>> 6951e652f2 (fix: don't propagate for u0)
852861
container_type = u0Type, allow_symbolic = symbolic_u0)
853862
>>>>>>> e31ae1bcc9 (fix: propagate `tofloat`, `use_union` to `better_varmap_to_vars`)
863+
=======
864+
op, dvs; tofloat, container_type = u0Type, allow_symbolic = symbolic_u0)
865+
>>>>>>> a5e1e0239a (remove instances of)
854866

855867
if u0 !== nothing
856868
u0 = u0_constructor(u0)
@@ -875,7 +887,7 @@ function process_SciMLProblem(
875887
if is_split(sys)
876888
p = MTKParameters(sys, op)
877889
else
878-
p = better_varmap_to_vars(op, ps; tofloat, use_union, container_type = pType)
890+
p = better_varmap_to_vars(op, ps; tofloat, container_type = pType)
879891
end
880892

881893
if implicit_dae && du0map !== nothing
@@ -944,15 +956,14 @@ end
944956
##############
945957

946958
"""
947-
u0, p, defs = get_u0_p(sys, u0map, parammap; use_union=true, tofloat=true)
959+
u0, p, defs = get_u0_p(sys, u0map, parammap; tofloat=true)
948960
949961
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.
950962
"""
951963
function get_u0_p(sys,
952964
u0map,
953965
parammap = nothing;
954966
t0 = nothing,
955-
use_union = true,
956967
tofloat = true,
957968
symbolic_u0 = false)
958969
dvs = unknowns(sys)
@@ -991,19 +1002,19 @@ function get_u0_p(sys,
9911002
end
9921003

9931004
if symbolic_u0
994-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = false, use_union = false)
1005+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = false)
9951006
else
996-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, use_union)
1007+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true)
9971008
end
998-
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat, use_union)
1009+
p = varmap_to_vars(parammap, ps; defaults = defs, tofloat)
9991010
p = p === nothing ? SciMLBase.NullParameters() : p
10001011
t0 !== nothing && delete!(defs, get_iv(sys))
10011012
u0, p, defs
10021013
end
10031014

10041015
function get_u0(
10051016
sys, u0map, parammap = nothing; symbolic_u0 = false,
1006-
toterm = default_toterm, t0 = nothing, use_union = true)
1017+
toterm = default_toterm, t0 = nothing)
10071018
dvs = unknowns(sys)
10081019
ps = parameters(sys)
10091020
defs = defaults(sys)
@@ -1026,9 +1037,9 @@ function get_u0(
10261037
defs = mergedefaults(defs, obsmap, u0map, dvs)
10271038
if symbolic_u0
10281039
u0 = varmap_to_vars(
1029-
u0map, dvs; defaults = defs, tofloat = false, use_union = false, toterm)
1040+
u0map, dvs; defaults = defs, tofloat = false, toterm)
10301041
else
1031-
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, use_union, toterm)
1042+
u0 = varmap_to_vars(u0map, dvs; defaults = defs, tofloat = true, toterm)
10321043
end
10331044
t0 !== nothing && delete!(defs, get_iv(sys))
10341045
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)