Skip to content

Commit 15782f2

Browse files
refactor: rename @mtkbuild to @mtkcompile
1 parent 94446d3 commit 15782f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+292
-292
lines changed

src/ModelingToolkit.jl

Lines changed: 1 addition & 1 deletion
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, @mtkbuild
291+
export @component, @mtkmodel, @mtkcompile
292292
export isinput, isoutput, getbounds, hasbounds, getguess, hasguess, isdisturbance,
293293
istunable, getdist, hasdist,
294294
tunable_parameters, isirreducible, getdescription, hasdescription,

src/problems/bvproblem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If a `System` without `constraints` is specified, it will be treated as an initi
3030
D(D(y)) ~ λ * y - g
3131
x(t)^2 + y^2 ~ 1]
3232
cstr = [x(0.5) ~ 1]
33-
@mtkbuild pend = System(eqs, t; constraints = cstrs)
33+
@mtkcompile pend = System(eqs, t; constraints = cstrs)
3434
3535
tspan = (0.0, 1.5)
3636
u0map = [x(t) => 0.6, y => 0.8]

src/systems/abstractsystem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ may be subsetted using `dvs` and `ps`. All `kwargs` are passed to the internal
146146
[`build_function`](@ref) call. The returned function can be called as `f(u, p, t)` or
147147
`f(du, u, p, t)` for time-dependent systems and `f(u, p)` or `f(du, u, p)` for
148148
time-independent systems. If `split=true` (the default) was passed to [`complete`](@ref),
149-
[`structural_simplify`](@ref) or [`@mtkbuild`](@ref), `p` is expected to be an `MTKParameters`
149+
[`structural_simplify`](@ref) or [`@mtkcompile`](@ref), `p` is expected to be an `MTKParameters`
150150
object.
151151
"""
152152
function generate_custom_function(sys::AbstractSystem, exprs, dvs = unknowns(sys),
@@ -2470,7 +2470,7 @@ macro component(expr)
24702470
esc(component_post_processing(expr, false))
24712471
end
24722472

2473-
macro mtkbuild(exprs...)
2473+
macro mtkcompile(exprs...)
24742474
expr = exprs[1]
24752475
named_expr = ModelingToolkit.named_expr(expr)
24762476
name = named_expr.args[1]

src/systems/parameter_buffer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependent systems. It is only required if the symbolic expressions also use the
2323
variable of the system.
2424
2525
This requires that `complete` has been called on the system (usually via
26-
`structural_simplify` or `@mtkbuild`) and the keyword `split = true` was passed (which is
26+
`structural_simplify` or `@mtkcompile`) and the keyword `split = true` was passed (which is
2727
the default behavior).
2828
"""
2929
function MTKParameters(

test/bvproblem.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ daesolvers = [Ascher2, Ascher4, Ascher6]
2020
parammap ==> 7.5, β => 4, γ => 8.0, δ => 5.0]
2121
tspan = (0.0, 10.0)
2222

23-
@mtkbuild lotkavolterra = System(eqs, t)
23+
@mtkcompile lotkavolterra = System(eqs, t)
2424
op = ODEProblem(lotkavolterra, u0map, tspan, parammap)
2525
osol = solve(op, Vern9())
2626

@@ -52,7 +52,7 @@ end
5252
eqs = [D(θ) ~ θ_t
5353
D(θ_t) ~ -(g / L) * sin(θ)]
5454

55-
@mtkbuild pend = System(eqs, t)
55+
@mtkcompile pend = System(eqs, t)
5656

5757
u0map ==> π / 2, θ_t => π / 2]
5858
parammap = [:L => 1.0, :g => 9.81]
@@ -91,7 +91,7 @@ end
9191
D(y(t)) ~ -γ * y(t) + δ * x(t) * y(t)]
9292

9393
tspan = (0.0, 1.0)
94-
@mtkbuild lksys = System(eqs, t)
94+
@mtkcompile lksys = System(eqs, t)
9595

9696
function lotkavolterra!(du, u, p, t)
9797
du[1] = p[1] * u[1] - p[2] * u[1] * u[2]
@@ -104,7 +104,7 @@ end
104104

105105
# Test with a constraint.
106106
constr = [y(0.5) ~ 2.0]
107-
@mtkbuild lksys = System(eqs, t; constraints = constr)
107+
@mtkcompile lksys = System(eqs, t; constraints = constr)
108108

109109
function bc!(resid, u, p, t)
110110
resid[1] = u(0.0)[1] - 1.0
@@ -177,21 +177,21 @@ end
177177
tspan = (0.0, 1.0)
178178
guess = [x(t) => 4.0, y(t) => 2.0]
179179
constr = [x(0.6) ~ 3.5, x(0.3) ~ 7.0]
180-
@mtkbuild lksys = System(eqs, t; constraints = constr)
180+
@mtkcompile lksys = System(eqs, t; constraints = constr)
181181

182182
bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(
183183
lksys, u0map, tspan; guesses = guess)
184184
test_solvers(solvers, bvp, u0map, constr; dt = 0.05)
185185

186186
# Testing that more complicated constraints give correct solutions.
187187
constr = [y(0.2) + x(0.8) ~ 3.0, y(0.3) ~ 2.0]
188-
@mtkbuild lksys = System(eqs, t; constraints = constr)
188+
@mtkcompile lksys = System(eqs, t; constraints = constr)
189189
bvp = SciMLBase.BVProblem{false, SciMLBase.FullSpecialize}(
190190
lksys, u0map, tspan; guesses = guess)
191191
test_solvers(solvers, bvp, u0map, constr; dt = 0.05)
192192

193193
constr =* β - x(0.6) ~ 0.0, y(0.2) ~ 3.0]
194-
@mtkbuild lksys = System(eqs, t; constraints = constr)
194+
@mtkcompile lksys = System(eqs, t; constraints = constr)
195195
bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(
196196
lksys, u0map, tspan; guesses = guess)
197197
test_solvers(solvers, bvp, u0map, constr)
@@ -205,7 +205,7 @@ end
205205
# eqs = [D(D(x)) ~ λ * x
206206
# D(D(y)) ~ λ * y - g
207207
# x^2 + y^2 ~ 1]
208-
# @mtkbuild pend = System(eqs, t)
208+
# @mtkcompile pend = System(eqs, t)
209209
#
210210
# tspan = (0.0, 1.5)
211211
# u0map = [x => 1, y => 0]
@@ -243,7 +243,7 @@ end
243243
# D(D(y)) ~ λ * y - g
244244
# x(t)^2 + y^2 ~ 1]
245245
# constr = [x(0.5) ~ 1]
246-
# @mtkbuild pend = System(eqs, t; constr)
246+
# @mtkcompile pend = System(eqs, t; constr)
247247
#
248248
# tspan = (0.0, 1.5)
249249
# u0map = [x(t) => 0.6, y => 0.8]
@@ -262,13 +262,13 @@ end
262262
#
263263
# constr = [x(0.5) ~ 1,
264264
# x(0.3)^3 + y(0.6)^2 ~ 0.5]
265-
# @mtkbuild pend = System(eqs, t; constr)
265+
# @mtkcompile pend = System(eqs, t; constr)
266266
# bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(pend, u0map, tspan, parammap; guesses, check_length = false)
267267
# test_solvers(daesolvers, bvp, u0map, constr, get_alg_eqs(pend))
268268
#
269269
# constr = [x(0.4) * g ~ y(0.2),
270270
# y(0.7) ~ 0.3]
271-
# @mtkbuild pend = System(eqs, t; constr)
271+
# @mtkcompile pend = System(eqs, t; constr)
272272
# bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(pend, u0map, tspan, parammap; guesses, check_length = false)
273273
# test_solvers(daesolvers, bvp, u0map, constr, get_alg_eqs(pend))
274274
# end
@@ -286,7 +286,7 @@ end
286286
parammap ==> 7.5, β => 4, γ => 8.0, δ => 5.0]
287287
costs = [x(0.6), x(0.3)^2]
288288
consolidate(u, sub) = (u[1] + 3)^2 + u[2] + sum(sub; init = 0)
289-
@mtkbuild lksys = System(eqs, t; costs, consolidate)
289+
@mtkcompile lksys = System(eqs, t; costs, consolidate)
290290

291291
@test_throws ModelingToolkit.SystemCompatibilityError ODEProblem(
292292
lksys, u0map, tspan, parammap)
@@ -301,7 +301,7 @@ end
301301
@parameters t_c
302302
costs = [y(t_c) + x(0.0), x(0.4)^2]
303303
consolidate(u, sub) = log(u[1]) - u[2] + sum(sub; init = 0)
304-
@mtkbuild lksys = System(eqs, t; costs, consolidate)
304+
@mtkcompile lksys = System(eqs, t; costs, consolidate)
305305
@test t_c Set(parameters(lksys))
306306
push!(parammap, t_c => 0.56)
307307
prob = ODEProblem(lksys, u0map, tspan, parammap; check_compatibility = false)

test/clock.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ eqs = [yd ~ Sample(dt)(y)
518518
end
519519
end
520520

521-
@mtkbuild model = FirstOrderWithStepCounter()
521+
@mtkcompile model = FirstOrderWithStepCounter()
522522
prob = ODEProblem(model, [], (0.0, 10.0))
523523
sol = solve(prob, Tsit5(), kwargshandle = KeywordArgSilent)
524524

@@ -529,7 +529,7 @@ eqs = [yd ~ Sample(dt)(y)
529529
@variables x(t)=1.0 y(t)=1.0
530530
eqs = [D(y) ~ Hold(x)
531531
x ~ x(k - 1) + x(k - 2)]
532-
@mtkbuild sys = System(eqs, t)
532+
@mtkcompile sys = System(eqs, t)
533533
prob = ODEProblem(sys, [], (0.0, 10.0))
534534
int = init(prob, Tsit5(); kwargshandle = KeywordArgSilent)
535535
@test int.ps[x] == 2.0

test/code_generation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ end
5858
@testset "Non-standard array variables" begin
5959
@variables x(t)
6060
@parameters p[0:2] (f::Function)(..)
61-
@mtkbuild sys = System(D(x) ~ p[0] * x + p[1] * t + p[2] + f(p), t)
61+
@mtkcompile sys = System(D(x) ~ p[0] * x + p[1] * t + p[2] + f(p), t)
6262
prob = ODEProblem(sys, [x => 1.0], (0.0, 1.0), [p => [1.0, 2.0, 3.0], f => sum])
6363
@test prob.ps[p] == [1.0, 2.0, 3.0]
6464
@test prob.ps[p[0]] == 1.0

test/constants.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ simp = structural_simplify(sys)
4141
@variables x(MT.t_nounits) = h
4242
eqs = [MT.D_nounits(x) ~ (h - x) / τ]
4343

44-
@mtkbuild fol_model = System(eqs, MT.t_nounits)
44+
@mtkcompile fol_model = System(eqs, MT.t_nounits)
4545

4646
prob = ODEProblem(fol_model, [], (0.0, 10.0), [h => 1])
4747
@test prob[x] 1

test/dde.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ eqs = [D(x₀) ~ (v0 / (1 + beta0 * (x₂(t - tau)^2))) * (p0 - q0) * x₀ - d0
3838
D(x₁) ~ (v0 / (1 + beta0 * (x₂(t - tau)^2))) * (1 - p0 + q0) * x₀ +
3939
(v1 / (1 + beta1 * (x₂(t - tau)^2))) * (p1 - q1) * x₁ - d1 * x₁
4040
D(x₂(t)) ~ (v1 / (1 + beta1 * (x₂(t - tau)^2))) * (1 - p1 + q1) * x₁ - d2 * x₂(t)]
41-
@mtkbuild sys = System(eqs, t)
41+
@mtkcompile sys = System(eqs, t)
4242
@test ModelingToolkit.is_dde(sys)
4343
@test !is_markovian(sys)
4444
prob = DDEProblem(sys,
@@ -81,7 +81,7 @@ sol = solve(prob, RKMil(), seed = 100)
8181
@brownian η
8282
τ = 1.0
8383
eqs = [D(x(t)) ~ a * x(t) + b * x(t - τ) + c +* x(t) + γ) * η, delx ~ x(t - τ)]
84-
@mtkbuild sys = System(eqs, t)
84+
@mtkcompile sys = System(eqs, t)
8585
@test ModelingToolkit.has_observed_with_lhs(sys, delx)
8686
@test ModelingToolkit.is_dde(sys)
8787
@test !is_markovian(sys)
@@ -162,7 +162,7 @@ prob_sa = DDEProblem(sys, [], (0.0, 10.0); constant_lags = [sys.osc1.τ, sys.osc
162162
return System([D(x) ~ dx], t; name = name)
163163
end
164164

165-
@mtkbuild ssys = System(
165+
@mtkcompile ssys = System(
166166
Equation[], t; systems = [valve(name = :valve), veccy(name = :vvecs)])
167167
prob = DDEProblem(ssys, [ssys.valve.opening => 1.0], (0.0, 1.0))
168168
sol = solve(prob, MethodOfSteps(Tsit5()))

test/debugging.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ end
4242
(System, ODEProblem, inner_ode, Tsit5()),
4343
(System, SDEProblem, inner_sde, ImplicitEM())]
4444
kwargs = Problem == SDEProblem ? (; seed = SEED) : (;)
45-
@mtkbuild outer = ctor(Equation[], t; systems = [inner])
45+
@mtkcompile outer = ctor(Equation[], t; systems = [inner])
4646
dsys = debug_system(outer; functions = [])
4747
@test is_parameter(dsys, ASSERTION_LOG_VARIABLE)
4848
prob = Problem(dsys, [inner.x => 0.1], (0.0, 5.0); kwargs...)

0 commit comments

Comments
 (0)