comparison src/Grids/zero_dim_grid.jl @ 1257:198ccda331a6 refactor/grids

Remove range dim as a type paratmeter on Grid as it is already encoded in T if available
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 23 Feb 2023 11:38:19 +0100
parents 3fc78ad26d03
children 8b9a77d2dc91
comparison
equal deleted inserted replaced
1256:3fc78ad26d03 1257:198ccda331a6
1 struct ZeroDimGrid{T,S,RD} <: Grid{T,0,RD} 1 struct ZeroDimGrid{T,S} <: Grid{T,0}
2 p::S 2 p::S
3 3
4 function ZeroDimGrid(p) 4 function ZeroDimGrid(p)
5 T = eltype(p) 5 T = eltype(p)
6 S = typeof(p) 6 S = typeof(p)
7 RD = length(p) 7 return new{T,S}(p)
8 return new{T,S,RD}(p)
9 end 8 end
10 end 9 end
11 10
12 Base.size(g::ZeroDimGrid) = () 11 Base.size(g::ZeroDimGrid) = ()
13 Base.getindex(g::ZeroDimGrid) = g.p 12 Base.getindex(g::ZeroDimGrid) = g.p