Skip to content

Commit a682efa

Browse files
committed
Use JuliaFormatter v2
1 parent a7c3268 commit a682efa

30 files changed

+301
-177
lines changed

docs/pages.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
pages = ["index.md",
44
"Getting Started with BVP solving in Julia" => "tutorials/getting_started.md",
5-
"Tutorials" => Any[
6-
"tutorials/continuation.md", "tutorials/solve_nlls_bvp.md", "tutorials/extremum.md"],
5+
"Tutorials" => Any["tutorials/continuation.md",
6+
"tutorials/solve_nlls_bvp.md", "tutorials/extremum.md"],
77
"Basics" => Any["basics/bvp_problem.md", "basics/bvp_functions.md",
88
"basics/solve.md", "basics/autodiff.md", "basics/error_control.md"],
99
"Solver Summaries and Recommendations" => Any[

ext/BoundaryValueDiffEqODEInterfaceExt.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ function SciMLBase.__solve(prob::BVProblem, alg::BVPM2; dt = 0.0, reltol = 1e-3,
6161
@closure (t, u, du) -> du .= vec(prob.f(reshape(u, u0_size), prob.p, t))
6262
end
6363
bvp2m_bc = if SciMLBase.isinplace(prob)
64-
@closure (ya, yb, bca, bcb) -> begin
64+
@closure (ya,
65+
yb,
66+
bca,
67+
bcb) -> begin
6568
prob.f.bc[1](reshape(bca, left_bc_size), reshape(ya, u0_size), prob.p)
6669
prob.f.bc[2](reshape(bcb, right_bc_size), reshape(yb, u0_size), prob.p)
6770
return nothing
6871
end
6972
else
70-
@closure (ya, yb, bca, bcb) -> begin
73+
@closure (
74+
ya, yb, bca, bcb) -> begin
7175
bca .= vec(prob.f.bc[1](reshape(ya, u0_size), prob.p))
7276
bcb .= vec(prob.f.bc[2](reshape(yb, u0_size), prob.p))
7377
return nothing
@@ -140,15 +144,18 @@ function SciMLBase.__solve(prob::BVProblem, alg::BVPSOL; maxiters = 1000,
140144
end
141145

142146
bvpsol_bc = if SciMLBase.isinplace(prob)
143-
@closure (ya, yb, r) -> begin
147+
@closure (ya, yb,
148+
r) -> begin
144149
left_bc = reshape(@view(r[1:no_left_bc]), left_bc_size)
145150
right_bc = reshape(@view(r[(no_left_bc + 1):end]), right_bc_size)
146151
prob.f.bc[1](left_bc, reshape(ya, u0_size), prob.p)
147152
prob.f.bc[2](right_bc, reshape(yb, u0_size), prob.p)
148153
return nothing
149154
end
150155
else
151-
@closure (ya, yb, r) -> begin
156+
@closure (ya,
157+
yb,
158+
r) -> begin
152159
r[1:no_left_bc] .= vec(prob.f.bc[1](reshape(ya, u0_size), prob.p))
153160
r[(no_left_bc + 1):end] .= vec(prob.f.bc[2](reshape(yb, u0_size), prob.p))
154161
return nothing

lib/BoundaryValueDiffEqAscher/src/adaptivity.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,13 @@ function error_estimate!(cache::AscherCache)
188188
# in valstr in case they prove to be needed later for an error estimate.
189189
x = mesh[i] + (mesh_dt[i]) * 2.0 / 3.0
190190
@views approx(cache, x, valstr[i][3])
191-
error[i] .= wgterr .*
192-
abs.(valstr[i][3] .-
191+
error[i] .= wgterr .* abs.(valstr[i][3] .-
193192
(isodd(i) ? valstr[Int((i + 1) / 2)][2] : valstr[Int(i / 2)][4]))
194193

195194
x = mesh[i] + (mesh_dt[i]) / 3.0
196195
@views approx(cache, x, valstr[i][2])
197196
error[i] .= error[i] .+
198-
wgterr .*
199-
abs.(valstr[i][2] .-
197+
wgterr .* abs.(valstr[i][2] .-
200198
(isodd(i) ? valstr[Int((i + 1) / 2)][1] : valstr[Int(i / 2)][3]))
201199
end
202200
return maximum(reduce(hcat, error), dims = 2)

lib/BoundaryValueDiffEqAscher/src/ascher.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ function SciMLBase.__init(
102102

103103
iip = isinplace(prob)
104104

105-
f, bc = if prob.u0 isa AbstractVector
105+
f,
106+
bc = if prob.u0 isa AbstractVector
106107
prob.f, prob.f.bc
107108
elseif iip
108109
vecf! = @closure (du, u, p, t) -> __vec_f!(du, u, p, t, prob.f, size(u0))
@@ -337,10 +338,11 @@ function __construct_nlproblem(cache::AscherCache{iip, T}) where {iip, T}
337338
end
338339

339340
jac = if iip
340-
@closure (J, u, p) -> __ascher_mpoint_jacobian!(
341-
J, u, diffmode, jac_cache, loss, lz, cache.p)
341+
@closure (J, u,
342+
p) -> __ascher_mpoint_jacobian!(J, u, diffmode, jac_cache, loss, lz, cache.p)
342343
else
343-
@closure (u, p) -> __ascher_mpoint_jacobian(
344+
@closure (u,
345+
p) -> __ascher_mpoint_jacobian(
344346
jac_prototype, u, diffmode, jac_cache, loss, cache.p)
345347
end
346348

lib/BoundaryValueDiffEqAscher/src/collocation.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function Φ!(cache::AscherCache{iip, T}, z, res, pt::StandardBVProblem) where {iip, T}
2-
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval, yval, gval, delz, dmz, deldmz, g, w, v, ipvtg, ipvtw, TU) = cache
2+
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval,
3+
yval, gval, delz, dmz, deldmz, g, w, v, ipvtg, ipvtw, TU) = cache
34
(; acol, rho) = TU
45
ncy = ncomp + ny
56
n = length(mesh) - 1
@@ -156,7 +157,8 @@ function Φ!(cache::AscherCache{iip, T}, z, res, pt::StandardBVProblem) where {i
156157
end
157158

158159
function Φ!(cache::AscherCache{iip, T}, z, res, pt::TwoPointBVProblem) where {iip, T}
159-
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, bcresid_prototype, residual, zval, yval, gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
160+
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, bcresid_prototype, residual,
161+
zval, yval, gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
160162
(; acol, rho) = TU
161163
ncy = ncomp + ny
162164
n = length(mesh) - 1
@@ -319,7 +321,8 @@ end
319321
@inline __get_value(z) = isa(z, ForwardDiff.Dual) ? z.value : z
320322

321323
function Φ(cache::AscherCache{iip, T}, z, pt::StandardBVProblem) where {iip, T}
322-
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval, yval, gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
324+
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval, yval,
325+
gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
323326
(; acol, rho) = TU
324327
ncy = ncomp + ny
325328
n = length(mesh) - 1
@@ -476,7 +479,8 @@ function Φ(cache::AscherCache{iip, T}, z, pt::StandardBVProblem) where {iip, T}
476479
end
477480

478481
function Φ(cache::AscherCache{iip, T}, z, pt::TwoPointBVProblem) where {iip, T}
479-
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval, yval, gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
482+
(; f, mesh, mesh_dt, ncomp, ny, bc, k, p, zeta, residual, zval, yval,
483+
gval, delz, dmz, deldmz, g, w, v, dmzo, ipvtg, ipvtw, TU) = cache
480484
(; acol, rho) = TU
481485
ncy = ncomp + ny
482486
n = length(mesh) - 1

lib/BoundaryValueDiffEqCore/src/types.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
end
77

88
@inline __materialize_jacobian_algorithm(_, alg::BVPJacobianAlgorithm) = alg
9-
@inline __materialize_jacobian_algorithm(_, alg::ADTypes.AbstractADType) = BVPJacobianAlgorithm(alg)
9+
@inline __materialize_jacobian_algorithm(
10+
_, alg::ADTypes.AbstractADType) = BVPJacobianAlgorithm(alg)
1011
@inline __materialize_jacobian_algorithm(::Nothing, ::Nothing) = BVPJacobianAlgorithm()
1112
@inline function __materialize_jacobian_algorithm(nlsolve::N, ::Nothing) where {N}
1213
ad = hasfield(N, :jacobian_ad) ? nlsolve.jacobian_ad : missing

lib/BoundaryValueDiffEqFIRK/src/BoundaryValueDiffEqFIRK.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ include("sparse_jacobians.jl")
100100

101101
@compile_workload begin
102102
@sync for prob in probs, alg in algs
103+
103104
Threads.@spawn solve(prob, alg; dt = 0.2)
104105
end
105106
end
@@ -112,6 +113,7 @@ include("sparse_jacobians.jl")
112113

113114
@compile_workload begin
114115
@sync for prob in probs, alg in algs
116+
115117
Threads.@spawn solve(prob, alg; dt = 0.2)
116118
end
117119
end
@@ -124,6 +126,7 @@ include("sparse_jacobians.jl")
124126

125127
@compile_workload begin
126128
@sync for prob in probs, alg in algs
129+
127130
Threads.@spawn solve(prob, alg; dt = 0.2)
128131
end
129132
end
@@ -136,6 +139,7 @@ include("sparse_jacobians.jl")
136139

137140
@compile_workload begin
138141
@sync for prob in probs, alg in algs
142+
139143
Threads.@spawn solve(prob, alg; dt = 0.2)
140144
end
141145
end
@@ -194,6 +198,7 @@ include("sparse_jacobians.jl")
194198

195199
@compile_workload begin
196200
@sync for prob in probs, alg in algs
201+
197202
Threads.@spawn solve(prob, alg; dt = 0.2, abstol = 1e-2)
198203
end
199204
end
@@ -210,6 +215,7 @@ include("sparse_jacobians.jl")
210215

211216
@compile_workload begin
212217
@sync for prob in probs, alg in algs
218+
213219
Threads.@spawn solve(prob, alg; dt = 0.2, abstol = 1e-2)
214220
end
215221
end
@@ -226,6 +232,7 @@ include("sparse_jacobians.jl")
226232

227233
@compile_workload begin
228234
@sync for prob in probs, alg in algs
235+
229236
Threads.@spawn solve(prob, alg; dt = 0.2, abstol = 1e-2)
230237
end
231238
end
@@ -242,6 +249,7 @@ include("sparse_jacobians.jl")
242249

243250
@compile_workload begin
244251
@sync for prob in probs, alg in algs
252+
245253
Threads.@spawn solve(prob, alg; dt = 0.2, abstol = 1e-2)
246254
end
247255
end
@@ -258,6 +266,7 @@ include("sparse_jacobians.jl")
258266

259267
@compile_workload begin
260268
@sync for prob in probs, alg in algs
269+
261270
Threads.@spawn solve(prob, alg; dt = 0.2, abstol = 1e-2)
262271
end
263272
end

lib/BoundaryValueDiffEqFIRK/src/adaptivity.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ function s_constraints(M, h)
226226
row_start = (i - 1) * M + 1
227227
for k in 0:(M - 1)
228228
for j in 1:6
229-
A[row_start + k, j + k * 6] = j == 1.0 ? 0.0 :
230-
(j - 1) * t[i + k * 6]^(j - 2)
229+
A[row_start + k,
230+
j + k * 6] = j == 1.0 ? 0.0 : (j - 1) * t[i + k * 6]^(j - 2)
231231
end
232232
end
233233
end

lib/BoundaryValueDiffEqFIRK/src/algorithms.jl

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ for stage in (1, 2, 3, 5, 7)
9595
defect_threshold::T = 0.1
9696
max_num_subintervals::Int = 3000
9797
end
98-
$(alg)(nlsolve::N, jac_alg::J; nested = false, nested_nlsolve_kwargs::NamedTuple = (;), defect_threshold::T = 0.1, max_num_subintervals::Int = 3000) where {N, J, T} = $(alg){
99-
N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
98+
$(alg)(nlsolve::N,
99+
jac_alg::J;
100+
nested = false,
101+
nested_nlsolve_kwargs::NamedTuple = (;),
102+
defect_threshold::T = 0.1,
103+
max_num_subintervals::Int = 3000) where {N,
104+
J,
105+
T} = $(alg){N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
100106
defect_threshold, max_num_subintervals)
101107
end
102108
end
@@ -194,8 +200,14 @@ for stage in (2, 3, 4, 5)
194200
defect_threshold::T = 0.1
195201
max_num_subintervals::Int = 3000
196202
end
197-
$(alg)(nlsolve::N, jac_alg::J; nested = false, nested_nlsolve_kwargs::NamedTuple = (;), defect_threshold::T = 0.1, max_num_subintervals::Int = 3000) where {N, J, T} = $(alg){
198-
N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
203+
$(alg)(nlsolve::N,
204+
jac_alg::J;
205+
nested = false,
206+
nested_nlsolve_kwargs::NamedTuple = (;),
207+
defect_threshold::T = 0.1,
208+
max_num_subintervals::Int = 3000) where {N,
209+
J,
210+
T} = $(alg){N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
199211
defect_threshold, max_num_subintervals)
200212
end
201213
end
@@ -295,8 +307,14 @@ for stage in (2, 3, 4, 5)
295307
defect_threshold::T = 0.1
296308
max_num_subintervals::Int = 3000
297309
end
298-
$(alg)(nlsolve::N, jac_alg::J; nested = false, nested_nlsolve_kwargs::NamedTuple = (;), defect_threshold::T = 0.1, max_num_subintervals::Int = 3000) where {N, J, T} = $(alg){
299-
N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
310+
$(alg)(nlsolve::N,
311+
jac_alg::J;
312+
nested = false,
313+
nested_nlsolve_kwargs::NamedTuple = (;),
314+
defect_threshold::T = 0.1,
315+
max_num_subintervals::Int = 3000) where {N,
316+
J,
317+
T} = $(alg){N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
300318
defect_threshold, max_num_subintervals)
301319
end
302320
end
@@ -396,8 +414,14 @@ for stage in (2, 3, 4, 5)
396414
defect_threshold::T = 0.1
397415
max_num_subintervals::Int = 3000
398416
end
399-
$(alg)(nlsolve::N, jac_alg::J; nested = false, nested_nlsolve_kwargs::NamedTuple = (;), defect_threshold::T = 0.1, max_num_subintervals::Int = 3000) where {N, J, T} = $(alg){
400-
N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
417+
$(alg)(nlsolve::N,
418+
jac_alg::J;
419+
nested = false,
420+
nested_nlsolve_kwargs::NamedTuple = (;),
421+
defect_threshold::T = 0.1,
422+
max_num_subintervals::Int = 3000) where {N,
423+
J,
424+
T} = $(alg){N, J, T}(nlsolve, jac_alg, nested, nested_nlsolve_kwargs,
401425
defect_threshold, max_num_subintervals)
402426
end
403427
end

0 commit comments

Comments
 (0)