Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 2016:e17d90763a3f feature/grids/multiblock_grids
Add ndims for grid types
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 12 Mar 2025 08:59:28 +0100 |
| parents | 863385aae454 |
| children |
comparison
equal
deleted
inserted
replaced
| 1985:5d34b88e5733 | 2016:e17d90763a3f |
|---|---|
| 17 allow flexible handling of special types of grids like multi-block grids, or | 17 allow flexible handling of special types of grids like multi-block grids, or |
| 18 grids with special indexing. | 18 grids with special indexing. |
| 19 """ | 19 """ |
| 20 abstract type Grid{T,D} end | 20 abstract type Grid{T,D} end |
| 21 | 21 |
| 22 Base.ndims(::Grid{T,D}) where {T,D} = D | 22 Base.ndims(::Grid{<:Any,D}) where D = D |
| 23 Base.ndims(::Type{<:Grid{<:Any,D}}) where D = D | |
| 23 Base.eltype(::Type{<:Grid{T}}) where T = T | 24 Base.eltype(::Type{<:Grid{T}}) where T = T |
| 24 | 25 |
| 25 Base.getindex(g::Grid, I::CartesianIndex) = g[Tuple(I)...] | 26 Base.getindex(g::Grid, I::CartesianIndex) = g[Tuple(I)...] |
| 26 | 27 |
| 27 """ | 28 """ |
