@@ -330,17 +330,17 @@ struct MissingGuessError <: Exception
330
330
vals:: Vector{Any}
331
331
end
332
332
333
- function Base. showerror (io:: IO , err:: MissingGuessError )
334
- println (io,
335
- """
336
- Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map: \
337
- """ )
333
+ function Base. showerror (io:: IO , err:: MissingGuessError )
334
+ println (io,
335
+ """
336
+ Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map: \
337
+ """ )
338
338
for (sym, val) in zip (err. syms, err. vals)
339
339
println (io, " $sym => $val " )
340
340
end
341
341
println (io,
342
- """
343
- In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable. """ )
342
+ """
343
+ In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable. """ )
344
344
end
345
345
346
346
"""
@@ -351,20 +351,20 @@ in `varmap`. Does not perform symbolic substitution in the values of `varmap`.
351
351
352
352
Keyword arguments:
353
353
- `tofloat`: Convert values to floating point numbers using `float`.
354
- - `use_union`: Use a `Union`-typed array if the values have heterogeneous types.
355
354
- `container_type`: The type of container to use for the values.
356
355
- `toterm`: The `toterm` method to use for converting symbolics.
357
356
- `promotetoconcrete`: whether the promote to a concrete buffer (respecting
358
- `tofloat` and `use_union` ). Defaults to `container_type <: AbstractArray`.
357
+ `tofloat`). Defaults to `container_type <: AbstractArray`.
359
358
- `check`: Error if any variables in `vars` do not have a mapping in `varmap`. Uses
360
359
[`missingvars`](@ref) to perform the check.
361
360
- `allow_symbolic` allows the returned array to contain symbolic values. If this is `true`,
362
361
`promotetoconcrete` is set to `false`.
363
362
- `is_initializeprob, guesses`: Used to determine whether the system is missing guesses.
364
363
"""
365
364
function better_varmap_to_vars (varmap:: AbstractDict , vars:: Vector ;
366
- tofloat = true , use_union = true , container_type = Array,
367
- toterm = default_toterm, promotetoconcrete = nothing , check = true , allow_symbolic = false , is_initializeprob = false )
365
+ tofloat = true , container_type = Array,
366
+ toterm = default_toterm, promotetoconcrete = nothing , check = true ,
367
+ allow_symbolic = false , is_initializeprob = false )
368
368
isempty (vars) && return nothing
369
369
370
370
if check
@@ -382,8 +382,8 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
382
382
end
383
383
384
384
if ! isempty (missingsyms)
385
- is_initializeprob ? throw (MissingGuessError (missingsyms, missingvals)) :
386
- throw (UnexpectedSymbolicValueInVarmap (missingsyms[1 ], missingvals[1 ]))
385
+ is_initializeprob ? throw (MissingGuessError (missingsyms, missingvals)) :
386
+ throw (UnexpectedSymbolicValueInVarmap (missingsyms[1 ], missingvals[1 ]))
387
387
end
388
388
end
389
389
@@ -393,7 +393,7 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
393
393
394
394
promotetoconcrete === nothing && (promotetoconcrete = container_type <: AbstractArray )
395
395
if promotetoconcrete && ! allow_symbolic
396
- vals = promote_to_concrete (vals; tofloat = tofloat, use_union = use_union )
396
+ vals = promote_to_concrete (vals; tofloat = tofloat, use_union = false )
397
397
end
398
398
399
399
if isempty (vals)
@@ -731,8 +731,7 @@ Keyword arguments:
731
731
- `fully_determined`: Override whether the initialization system is fully determined.
732
732
- `check_initialization_units`: Enable or disable unit checks when constructing the
733
733
initialization problem.
734
- - `tofloat`, `use_union`, `is_initializeprob`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and
735
- possibly `p`).
734
+ - `tofloat`, `is_initializeprob`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and possibly `p`).
736
735
- `u0_constructor`: A function to apply to the `u0` value returned from `better_varmap_to_vars`
737
736
to construct the final `u0` value.
738
737
- `du0map`: A map of derivatives to values. See `implicit_dae`.
@@ -762,7 +761,7 @@ function process_SciMLProblem(
762
761
implicit_dae = false , t = nothing , guesses = AnyDict (),
763
762
warn_initialize_determined = true , initialization_eqs = [],
764
763
eval_expression = false , eval_module = @__MODULE__ , fully_determined = nothing ,
765
- check_initialization_units = false , tofloat = true , use_union = false ,
764
+ check_initialization_units = false , tofloat = true ,
766
765
u0_constructor = identity, du0map = nothing , check_length = true ,
767
766
symbolic_u0 = false , warn_cyclic_dependency = false ,
768
767
circular_dependency_max_cycle_length = length (all_symbols (sys)),
@@ -841,7 +840,7 @@ function process_SciMLProblem(
841
840
evaluate_varmap! (op, dvs; limit = substitution_limit)
842
841
843
842
u0 = better_varmap_to_vars (
844
- op, dvs; tofloat = true , use_union = false ,
843
+ op, dvs; tofloat,
845
844
container_type = u0Type, allow_symbolic = symbolic_u0, is_initializeprob)
846
845
847
846
if u0 != = nothing
@@ -867,15 +866,15 @@ function process_SciMLProblem(
867
866
if is_split (sys)
868
867
p = MTKParameters (sys, op)
869
868
else
870
- p = better_varmap_to_vars (op, ps; tofloat, use_union, container_type = pType)
869
+ p = better_varmap_to_vars (op, ps; tofloat, container_type = pType)
871
870
end
872
871
873
872
if implicit_dae && du0map != = nothing
874
873
ddvs = map (Differential (iv), dvs)
875
874
du0map = to_varmap (du0map, ddvs)
876
875
merge! (op, du0map)
877
876
du0 = varmap_to_vars (op, ddvs; toterm = identity,
878
- tofloat = true )
877
+ tofloat)
879
878
kwargs = merge (kwargs, (; ddvs))
880
879
else
881
880
du0 = nothing
@@ -944,8 +943,8 @@ function get_u0_p(sys,
944
943
u0map,
945
944
parammap = nothing ;
946
945
t0 = nothing ,
947
- use_union = true ,
948
946
tofloat = true ,
947
+ use_union = true ,
949
948
symbolic_u0 = false )
950
949
dvs = unknowns (sys)
951
950
ps = parameters (sys; initial_parameters = true )
@@ -985,7 +984,7 @@ function get_u0_p(sys,
985
984
if symbolic_u0
986
985
u0 = varmap_to_vars (u0map, dvs; defaults = defs, tofloat = false , use_union = false )
987
986
else
988
- u0 = varmap_to_vars (u0map, dvs; defaults = defs, tofloat = true , use_union)
987
+ u0 = varmap_to_vars (u0map, dvs; defaults = defs, tofloat, use_union)
989
988
end
990
989
p = varmap_to_vars (parammap, ps; defaults = defs, tofloat, use_union)
991
990
p = p === nothing ? SciMLBase. NullParameters () : p
0 commit comments