Skip to content

Commit e9e52d3

Browse files
fix: fix usage of SCCNonlinearProblem.parameters_alias as a boolean
1 parent 005a470 commit e9e52d3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/problems/nonlinear_problems.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ end
557557
function SymbolicIndexingInterface.set_parameter!(prob::SCCNonlinearProblem, val, idx)
558558
if prob.p !== nothing
559559
set_parameter!(prob.p, val, idx)
560-
prob.parameters_alias && return
560+
prob.parameters_alias === Val(true) && return
561561
end
562562
for scc in prob.probs
563563
is_parameter(scc, idx) || continue

src/remake.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,10 @@ override the values in `probs`. `sys` is the index provider for the full system.
861861
function remake(prob::SCCNonlinearProblem; u0 = missing, p = missing, probs = missing,
862862
parameters_alias = prob.parameters_alias, f = missing, sys = missing,
863863
interpret_symbolicmap = true, use_defaults = false, explicitfuns! = missing)
864-
if p !== missing && !parameters_alias && probs === missing
864+
if parameters_alias isa Bool
865+
parameters_alias = Val(parameters_alias)
866+
end
867+
if p !== missing && parameters_alias === Val(false) && probs === missing
865868
throw(ArgumentError("`parameters_alias` is `false` for the given `SCCNonlinearProblem`. Please provide the subproblems using the keyword `probs` with the parameters updated appropriately in each."))
866869
end
867870
newu0, newp = updated_u0_p(prob, u0, p; interpret_symbolicmap, use_defaults)
@@ -874,7 +877,7 @@ function remake(prob::SCCNonlinearProblem; u0 = missing, p = missing, probs = mi
874877
if sys === missing
875878
sys = prob.f.sys
876879
end
877-
if u0 !== missing || p !== missing && parameters_alias
880+
if u0 !== missing || p !== missing && parameters_alias === Val(true)
878881
probs = scc_update_subproblems(probs, newu0, newp, parameters_alias)
879882
end
880883
f = coalesce(f, prob.f)

test/downstream/modelingtoolkit_remake.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ end
330330
newp = remake_buffer(sccprob.f.sys, sccprob.p, [σ], [3.0])
331331
sccprob4 = remake(sccprob; parameters_alias = false, p = newp,
332332
probs = [remake(sccprob.probs[1]; p = deepcopy(newp)), sccprob.probs[2]])
333-
@test !sccprob4.parameters_alias
333+
@test sccprob4.parameters_alias === Val(false)
334334
@test sccprob4.p !== sccprob4.probs[1].p
335335
@test sccprob4.p !== sccprob4.probs[2].p
336336
end

0 commit comments

Comments
 (0)