Skip to content

Commit 3c663da

Browse files
authored
Merge pull request #285 from JuliaDynamics/hw/rename_delete_init
Hw/rename delete init
2 parents 2119bee + 73ee411 commit 3c663da

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## v0.10.1 Changelog
44
- [#283](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/283) add automatic sparsity detection using `get_jac_prototype` and `set_jac_prototype!`
5+
- [#285](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/285) rename `delete_initconstraint!` -> `delete_initconstaints!` and `delete_initformula!` -> `delete_initformulas!`
56

67
## v0.10 Changelog
78
- **BREAKING**: the interface initialization of components has changed: it is now split up in two versions, mutating and non mutating version. Also it errors now if the tolerance bounds are violated. See docs on initialization for more details.

docs/src/API.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ EdgeModel(::ModelingToolkit.ODESystem, ::Any, ::Any, ::Any, ::Any)
2323
EdgeModel(::ModelingToolkit.ODESystem, ::Any, ::Any, ::Any)
2424
```
2525

26-
### Output Function Helpers/Wrappers
26+
### Output Function Helpers/Wrappers
2727
```@docs
2828
StateMask
2929
Symmetric
@@ -165,7 +165,7 @@ init_residual
165165
InitConstraint
166166
@initconstraint
167167
set_initconstraint!
168-
delete_initconstraint!
168+
delete_initconstraints!
169169
has_initconstraint
170170
get_initconstraints
171171
add_initconstraint!
@@ -175,7 +175,7 @@ has_initformula
175175
get_initformulas
176176
set_initformula!
177177
add_initformula!
178-
delete_initformula!
178+
delete_initformulas!
179179
interface_values
180180
```
181181

ext/NetworkDynamicsSparsityExt.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ set_jac_prototype!(nw; jac_prototype) # attach pattern to network
5656
prob = ODEProblem(nw, x0, (0.0, 1.0), p0) # uses jac prototype from network
5757
sol = solve(prob, Rodas5P())
5858
```
59-
60-
See also: [`set_jac_prototype!`](@ref)
6159
"""
6260
function NetworkDynamics.get_jac_prototype(nw::Network; dense=false, remove_conditions=false, check=true)
6361
nw_original = nw

src/NetworkDynamics.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export has_bounds, get_bounds, set_bounds!, delete_bounds!
9696
export has_graphelement, get_graphelement, set_graphelement!
9797
export get_initial_state, dump_initial_state, dump_state
9898
export has_callback, get_callbacks, set_callback!, add_callback!
99-
export has_initconstraint, get_initconstraints, set_initconstraint!, add_initconstraint!, delete_initconstraint!
100-
export has_initformula, get_initformulas, set_initformula!, add_initformula!, delete_initformula!
99+
export has_initconstraint, get_initconstraints, set_initconstraint!, add_initconstraint!, delete_initconstraints!
100+
export has_initformula, get_initformulas, set_initformula!, add_initformula!, delete_initformulas!
101101
export has_position, get_position, set_position!
102102
export has_marker, get_marker, set_marker!
103103
export get_defaults_dict, get_guesses_dict, get_bounds_dict, get_inits_dict

src/metadata.jl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ get_initconstraints(nw::Network, idx::ECIndex) = get_initconstraints(getcomp(nw,
535535
Sets the initialization constraint(s) for the component. Overwrites any existing constraints.
536536
`constraint` can be a single `InitConstraint` or a tuple of `InitConstraint` objects.
537537
538-
See also: [`add_initconstraint!`](@ref), [`get_initconstraints`](@ref), [`delete_initconstraint!`](@ref).
538+
See also: [`add_initconstraint!`](@ref), [`get_initconstraints`](@ref), [`delete_initconstraints!`](@ref).
539539
"""
540540
function set_initconstraint!(c::ComponentModel, constraint; check=true)
541541
if !(constraint isa InitConstraint) && !(constraint isa Tuple && all(c -> c isa InitConstraint, constraint))
@@ -586,18 +586,18 @@ add_initconstraint!(nw::Network, idx::VCIndex, constraint; kw...) = add_initcons
586586
add_initconstraint!(nw::Network, idx::ECIndex, constraint; kw...) = add_initconstraint!(getcomp(nw, idx), constraint; kw...)
587587

588588
"""
589-
delete_initconstraint!(c::ComponentModel)
590-
delete_initconstraint!(nw::Network, idx::Union{VIndex,EIndex})
589+
delete_initconstraints!(c::ComponentModel)
590+
delete_initconstraints!(nw::Network, idx::Union{VIndex,EIndex})
591591
592592
Removes the initialization constraint from the component model,
593593
or from a component referenced by `idx` in a network.
594594
Returns `true` if the constraint existed and was removed, `false` otherwise.
595595
596596
See also: [`set_initconstraint!`](@ref).
597597
"""
598-
delete_initconstraint!(c::ComponentModel) = delete_metadata!(c, :initconstraint)
599-
delete_initconstraint!(nw::Network, idx::VCIndex) = delete_initconstraint!(getcomp(nw, idx))
600-
delete_initconstraint!(nw::Network, idx::ECIndex) = delete_initconstraint!(getcomp(nw, idx))
598+
delete_initconstraints!(c::ComponentModel) = delete_metadata!(c, :initconstraint)
599+
delete_initconstraints!(nw::Network, idx::VCIndex) = delete_initconstraints!(getcomp(nw, idx))
600+
delete_initconstraints!(nw::Network, idx::ECIndex) = delete_initconstraints!(getcomp(nw, idx))
601601

602602
####
603603
#### Init formulas
@@ -637,7 +637,7 @@ get_initformulas(nw::Network, idx::ECIndex) = get_initformulas(getcomp(nw, idx))
637637
Sets the initialization formula(s) for the component. Overwrites any existing formulas.
638638
`formula` can be a single `InitFormula` or a tuple of `InitFormula` objects.
639639
640-
See also: [`add_initformula!`](@ref), [`get_initformulas`](@ref), [`delete_initformula!`](@ref).
640+
See also: [`add_initformula!`](@ref), [`get_initformulas`](@ref), [`delete_initformulas!`](@ref).
641641
"""
642642
function set_initformula!(c::ComponentModel, formula; check=true)
643643
if !(formula isa InitFormula) && !(formula isa Tuple && all(f -> f isa InitFormula, formula))
@@ -688,18 +688,22 @@ add_initformula!(nw::Network, idx::VCIndex, formula; kw...) = add_initformula!(g
688688
add_initformula!(nw::Network, idx::ECIndex, formula; kw...) = add_initformula!(getcomp(nw, idx), formula; kw...)
689689

690690
"""
691-
delete_initformula!(c::ComponentModel)
692-
delete_initformula!(nw::Network, idx::Union{VIndex,EIndex})
691+
delete_initformulas!(c::ComponentModel)
692+
delete_initformulas!(nw::Network, idx::Union{VIndex,EIndex})
693693
694694
Removes all initialization formulas from the component model,
695695
or from a component referenced by `idx` in a network.
696696
Returns `true` if formulas existed and were removed, `false` otherwise.
697697
698698
See also: [`set_initformula!`](@ref), [`add_initformula!`](@ref).
699699
"""
700-
delete_initformula!(c::ComponentModel) = delete_metadata!(c, :initformula)
701-
delete_initformula!(nw::Network, idx::VCIndex) = delete_initformula!(getcomp(nw, idx))
702-
delete_initformula!(nw::Network, idx::ECIndex) = delete_initformula!(getcomp(nw, idx))
700+
delete_initformulas!(c::ComponentModel) = delete_metadata!(c, :initformula)
701+
delete_initformulas!(nw::Network, idx::VCIndex) = delete_initformulas!(getcomp(nw, idx))
702+
delete_initformulas!(nw::Network, idx::ECIndex) = delete_initformulas!(getcomp(nw, idx))
703+
704+
# Deprecated backward compatibility
705+
@deprecate delete_initconstraint!(args...; kwargs...) delete_initconstraints!(args...; kwargs...)
706+
@deprecate delete_initformula!(args...; kwargs...) delete_initformulas!(args...; kwargs...)
703707

704708

705709
# generate methods and docstrings for position and marker

0 commit comments

Comments
 (0)