Skip to content

Commit 298a627

Browse files
authored
allow abstarct dictionaries to the 3.8 changes (#205)
* allow abstarct dictionaries instead * fix docs
1 parent eb2b839 commit 298a627

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "3.8.0"
4+
version = "3.8.1"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ referrenced_sciml_model
3333
```
3434

3535
```@docs
36-
reinit!(::DynamicalSystem, args...; kwargs...)
36+
reinit!(::DynamicalSystem, ::AbstractDict; kwargs...)
3737
set_state!
3838
set_parameter!
3939
set_parameters!

src/core/dynamicalsystem_interface.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,20 +377,20 @@ function set_state!(u::AbstractArray, value::Real, i, ds::DynamicalSystem)
377377
end
378378

379379
"""
380-
set_state!(ds::DynamicalSystem, mapping::Dict)
380+
set_state!(ds::DynamicalSystem, mapping::AbstractDict)
381381
382382
Convenience version of `set_state!` that iteratively calls `set_state!(ds, val, i)`
383383
for all index-value pairs `(i, val)` in `mapping`. This allows you to
384384
partially set only some state variables.
385385
"""
386-
function set_state!(ds::DynamicalSystem, mapping::Dict)
386+
function set_state!(ds::DynamicalSystem, mapping::AbstractDict)
387387
# ensure we use a mutable vector, so same code works for in-place problems
388388
# (SymbolicIndexingInterface only works with mutable objects)
389389
um = Array(copy(current_state(ds)))
390390
set_state!(um, mapping, ds)
391391
set_state!(ds, um)
392392
end
393-
function set_state!(um::Array{<:Real}, mapping::Dict, ds::DynamicalSystem)
393+
function set_state!(um::Array{<:Real}, mapping::AbstractDict, ds::DynamicalSystem)
394394
for (i, value) in pairs(mapping)
395395
set_state!(um, value, i, ds)
396396
end
@@ -438,7 +438,7 @@ end
438438
Set the parameter values in the [`current_parameters`](@ref)`(ds)` to match those in `p`.
439439
This is done as an in-place overwrite by looping over the keys of `p`
440440
hence `p` can be an arbitrary container mapping parameter indices to values
441-
(such as a `Vector{Real}`, `Vector{Pair}`, or `Dict`).
441+
(such as a `Vector{Real}`, `Vector{Pair}`, or `AbstractDict`).
442442
443443
The keys of `p` must be valid keys that can be given to [`set_parameter!`](@ref).
444444
"""
@@ -481,10 +481,10 @@ with initial state `u`. Practically every function of the ecosystem that evolves
481481
`ds` first calls this function on it. Besides the new state `u`, you
482482
can also configure the keywords `t0 = initial_time(ds)` and `p = current_parameters(ds)`.
483483
484-
reinit!(ds::DynamicalSystem, u::Dict; kwargs...) → ds
484+
reinit!(ds::DynamicalSystem, u::AbstractDict; kwargs...) → ds
485485
486-
If `u` is a `Dict` (for partially setting specific state variables in [`set_state`](@ref)),
487-
then the alterations in `u` are still done in the state given by the keyword
486+
If `u` is a `AbstractDict` (for partially setting specific state variables in [`set_state!`](@ref)),
487+
then the alterations are done in the state given by the keyword
488488
`reference_state = copy(initial_state(ds))`.
489489
490490
reinit!(ds, ::Nothing; kwargs...)
@@ -493,7 +493,7 @@ This method does nothing and leaves the system as is. This is so that downstream
493493
that call `reinit!` can still be used without resetting the system but rather
494494
continuing from its exact current state.
495495
"""
496-
function SciMLBase.reinit!(ds::DynamicalSystem, mapping::Dict;
496+
function SciMLBase.reinit!(ds::DynamicalSystem, mapping::AbstractDict;
497497
reference_state = copy(initial_state(ds)), kwargs...)
498498
um = Array(reference_state)
499499
set_state!(um, mapping, ds)

0 commit comments

Comments
 (0)