comparison src/Grids/zero_dim_grid.jl @ 1234:8806f4cd6fee refactor/grids

Move ZeroDimGrid to its own file
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 19 Feb 2023 22:20:44 +0100
parents
children 3fc78ad26d03
comparison
equal deleted inserted replaced
1233:3924c1f6ec6d 1234:8806f4cd6fee
1 struct ZeroDimGrid{T,S,RD} <: Grid{T,0,RD}
2 p::S
3
4 function ZeroDimGrid(p)
5 T = eltype(p)
6 S = typeof(p)
7 RD = length(p)
8 return new{T,S,RD}(p)
9 end
10 end
11
12 Base.size(g::ZeroDimGrid) = ()
13 Base.getindex(g::ZeroDimGrid) = g.p
14 Base.eachindex(g::ZeroDimGrid) = CartesianIndices(())