Skip to content

Commit 458f944

Browse files
fix: error if container_type passed to MTKParameters is not an AbstractArray subtype
1 parent c5b853f commit 458f944

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/systems/parameter_buffer.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ function MTKParameters(
3131
t0 = nothing, substitution_limit = 1000, floatT = nothing,
3232
container_type = Vector)
3333
if !(container_type <: AbstractArray)
34-
container_type = Array
34+
throw(ArgumentError("""
35+
`container_type` for `MTKParameters` must be a subtype of `AbstractArray`. Found \
36+
$container_type.
37+
"""))
3538
end
3639
ic = if has_index_cache(sys) && get_index_cache(sys) !== nothing
3740
get_index_cache(sys)

src/systems/problem_utils.jl

+4
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,10 @@ function process_SciMLProblem(
11501150
end
11511151
evaluate_varmap!(op, ps; limit = substitution_limit)
11521152
if is_split(sys)
1153+
# `pType` is usually `Dict` when the user passes key-value pairs.
1154+
if !(pType <: AbstractArray)
1155+
pType = Array
1156+
end
11531157
p = MTKParameters(sys, op; floatT = floatT, container_type = pType)
11541158
else
11551159
p = better_varmap_to_vars(op, ps; tofloat, container_type = pType)

0 commit comments

Comments
 (0)