@@ -119,15 +119,42 @@ end
119
119
throw (ArgumentError (" $vars are missing from the variable map." ))
120
120
end
121
121
122
+ # FIXME : remove after: https://github.com/SciML/SciMLBase.jl/pull/311
123
+ function SciMLBase. handle_varmap (varmap, sys:: AbstractSystem ; field = :states , kwargs... )
124
+ out = varmap_to_vars (varmap, getfield (sys, field); kwargs... )
125
+ return out
126
+ end
127
+
122
128
"""
123
129
$(SIGNATURES)
124
130
125
- Intercept the call to `handle_varmap ` and convert it to an ordered list if the user has
126
- ModelingToolkit loaded, and the problem has a symbolic origin .
131
+ Intercept the call to `process_p_u0_symbolic ` and process symbolic maps of `p` and/or `u0` if the
132
+ user has ` ModelingToolkit` loaded.
127
133
"""
128
- function SciMLBase. handle_varmap (varmap, sys:: AbstractSystem ; field = :states , kwargs... )
129
- out = varmap_to_vars (varmap, getfield (sys, field); kwargs... )
130
- return out
134
+ function SciMLBase. process_p_u0_symbolic (prob:: ODEProblem , p, u0)
135
+ # check if a symbolic remake is possible
136
+ if eltype (p) <: Pair
137
+ hasproperty (prob. f, :sys ) && hasfield (typeof (prob. f. sys), :ps ) ||
138
+ throw (ArgumentError (" This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
139
+ " Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order." ))
140
+ end
141
+ if eltype (u0) <: Pair
142
+ hasproperty (prob. f, :sys ) && hasfield (typeof (prob. f. sys), :states ) ||
143
+ throw (ArgumentError (" This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
144
+ " Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order." ))
145
+ end
146
+
147
+ # assemble defaults
148
+ defs = defaults (prob. f. sys)
149
+ defs = mergedefaults (defs, prob. p, parameters (prob. f. sys))
150
+ defs = mergedefaults (defs, p, parameters (prob. f. sys))
151
+ defs = mergedefaults (defs, prob. u0, states (prob. f. sys))
152
+ defs = mergedefaults (defs, u0, states (prob. f. sys))
153
+
154
+ u0 = varmap_to_vars (u0, states (prob. f. sys); defaults = defs, tofloat = true )
155
+ p = varmap_to_vars (p, parameters (prob. f. sys); defaults = defs)
156
+
157
+ return p, u0
131
158
end
132
159
133
160
struct IsHistory end
0 commit comments