Mercurial > repos > public > sbplib_julia
comparison src/Grids/EquidistantGrid.jl @ 1091:e3b41d48b5aa feature/variable_derivatives
Merge refactor/grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 26 Apr 2022 14:29:08 +0200 |
parents | 9b40aeac4269 |
children | c4ea28d904f5 |
comparison
equal
deleted
inserted
replaced
1083:de972d825289 | 1091:e3b41d48b5aa |
---|---|
64 Base.eltype(grid::EquidistantGrid{Dim,T}) where {Dim,T} = T | 64 Base.eltype(grid::EquidistantGrid{Dim,T}) where {Dim,T} = T |
65 | 65 |
66 Base.eachindex(grid::EquidistantGrid) = CartesianIndices(grid.size) | 66 Base.eachindex(grid::EquidistantGrid) = CartesianIndices(grid.size) |
67 | 67 |
68 Base.size(g::EquidistantGrid) = g.size | 68 Base.size(g::EquidistantGrid) = g.size |
69 | |
70 function Base.getindex(g::EquidistantGrid, I...) | |
71 h = spacing(g) | |
72 return g.limit_lower .+ (I.-1).*h | |
73 end | |
69 | 74 |
70 """ | 75 """ |
71 dimension(grid::EquidistantGrid) | 76 dimension(grid::EquidistantGrid) |
72 | 77 |
73 The dimension of the grid. | 78 The dimension of the grid. |