comparison src/Grids/equidistant_grid.jl @ 1156:50b008d2e937 refactor/grids

Remove comments about EquidistantGrid potentially being an AbstractArray
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 01 Nov 2022 22:37:10 +0100
parents bda0afcf8e52
children 5f677cd6f0b6
comparison
equal deleted inserted replaced
1152:bda0afcf8e52 1156:50b008d2e937
33 by the tuple `size`. 33 by the tuple `size`.
34 """ 34 """
35 function EquidistantGrid(size, limit_lower, limit_upper) 35 function EquidistantGrid(size, limit_lower, limit_upper)
36 return EquidistantGrid{length(size), eltype(limit_lower)}(size, limit_lower, limit_upper) 36 return EquidistantGrid{length(size), eltype(limit_lower)}(size, limit_lower, limit_upper)
37 end 37 end
38 # TBD: Should it be an AbstractArray?
39 # Review: Do we need it to be? It could be nice to have an iterator for a grid, but are there any other
40 # functionalities we need? Adding two grids etc? If not, I suggest against subtyping AbstractArray.
41 38
42 """ 39 """
43 EquidistantGrid{T}() 40 EquidistantGrid{T}()
44 41
45 Constructs a 0-dimensional grid. 42 Constructs a 0-dimensional grid.
68 h = spacing(g) 65 h = spacing(g)
69 return g.limit_lower .+ (I.-1).*h 66 return g.limit_lower .+ (I.-1).*h
70 end 67 end
71 68
72 Base.getindex(g::EquidistantGrid, I::CartesianIndex) = g[Tuple(I)...] 69 Base.getindex(g::EquidistantGrid, I::CartesianIndex) = g[Tuple(I)...]
73 # TBD: Can this method be removed if `EquidistantGrid` is an AbstractArray?
74 # Review: See comment above.
75 70
76 # Review: 71 # Review:
77 # Is it not strange that evalOn(::Grid) is non-lazy while evalOn(::EquidistantGrid) is? 72 # Is it not strange that evalOn(::Grid) is non-lazy while evalOn(::EquidistantGrid) is?
78 # Also: Change name to evalon or eval_on!!!!!! 73 # Also: Change name to evalon or eval_on!!!!!!
79 function evalOn(grid::EquidistantGrid, f::Function) 74 function evalOn(grid::EquidistantGrid, f::Function)