Skip to content

Commit 016837b

Browse files
refactor: add support for new *_symbols methods from SII, error on parameter getindex
1 parent c5f4cc6 commit 016837b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ StaticArrays = "1.6"
5757
StaticArraysCore = "1.1"
5858
Statistics = "1"
5959
StructArrays = "0.6"
60-
SymbolicIndexingInterface = "0.3"
60+
SymbolicIndexingInterface = "0.3.1"
6161
Tables = "1"
6262
Test = "1"
6363
Tracker = "0.2"

src/vector_of_array.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::ScalarSymb
284284
return getindex.(A.u, variable_index.((A,), (sym,), eachindex(A.t)))
285285
end
286286
elseif is_parameter(A, sym)
287-
Base.depwarn("Indexing with parameters is deprecated. Use `getp(A, $sym)` for parameter indexing.", :parameter_getindex)
288-
return getp(A, sym)(A)
287+
error("Indexing with parameters is deprecated. Use `getp(A, $sym)` for parameter indexing.")
289288
elseif is_observed(A, sym)
290289
return observed(A, sym).(A.u, (parameter_values(A),), A.t)
291290
else
@@ -325,8 +324,7 @@ end
325324

326325
Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::ScalarSymbolic, sym::Union{Tuple,AbstractArray})
327326
if all(x -> is_parameter(A, x), sym)
328-
Base.depwarn("Indexing with parameters is deprecated. Use `getp(A, $sym)` for parameter indexing.", :parameter_getindex)
329-
return getp(A, sym)(A)
327+
error("Indexing with parameters is deprecated. Use `getp(A, $sym)` for parameter indexing.")
330328
else
331329
return [getindex.((A,), sym, i) for i in eachindex(A.t)]
332330
end
@@ -336,6 +334,14 @@ Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::ScalarSymb
336334
return reduce(vcat, map(s -> A[s, args...]', sym))
337335
end
338336

337+
Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::ScalarSymbolic, ::SymbolicIndexingInterface.SolvedVariables, args...)
338+
return getindex(A, variable_symbols(A), args...)
339+
end
340+
341+
Base.@propagate_inbounds function _getindex(A::AbstractDiffEqArray, ::ScalarSymbolic, ::SymbolicIndexingInterface.AllVariables, args...)
342+
return getindex(A, all_variable_symbols(A), args...)
343+
end
344+
339345
Base.@propagate_inbounds function Base.getindex(A::AbstractVectorOfArray, _arg, args...)
340346
symtype = symbolic_type(_arg)
341347
elsymtype = symbolic_type(eltype(_arg))

0 commit comments

Comments
 (0)