Skip to content

Commit 14253d1

Browse files
committed
remove unpacksys
1 parent ec649b8 commit 14253d1

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

src/reactionsystem.jl

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,47 +1148,6 @@ function reactionsystem_uptodate_check()
11481148
end
11491149
end
11501150

1151-
# used in the `__unpacksys` function.
1152-
function __unpacksys(rn)
1153-
ex = :(begin end)
1154-
for key in keys(get_var_to_name(rn))
1155-
var = MT.getproperty(rn, key, namespace = false)
1156-
push!(ex.args, :($key = $var))
1157-
end
1158-
ex
1159-
end
1160-
1161-
"""
1162-
@unpacksys sys::ModelingToolkit.AbstractSystem
1163-
1164-
Loads all species, variables, parameters, and observables defined in `sys` as
1165-
variables within the calling module.
1166-
1167-
For example,
1168-
```julia
1169-
sir = @reaction_network SIR begin
1170-
β, S + I --> 2I
1171-
ν, I --> R
1172-
end
1173-
@unpacksys sir
1174-
```
1175-
will load the symbolic variables, `S`, `I`, `R`, `ν` and `β`.
1176-
1177-
Notes:
1178-
- Can not be used to load species, variables, or parameters of subsystems or
1179-
constraints. Either call `@unpacksys` on those systems directly, or
1180-
[`flatten`](@ref) to collate them into one system before calling.
1181-
- Note that this places symbolic variables within the calling module's scope, so
1182-
calling from a function defined in a script or the REPL will still result in
1183-
the symbolic variables being defined in the `Main` module.
1184-
"""
1185-
macro unpacksys(rn)
1186-
quote
1187-
ex = Catalyst.__unpacksys($(esc(rn)))
1188-
Base.eval($(__module__), ex)
1189-
end
1190-
end
1191-
11921151
"""
11931152
setdefaults!(rn, newdefs)
11941153

test/miscellaneous_tests/api.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ let
346346

347347
# Rest unpacking variables.
348348
function unpacktest(rn)
349-
Catalyst.@unpacksys rn
349+
@unpack S1, I1, R1, α1, β1 = rn
350350
u₀ = [S1 => 999.0, I1 => 1.0, R1 => 0.0]
351351
p = [α1 => 1e-4, β1 => 0.01]
352352
op = ODEProblem(rn, u₀, (0.0, 250.0), p)

0 commit comments

Comments
 (0)