@@ -196,19 +196,23 @@ end
196
196
function process_index (i:: AbstractArray{Bool,N} , cs, cr:: ChunkRead ) where N
197
197
process_index (findall (i),cs,cr)
198
198
end
199
+ function process_index (i:: AbstractArray{Bool,N} , cs, cr:: SubRanges ) where N
200
+ process_index (findall (i),cs,cr)
201
+ end
199
202
function process_index (i:: StepRange{<:Integer} , cs, :: ChunkStrategy{CanStepRange} )
200
203
(length (i),), (length (i),), (Colon (),), (Colon (),), (i,), Base. tail (cs)
201
204
end
202
- function process_index (i:: AbstractVector {<:CartesianIndex{N}} , cs, :: ChunkRead ) where N
205
+ function process_index (i:: AbstractArray {<:CartesianIndex{N},M } , cs, :: Union{ ChunkRead,SubRanges} ) where {N,M}
203
206
csnow, csrem = splitcs (i,cs)
204
- chunksdict = Dict{CartesianIndex{N},Vector{Pair{CartesianIndex{N},Int }}}()
207
+ chunksdict = Dict{CartesianIndex{N},Vector{Pair{CartesianIndex{N},CartesianIndex{M} }}}()
205
208
# Look for affected chunks
206
- for (outindex,dataindex) in enumerate (i)
209
+ for outindex in CartesianIndices (i)
210
+ dataindex = i[outindex]
207
211
cI = CartesianIndex (findchunk .(csnow,dataindex. I))
208
- a = get! (()-> Pair{CartesianIndex{N},Int }[],chunksdict,cI)
212
+ a = get! (()-> Pair{CartesianIndex{N},CartesianIndex{M} }[],chunksdict,cI)
209
213
push! (a,(dataindex=> outindex))
210
214
end
211
- tempinds,datainds,outinds = Tuple{Vector{CartesianIndex{N}}}[], NTuple{N,UnitRange{Int}}[], Tuple{Vector{Int }}[]
215
+ tempinds,datainds,outinds = Tuple{Vector{CartesianIndex{N}}}[], NTuple{N,UnitRange{Int}}[], Tuple{Vector{CartesianIndex{M} }}[]
212
216
tempsize = map (_-> 0 ,csnow)
213
217
for (cI,a) in chunksdict
214
218
datamin,datamax = extrema (first,a)
@@ -220,7 +224,7 @@ function process_index(i::AbstractVector{<:CartesianIndex{N}}, cs, ::ChunkRead)
220
224
s = datamax. I .- datamin. I .+ 1
221
225
tempsize = max .(s,tempsize)
222
226
end
223
- ( length (i), ), tempsize, (outinds,), (tempinds,), (datainds,), csrem
227
+ size (i ), tempsize, (outinds,), (tempinds,), (datainds,), csrem
224
228
end
225
229
226
230
0 commit comments