Mercurial > repos > public > sbplib_julia
view src/Grids/zero_dim_grid.jl @ 1250:40ca0af6e480 refactor/grids
Add methods to change_length and fix incorrect function declaration
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 22 Feb 2023 12:43:36 +0100 |
parents | 8806f4cd6fee |
children | 3fc78ad26d03 |
line wrap: on
line source
struct ZeroDimGrid{T,S,RD} <: Grid{T,0,RD} p::S function ZeroDimGrid(p) T = eltype(p) S = typeof(p) RD = length(p) return new{T,S,RD}(p) end end Base.size(g::ZeroDimGrid) = () Base.getindex(g::ZeroDimGrid) = g.p Base.eachindex(g::ZeroDimGrid) = CartesianIndices(())