@@ -141,7 +141,9 @@ function buffer_to_arraypartition(buf)
141141 v for v in buf))
142142end
143143
144- _split_helper (buf_v:: T , recurse, raw, idx) where {T} = _split_helper (eltype (T), buf_v, recurse, raw, idx)
144+ function _split_helper (buf_v:: T , recurse, raw, idx) where {T}
145+ _split_helper (eltype (T), buf_v, recurse, raw, idx)
146+ end
145147
146148function _split_helper (:: Type{<:AbstractArray} , buf_v, :: Val{true} , raw, idx)
147149 map (b -> _split_helper (eltype (b), b, Val (false ), raw, idx), buf_v)
@@ -159,21 +161,25 @@ end
159161
160162function split_into_buffers (raw:: AbstractArray , buf, recurse = Val (true ))
161163 idx = Ref (1 )
162- ntuple (i-> _split_helper (buf[i], recurse, raw, idx), Val (length (buf)))
164+ ntuple (i -> _split_helper (buf[i], recurse, raw, idx), Val (length (buf)))
165+ end
166+
167+ function _update_tuple_helper (buf_v:: T , raw, idx) where {T}
168+ _update_tuple_helper (eltype (T), buf_v, raw, idx)
163169end
170+
171+ function _update_tuple_helper (:: Type{<:AbstractArray} , buf_v, raw, idx)
172+ map (b -> _update_tuple_helper (b, raw, idx), buf_v)
173+ end
174+
175+ function _update_tuple_helper (:: Any , buf_v, raw, idx)
176+ copyto! (buf_v, view (raw, idx[]: (idx[] + length (buf_v) - 1 )))
177+ idx[] += length (buf_v)
164178end
165179
166180function update_tuple_of_buffers (raw:: AbstractArray , buf)
167- idx = 1
168- function _helper (buf_v)
169- if eltype (buf_v) <: AbstractArray
170- _helper .(buf_v)
171- else
172- copyto! (buf_v, view (raw, idx: (idx + length (buf_v) - 1 )))
173- idx += length (buf_v)
174- end
175- end
176- _helper .(buf)
181+ idx = Ref (1 )
182+ map (b -> _update_tuple_helper (b, raw, idx), buf)
177183end
178184
179185SciMLStructures. isscimlstructure (:: MTKParameters ) = true
0 commit comments