Skip to content

Commit 8805bb3

Browse files
committed
format
1 parent eadea40 commit 8805bb3

File tree

3 files changed

+19
-37
lines changed

3 files changed

+19
-37
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

+13-34
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
"""
@@ -363,11 +363,8 @@ Keyword arguments:
363363
"""
364364
function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
365365
tofloat = true, container_type = Array,
366-
<<<<<<< HEAD
367-
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false, is_initializeprob = false)
368-
=======
369-
toterm = default_toterm, promotetoconcrete = nothing, check = true, allow_symbolic = false)
370-
>>>>>>> a5e1e0239a (remove instances of)
366+
toterm = default_toterm, promotetoconcrete = nothing, check = true,
367+
allow_symbolic = false, is_initializeprob = false)
371368
isempty(vars) && return nothing
372369

373370
if check
@@ -385,8 +382,8 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
385382
end
386383

387384
if !isempty(missingsyms)
388-
is_initializeprob ? throw(MissingGuessError(missingsyms, missingvals)) :
389-
throw(UnexpectedSymbolicValueInVarmap(missingsyms[1], missingvals[1]))
385+
is_initializeprob ? throw(MissingGuessError(missingsyms, missingvals)) :
386+
throw(UnexpectedSymbolicValueInVarmap(missingsyms[1], missingvals[1]))
390387
end
391388
end
392389

@@ -734,12 +731,7 @@ Keyword arguments:
734731
- `fully_determined`: Override whether the initialization system is fully determined.
735732
- `check_initialization_units`: Enable or disable unit checks when constructing the
736733
initialization problem.
737-
<<<<<<< HEAD
738-
- `tofloat`, `use_union`, `is_initializeprob`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and
739-
possibly `p`).
740-
=======
741-
- `tofloat`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and possibly `p`).
742-
>>>>>>> a5e1e0239a (remove instances of)
734+
- `tofloat`, `is_initializeprob`: Passed to [`better_varmap_to_vars`](@ref) for building `u0` (and possibly `p`).
743735
- `u0_constructor`: A function to apply to the `u0` value returned from `better_varmap_to_vars`
744736
to construct the final `u0` value.
745737
- `du0map`: A map of derivatives to values. See `implicit_dae`.
@@ -848,21 +840,8 @@ function process_SciMLProblem(
848840
evaluate_varmap!(op, dvs; limit = substitution_limit)
849841

850842
u0 = better_varmap_to_vars(
851-
<<<<<<< HEAD
852-
<<<<<<< HEAD
853-
<<<<<<< HEAD
854-
op, dvs; tofloat = true, use_union = false,
843+
op, dvs; tofloat = true,
855844
container_type = u0Type, allow_symbolic = symbolic_u0, is_initializeprob)
856-
=======
857-
op, dvs; tofloat, use_union,
858-
=======
859-
op, dvs; tofloat, use_union = false,
860-
>>>>>>> 6951e652f2 (fix: don't propagate for u0)
861-
container_type = u0Type, allow_symbolic = symbolic_u0)
862-
>>>>>>> e31ae1bcc9 (fix: propagate `tofloat`, `use_union` to `better_varmap_to_vars`)
863-
=======
864-
op, dvs; tofloat, container_type = u0Type, allow_symbolic = symbolic_u0)
865-
>>>>>>> a5e1e0239a (remove instances of)
866845

867846
if u0 !== nothing
868847
u0 = u0_constructor(u0)

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)