Mercurial > repos > public > sbplib_julia
changeset 1093:703eaa3e50c4 feature/variable_derivatives
Merge refactor/grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 27 Apr 2022 10:26:11 +0200 |
parents | e3b41d48b5aa (current diff) c4ea28d904f5 (diff) |
children | fa0800591306 |
files | |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/EquidistantGrid.jl Tue Apr 26 14:29:08 2022 +0200 +++ b/src/Grids/EquidistantGrid.jl Wed Apr 27 10:26:11 2022 +0200 @@ -44,6 +44,7 @@ function EquidistantGrid(size, limit_lower, limit_upper) return EquidistantGrid{length(size), eltype(limit_lower)}(size, limit_lower, limit_upper) end +# TBD: Should it be an AbstractArray? """ EquidistantGrid{T}() @@ -67,11 +68,14 @@ Base.size(g::EquidistantGrid) = g.size -function Base.getindex(g::EquidistantGrid, I...) +function Base.getindex(g::EquidistantGrid, I::Vararg{Int}) h = spacing(g) return g.limit_lower .+ (I.-1).*h end +Base.getindex(g::EquidistantGrid, I::CartesianIndex) = g[Tuple(I)...] +# TBD: Can this method be removed if `EquidistantGrid` is an AbstractArray? + """ dimension(grid::EquidistantGrid)