@@ -141,7 +141,9 @@ function buffer_to_arraypartition(buf)
141
141
v for v in buf))
142
142
end
143
143
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
145
147
146
148
function _split_helper (:: Type{<:AbstractArray} , buf_v, :: Val{true} , raw, idx)
147
149
map (b -> _split_helper (eltype (b), b, Val (false ), raw, idx), buf_v)
@@ -159,21 +161,25 @@ end
159
161
160
162
function split_into_buffers (raw:: AbstractArray , buf, recurse = Val (true ))
161
163
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)
163
169
end
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)
164
178
end
165
179
166
180
function 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)
177
183
end
178
184
179
185
SciMLStructures. isscimlstructure (:: MTKParameters ) = true
0 commit comments