@@ -515,6 +515,32 @@ function Base.showerror(io::IO, e::LateBindingTstopsNotSupportedError)
515
515
println (io, TruncatedStacktraces. VERBOSE_MSG)
516
516
end
517
517
518
+ """
519
+ $(TYPEDSIGNATURES)
520
+
521
+ Given the index provider `indp` used to construct the problem `prob` being solved, return
522
+ an updated `prob` to be used for solving. All implementations should accept arbitrary
523
+ keyword arguments.
524
+
525
+ Should be called before the problem is solved, after performing type-promotion on the
526
+ problem.
527
+ """
528
+ function get_updated_symbolic_problem (indp, prob; kw... )
529
+ return prob
530
+ end
531
+
532
+ """
533
+ $(TYPEDSIGNATURES)
534
+
535
+ Get the innermost index provider using `SII.symbolic_container`.
536
+ """
537
+ function _get_root_indp (indp)
538
+ if hasmethod (SII. symbolic_container, Tuple{typeof (indp)}) && (sc = SII. symbolic_container (indp)) != = indp
539
+ return _get_root_indp (sc)
540
+ end
541
+ return indp
542
+ end
543
+
518
544
function init_call (_prob, args... ; merge_callbacks = true , kwargshandle = nothing ,
519
545
kwargs... )
520
546
kwargshandle = kwargshandle === nothing ? KeywordArgError : kwargshandle
@@ -1213,24 +1239,27 @@ function checkkwargs(kwargshandle; kwargs...)
1213
1239
end
1214
1240
1215
1241
function get_concrete_problem (prob:: AbstractJumpProblem , isadapt; kwargs... )
1216
- prob
1242
+ get_updated_symbolic_problem ( _get_root_indp ( prob), prob)
1217
1243
end
1218
1244
1219
1245
function get_concrete_problem (prob:: SteadyStateProblem , isadapt; kwargs... )
1246
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1220
1247
p = get_concrete_p (prob, kwargs)
1221
1248
u0 = get_concrete_u0 (prob, isadapt, Inf , kwargs)
1222
1249
u0 = promote_u0 (u0, p, nothing )
1223
1250
remake (prob; u0 = u0, p = p)
1224
1251
end
1225
1252
1226
1253
function get_concrete_problem (prob:: NonlinearProblem , isadapt; kwargs... )
1254
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1227
1255
p = get_concrete_p (prob, kwargs)
1228
1256
u0 = get_concrete_u0 (prob, isadapt, nothing , kwargs)
1229
1257
u0 = promote_u0 (u0, p, nothing )
1230
1258
remake (prob; u0 = u0, p = p)
1231
1259
end
1232
1260
1233
1261
function get_concrete_problem (prob:: NonlinearLeastSquaresProblem , isadapt; kwargs... )
1262
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1234
1263
p = get_concrete_p (prob, kwargs)
1235
1264
u0 = get_concrete_u0 (prob, isadapt, nothing , kwargs)
1236
1265
u0 = promote_u0 (u0, p, nothing )
@@ -1252,6 +1281,7 @@ function init(prob::PDEProblem, alg::AbstractDEAlgorithm, args...;
1252
1281
end
1253
1282
1254
1283
function get_concrete_problem (prob, isadapt; kwargs... )
1284
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1255
1285
p = get_concrete_p (prob, kwargs)
1256
1286
tspan = get_concrete_tspan (prob, isadapt, kwargs, p)
1257
1287
u0 = get_concrete_u0 (prob, isadapt, tspan[1 ], kwargs)
@@ -1270,6 +1300,7 @@ function get_concrete_problem(prob, isadapt; kwargs...)
1270
1300
end
1271
1301
1272
1302
function get_concrete_problem (prob:: DAEProblem , isadapt; kwargs... )
1303
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1273
1304
p = get_concrete_p (prob, kwargs)
1274
1305
tspan = get_concrete_tspan (prob, isadapt, kwargs, p)
1275
1306
u0 = get_concrete_u0 (prob, isadapt, tspan[1 ], kwargs)
@@ -1293,6 +1324,7 @@ function get_concrete_problem(prob::DAEProblem, isadapt; kwargs...)
1293
1324
end
1294
1325
1295
1326
function get_concrete_problem (prob:: DDEProblem , isadapt; kwargs... )
1327
+ prob = get_updated_symbolic_problem (_get_root_indp (prob), prob)
1296
1328
p = get_concrete_p (prob, kwargs)
1297
1329
tspan = get_concrete_tspan (prob, isadapt, kwargs, p)
1298
1330
u0 = get_concrete_u0 (prob, isadapt, tspan[1 ], kwargs)
0 commit comments