Skip to content

Commit bb05184

Browse files
refactor: deprecate structural_simplify and @mtkbuild
1 parent 52d3ab8 commit bb05184

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/ModelingToolkit.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export alias_elimination, flatten
288288
export connect, domain_connect, @connector, Connection, AnalysisPoint, Flow, Stream,
289289
instream
290290
export initial_state, transition, activeState, entry, ticksInState, timeInState
291-
export @component, @mtkmodel, @mtkcompile
291+
export @component, @mtkmodel, @mtkcompile, @mtkbuild
292292
export isinput, isoutput, getbounds, hasbounds, getguess, hasguess, isdisturbance,
293293
istunable, getdist, hasdist,
294294
tunable_parameters, isirreducible, getdescription, hasdescription,
@@ -305,7 +305,7 @@ export independent_variable, equations, controls, observed, full_equations, jump
305305
brownians
306306
export initialization_equations, guesses, defaults, parameter_dependencies, hierarchy
307307
export mtkcompile, expand_connections, linearize, linearization_function,
308-
LinearizationProblem
308+
LinearizationProblem, structural_simplify
309309
export solve
310310
export Pre
311311

src/systems/abstractsystem.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,13 @@ macro mtkcompile(exprs...)
24912491
end)
24922492
end
24932493

2494+
macro mtkbuild(exprs...)
2495+
return quote
2496+
Base.depwarn("`@mtkbuild` is deprecated. Use `@mtkcompile` instead.", :mtkbuild)
2497+
@mtkcompile $(exprs...)
2498+
end |> esc
2499+
end
2500+
24942501
"""
24952502
debug_system(sys::AbstractSystem; functions = [log, sqrt, (^), /, inv, asin, acos], error_nonfinite = true)
24962503

src/systems/systems.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ function __mtkcompile(sys::AbstractSystem; simplify = false,
158158
end
159159
end
160160

161+
@deprecate structural_simplify(sys; kwargs...) mtkcompile(sys; kwargs...)
162+
@deprecate structural_simplify(sys, io; kwargs...) mtkcompile(
163+
sys; inputs = io[1], outputs = io[2], kwargs...)
164+
161165
function simplify_optimization_system(sys::System; split = true, kwargs...)
162166
sys = flatten(sys)
163167
cons = constraints(sys)

test/structural_transformation/utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,10 @@ end
436436
@test integ.ps[p] 3.0
437437
end
438438
end
439+
440+
@testset "Deprecated `structural_simplify` and `@mtkbuild`" begin
441+
@variables x(t)
442+
@test_deprecated @mtkbuild sys = System([D(x) ~ x], t)
443+
@named sys = System([D(x) ~ x], t)
444+
@test_deprecated structural_simplify(sys)
445+
end

0 commit comments

Comments
 (0)