view 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
line wrap: on
line source

struct ZeroDimGrid{T,S} <: Grid{T,0}
    p::S

    function ZeroDimGrid(p)
        T = eltype(p)
        S = typeof(p)
        return new{T,S}(p)
    end
end

Base.size(g::ZeroDimGrid) = ()
Base.getindex(g::ZeroDimGrid) = g.p
Base.eachindex(g::ZeroDimGrid) = CartesianIndices(())

# Indexing interface
# TODO
# Iteration interface
# TODO