-
-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Labels
bugSomething isn't workingSomething isn't working
Description
For consistency, would it be possible to make M4 work like M3?
using ModelingToolkit
@independent_variables t
D = Differential(t)
@variables x(t)
@named M1 = System([D(x) ~ 0], t; initial_conditions = Dict(x => 0)) # works
@named M2 = System([D(x) ~ 0], t; initial_conditions = [x => 0]) # works
@named M3 = System([D(x) ~ 0], t; initial_conditions = Dict()) # works
@named M4 = System([D(x) ~ 0], t; initial_conditions = []) # failsERROR: MethodError: no method matching defsdict(::Vector{Any})
The function `defsdict` exists, but no method is defined for this combination of argument types.
Closest candidates are:
defsdict(::ModelingToolkitBase.AtomicArrayDict{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, Dict{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}}})
@ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/lC2g8/src/systems/system.jl:379
defsdict(::Union{AbstractDict, AbstractArray{<:Pair}})
@ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/lC2g8/src/systems/system.jl:380
I am programmatically generating initial_conditions. Sometimes it ends up as an empty array, and it would be nice to not have to treat that with a special case in my code. Similarly for bindings and other similar fields.
I know I can probably always use a Dict and be fine, but maybe it would be nice to support arrays in the same way?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working