Mercurial > repos > public > sbplib_julia
comparison src/RegionIndices/RegionIndices.jl @ 1814:9a92e1b354a1 feature/jet_aqua
Remove type piracy
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 10 Oct 2024 15:15:51 +0200 |
| parents | aba2ce166546 |
| children | 3ada7e9be4d6 |
comparison
equal
deleted
inserted
replaced
| 1813:3b523e5e03c5 | 1814:9a92e1b354a1 |
|---|---|
| 28 Base.convert(::Type{T}, i::Index{R,T} where R) where T = i.i | 28 Base.convert(::Type{T}, i::Index{R,T} where R) where T = i.i |
| 29 Base.convert(::Type{CartesianIndex}, I::NTuple{N,Index} where N) = CartesianIndex(convert.(Int, I)) | 29 Base.convert(::Type{CartesianIndex}, I::NTuple{N,Index} where N) = CartesianIndex(convert.(Int, I)) |
| 30 | 30 |
| 31 Base.Int(I::Index) = I.i | 31 Base.Int(I::Index) = I.i |
| 32 Base.to_index(I::Index) = Int(I) #How to get this to work for all cases?? | 32 Base.to_index(I::Index) = Int(I) #How to get this to work for all cases?? |
| 33 Base.getindex(A::AbstractArray{T,N}, I::NTuple{N,Index}) where {T,N} = A[I...] #Is this ok?? | |
| 34 | 33 |
| 35 function Index(i::Integer, boundary_width::Integer, dim_size::Integer) | 34 function Index(i::Integer, boundary_width::Integer, dim_size::Integer) |
| 36 return Index{getregion(i,boundary_width,dim_size)}(i) | 35 return Index{getregion(i,boundary_width,dim_size)}(i) |
| 37 end | 36 end |
| 38 | 37 |
