Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 279ca19

Browse files
committedMar 19, 2025·
refactor: format
1 parent 4682726 commit 279ca19

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed
 

‎src/systems/diffeqs/abstractodesystem.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1504,5 +1504,6 @@ function InitializationProblem{iip, specialize}(sys::AbstractSystem,
15041504
else
15051505
NonlinearLeastSquaresProblem
15061506
end
1507-
TProb(isys, u0map, parammap; kwargs..., build_initializeprob = false, is_initializeprob = true)
1507+
TProb(isys, u0map, parammap; kwargs...,
1508+
build_initializeprob = false, is_initializeprob = true)
15081509
end

‎src/systems/problem_utils.jl

+11-10
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,17 @@ struct MissingGuessError <: Exception
330330
vals::Vector{Any}
331331
end
332332

333-
function Base.showerror(io::IO, err::MissingGuessError)
334-
println(io,
335-
"""
336-
Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map: \
337-
""")
333+
function Base.showerror(io::IO, err::MissingGuessError)
334+
println(io,
335+
"""
336+
Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map: \
337+
""")
338338
for (sym, val) in zip(err.syms, err.vals)
339339
println(io, "$sym => $val")
340340
end
341341
println(io,
342-
"""
343-
In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable. """)
342+
"""
343+
In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable. """)
344344
end
345345

346346
"""
@@ -364,7 +364,8 @@ Keyword arguments:
364364
"""
365365
function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
366366
tofloat = true, use_union = true, container_type = Array,
367-
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false, is_initializeprob = false)
367+
toterm = default_toterm, promotetoconcrete = nothing, check = true,
368+
allow_symbolic = false, is_initializeprob = false)
368369
isempty(vars) && return nothing
369370

370371
if check
@@ -382,8 +383,8 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
382383
end
383384

384385
if !isempty(missingsyms)
385-
is_initializeprob ? throw(MissingGuessError(missingsyms, missingvals)) :
386-
throw(UnexpectedSymbolicValueInVarmap(missingsyms[1], missingvals[1]))
386+
is_initializeprob ? throw(MissingGuessError(missingsyms, missingvals)) :
387+
throw(UnexpectedSymbolicValueInVarmap(missingsyms[1], missingvals[1]))
387388
end
388389
end
389390

‎test/initial_values.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ end
208208
x^2 + y^2 ~ 1]
209209
@mtkbuild pend = ODESystem(eqs, t)
210210

211-
@test_throws ModelingToolkit.MissingGuessError ODEProblem(pend, [x => 1], (0, 1), [g => 1], guesses = [y => λ, λ => y + 1])
211+
@test_throws ModelingToolkit.MissingGuessError ODEProblem(
212+
pend, [x => 1], (0, 1), [g => 1], guesses = [y => λ, λ => y + 1])
212213
ODEProblem(pend, [x => 1], (0, 1), [g => 1], guesses = [y => λ, λ => 0.5])
213214

214215
# Throw multiple if multiple are missing
215216
@variables a(t) b(t) c(t) d(t) e(t)
216217
eqs = [D(a) ~ b, D(b) ~ c, D(c) ~ d, D(d) ~ e, D(e) ~ 1]
217218
@mtkbuild sys = ODESystem(eqs, t)
218-
@test_throws ["a(t)", "c(t)"] ODEProblem(sys, [e => 2, a => b, b => a + 1, c => d, d => c + 1], (0, 1))
219+
@test_throws ["a(t)", "c(t)"] ODEProblem(
220+
sys, [e => 2, a => b, b => a + 1, c => d, d => c + 1], (0, 1))
219221
end

0 commit comments

Comments
 (0)
Please sign in to comment.