Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1331:ed3ea0630825 refactor/grids
Add some docs for Grid
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 03 May 2023 15:29:44 +0200 |
| parents | 5f05a708d730 |
| children | ad31c1022e42 |
comparison
equal
deleted
inserted
replaced
| 1330:5f05a708d730 | 1331:ed3ea0630825 |
|---|---|
| 1 """ | 1 """ |
| 2 Grid{T,D} | 2 Grid{T,D} |
| 3 | 3 |
| 4 The top level type for grids. | 4 A grid with coordinates of type `T`, e.g. `SVector{3,Float64}`, and dimension |
| 5 `D`. The grid can be embedded in a higher dimension in which case the number | |
| 6 of indices and the number of components of the coordinatevectors will be | |
| 7 different. | |
| 5 | 8 |
| 6 TODO: | 9 `Grids` is top level abstract type for grids. A grid should implement Julia's interfaces for |
| 7 Should implement | 10 indexing and iteration. |
| 8 * interfaces for iteration and indexing | 11 |
| 12 ## Note | |
| 13 | |
| 14 Importantly a grid does not have to be an `AbstractArray`. The reason is to | |
| 15 allow flexible handling of special types of grids like multiblock-grids, or | |
| 16 grids with special indexing. | |
| 9 """ | 17 """ |
| 10 abstract type Grid{T,D} end | 18 abstract type Grid{T,D} end |
| 11 | 19 |
| 12 Base.ndims(::Grid{T,D}) where {T,D} = D | 20 Base.ndims(::Grid{T,D}) where {T,D} = D |
| 13 Base.eltype(::Type{<:Grid{T}}) where T = T | 21 Base.eltype(::Type{<:Grid{T}}) where T = T |
