Skip to content

Commit d9bca37

Browse files
Merge pull request #3860 from SciML/revert-juliaformatter
[ci-skip] Revert JuliaFormatter PR #3846
2 parents 7b15e70 + a469380 commit d9bca37

Some content is hidden

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

56 files changed

+294
-271
lines changed

docs/src/API/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ For systems that contain parameters with metadata like described above, have som
293293
In the example below, we define a system with tunable parameters and extract bounds vectors
294294

295295
```@example metadata
296-
@variables x(t)=0 u(t)=0 [input = true] y(t)=0 [output = true]
296+
@variables x(t)=0 u(t)=0 [input=true] y(t)=0 [output=true]
297297
@parameters T [tunable = true, bounds = (0, Inf)]
298298
@parameters k [tunable = true, bounds = (0, Inf)]
299299
eqs = [D(x) ~ (-x + k * u) / T # A first-order system with time constant T and gain k

docs/src/basics/Events.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ so far we aren't using anything that's not possible with the implicit interface.
497497
You can also write
498498

499499
```julia
500-
[temp ~ furnace_off_threshold] => ModelingToolkit.ImperativeAffect(modified = (;
500+
[temp ~
501+
furnace_off_threshold] => ModelingToolkit.ImperativeAffect(modified = (;
501502
furnace_on)) do x, o, i, c
502503
@set! x.furnace_on = false
503504
end

docs/src/basics/MTKLanguage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ Refer the following example for different ways to define symbolic arrays.
382382
p1[1:4]
383383
p2[1:N]
384384
p3[1:N,
385-
1:M] = 10,
385+
1:M] = 10,
386386
[description = "A multi-dimensional array of arbitrary length with description"]
387387
(p4[1:N, 1:M] = 10),
388388
[description = "An alternate syntax for p3 to match the syntax of vanilla parameters macro"]

docs/src/basics/Validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function ModelingToolkit.get_unit(op::typeof(dummycomplex), args)
108108
end
109109
110110
sts = @variables a(t)=0 [unit = u"cm"]
111-
ps = @parameters s=-1 [unit = u"cm"] c=c [unit = u"cm"]
111+
ps = @parameters s=-1 [unit=u"cm"] c=c [unit=u"cm"]
112112
eqs = [D(a) ~ dummycomplex(c, s);]
113113
sys = System(
114114
eqs, t, [sts...;], [ps...;], name = :sys, checks = ~ModelingToolkit.CheckUnits)

docs/src/examples/perturbation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ plot(sol, idxs = substitute(x_series, ϵ => 0.1); label = "Perturbative (ϵ=0.1)
100100
101101
x_exact(t, ϵ) = exp(-ϵ * t) * sin(√(1 - ϵ^2) * t) / √(1 - ϵ^2)
102102
@assert isapprox(
103-
sol(π / 2; idxs = substitute(x_series, ϵ => 0.1)), x_exact(π / 2, 0.1); atol = 1e-2) # compare around 1st peak # hide
103+
sol(π/2; idxs = substitute(x_series, ϵ => 0.1)), x_exact(π/2, 0.1); atol = 1e-2) # compare around 1st peak # hide
104104
plot!(sol.t, x_exact.(sol.t, 0.1); label = "Exact (ϵ=0.1)")
105105
```
106106

docs/src/examples/sparse_jacobians.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ function brusselator_2d_loop(du, u, p, t)
2727
jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N),
2828
limit(j - 1, N)
2929
du[i,
30-
j,
31-
1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
32-
4u[i, j, 1]) +
33-
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
34-
brusselator_f(x, y, t)
30+
j,
31+
1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
32+
4u[i, j, 1]) +
33+
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
34+
brusselator_f(x, y, t)
3535
du[i,
36-
j,
37-
2] = alpha * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
38-
4u[i, j, 2]) +
39-
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
36+
j,
37+
2] = alpha * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
38+
4u[i, j, 2]) +
39+
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
4040
end
4141
end
4242
p = (3.4, 1.0, 10.0, step(xyd_brusselator))

docs/src/examples/tearing_parallelism.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
1515
1616
# Basic electric components
1717
@connector function Pin(; name)
18-
@variables v(t)=1.0 i(t)=1.0 [connect = Flow]
18+
@variables v(t)=1.0 i(t)=1.0 [connect=Flow]
1919
System(Equation[], t, [v, i], [], name = name)
2020
end
2121
@@ -36,7 +36,7 @@ function ConstantVoltage(; name, V = 1.0)
3636
end
3737
3838
@connector function HeatPort(; name)
39-
@variables T(t)=293.15 Q_flow(t)=0.0 [connect = Flow]
39+
@variables T(t)=293.15 Q_flow(t)=0.0 [connect=Flow]
4040
System(Equation[], t, [T, Q_flow], [], name = name)
4141
end
4242

ext/MTKCasADiDynamicOptExt.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function (M::MXLinearInterpolation)(τ)
5757
(i > length(M.t) || i < 1) && error("Cannot extrapolate past the tspan.")
5858
colons = ntuple(_ -> (:), length(size(M.u)) - 1)
5959
if i < length(M.t)
60-
M.u[colons..., i] + Δ * (M.u[colons..., i + 1] - M.u[colons..., i])
60+
M.u[colons..., i] + Δ*(M.u[colons..., i + 1] - M.u[colons..., i])
6161
else
6262
M.u[colons..., i]
6363
end
@@ -131,10 +131,10 @@ function MTK.lowered_integral(model::CasADiModel, expr, lo, hi)
131131
for (i, t) in enumerate(model.U.t)
132132
if lo < t < hi
133133
Δt = min(dt, t - lo)
134-
total += (0.5 * Δt * (expr[i] + expr[i - 1]))
134+
total += (0.5*Δt*(expr[i] + expr[i - 1]))
135135
elseif t >= hi && (t - dt < hi)
136136
Δt = hi - t + dt
137-
total += (0.5 * Δt * (expr[i] + expr[i - 1]))
137+
total += (0.5*Δt*(expr[i] + expr[i - 1]))
138138
end
139139
end
140140
model.tₛ * total
@@ -219,7 +219,7 @@ end
219219
function MTK.get_V_values(model::CasADiModel)
220220
value_getter = MTK.successful_solve(model) ? CasADi.debug_value : CasADi.value
221221
(nu, nt) = size(model.V.u)
222-
if nu * nt != 0
222+
if nu*nt != 0
223223
V_vals = value_getter(model.solver_opti, model.V.u)
224224
size(V_vals, 2) == 1 && (V_vals = V_vals')
225225
V_vals = [[V_vals[i, j] for i in 1:nu] for j in 1:nt]

ext/MTKInfiniteOptExt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ end
4949

5050
MTK.generate_internal_model(m::Type{InfiniteOptModel}) = InfiniteModel()
5151
function MTK.generate_time_variable!(m::InfiniteModel, tspan, tsteps)
52-
@infinite_parameter(m, t in [tspan[1], tspan[2]], num_supports=length(tsteps))
52+
@infinite_parameter(m, t in [tspan[1], tspan[2]], num_supports = length(tsteps))
5353
end
5454
function MTK.generate_state_variable!(m::InfiniteModel, u0::Vector, ns, ts)
5555
@variable(m, U[i = 1:ns], Infinite(m[:t]), start=u0[i])
@@ -59,7 +59,7 @@ function MTK.generate_input_variable!(m::InfiniteModel, c0, nc, ts)
5959
end
6060

6161
function MTK.generate_timescale!(m::InfiniteModel, guess, is_free_t)
62-
@variable(m, tₛ0, start=guess)
62+
@variable(m, tₛ 0, start = guess)
6363
if !is_free_t
6464
fix(tₛ, 1, force = true)
6565
set_start_value(tₛ, 1)
@@ -69,11 +69,11 @@ end
6969

7070
function MTK.add_constraint!(m::InfiniteOptModel, expr::Union{Equation, Inequality})
7171
if expr isa Equation
72-
@constraint(m.model, expr.lhs - expr.rhs==0)
72+
@constraint(m.model, expr.lhs - expr.rhs == 0)
7373
elseif expr.relational_op === Symbolics.geq
74-
@constraint(m.model, expr.lhs - expr.rhs0)
74+
@constraint(m.model, expr.lhs - expr.rhs 0)
7575
else
76-
@constraint(m.model, expr.lhs - expr.rhs0)
76+
@constraint(m.model, expr.lhs - expr.rhs 0)
7777
end
7878
end
7979
MTK.set_objective!(m::InfiniteOptModel, expr) = @objective(m.model, Min, expr)

ext/MTKPyomoDynamicOptExt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ end
142142
function MTK.lowered_integral(m::PyomoDynamicOptModel, arg, lo, hi)
143143
@unpack model, model_sym, t_sym, dummy_sym = m
144144
total = 0
145-
dt = Pyomo.pyconvert(Float64, (model.t.at(-1) - model.t.at(1)) / (model.steps - 1))
145+
dt = Pyomo.pyconvert(Float64, (model.t.at(-1) - model.t.at(1))/(model.steps - 1))
146146
f = Symbolics.build_function(arg, model_sym, t_sym, expression = false)
147147
for (i, t) in enumerate(model.t)
148148
if Bool(lo < t) && Bool(t < hi)
149-
t_p = model.t.at(i - 1)
149+
t_p = model.t.at(i-1)
150150
Δt = min(t - lo, t - t_p)
151-
total += 0.5 * Δt * (f(model, t) + f(model, t_p))
151+
total += 0.5*Δt*(f(model, t) + f(model, t_p))
152152
elseif Bool(t >= hi) && Bool(t - dt < hi)
153-
t_p = model.t.at(i - 1)
153+
t_p = model.t.at(i-1)
154154
Δt = hi - t + dt
155-
total += 0.5 * Δt * (f(model, t) + f(model, t_p))
155+
total += 0.5*Δt*(f(model, t) + f(model, t_p))
156156
end
157157
end
158158
PyomoVar(model.tₛ * total)

0 commit comments

Comments
 (0)