Sorry for the delay in the answer, I’ve been busy.
I can’t find out how to rewrite getindex (first one I’ve tried for now)
I’ve created my own struct :
struct LoopArray <: AbstractArray
#what do I do here ?
end
And then I’ve looked at the code for get index in essentials.jl and in abstractarray.jl but they’re far too complicated to recode because they’re built first with an int index first and then generalized to vector indices.
So I’ve thought about saying something like
Function getindex(LoopArray, index:: AbstractArray)
index = index modulo array size
getindex(LoopArray, index) # calling base function now that it's corrected
But won’t my second call just call the first one and loop ?
I’ve searched similar implémentations but couldn’t find one with my needs
Edit : just found this : Arrays with periodic boundaries - #3 by jonathanBieler , I’ll try based on this for now, haven’t finished yet