Skip to content

Commit 02d4c4f

Browse files
authored
use set_parameter for setindex!
1 parent 0847933 commit 02d4c4f

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/systems/parameter_buffer.jl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -385,26 +385,7 @@ function Base.getindex(p::MTKParameters, pind::ParameterIndex)
385385
end
386386

387387
function Base.setindex!(p::MTKParameters, val, pind::ParameterIndex)
388-
(;portion, idx) = pind
389-
i, j, k... = idx
390-
if isempty(k)
391-
setindexer = (v) -> v[i][j] = val
392-
else
393-
setindexer = (v) -> v[i][j][k...] = val
394-
end
395-
if portion isa SciMLStructures.Tunable
396-
setindexer(p.tunable)
397-
elseif portion isa SciMLStructures.Discrete
398-
setindexer(p.discrete)
399-
elseif portion isa SciMLStructures.Constants
400-
setindexer(p.constant)
401-
elseif portion === DEPENDENT_PORTION
402-
setindexer(p.dependent)
403-
elseif portion === NONNUMERIC_PORTION
404-
setindexer(p.nonnumeric)
405-
else
406-
error("Unhandled portion", portion)
407-
end
388+
SymbolicIndexingInterface.set_parameter!(p, val, pind)
408389
end
409390

410391
function Base.iterate(buf::MTKParameters, state = 1)

0 commit comments

Comments
 (0)