Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1333:79a2193da5c1 refactor/grids
Implement coordinate_size() and component_type() types
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 03 May 2023 15:39:34 +0200 |
| parents | ad31c1022e42 |
| children | 47e309eac131 |
comparison
equal
deleted
inserted
replaced
| 1332:ad31c1022e42 | 1333:79a2193da5c1 |
|---|---|
| 17 """ | 17 """ |
| 18 abstract type Grid{T,D} end | 18 abstract type Grid{T,D} end |
| 19 | 19 |
| 20 Base.ndims(::Grid{T,D}) where {T,D} = D | 20 Base.ndims(::Grid{T,D}) where {T,D} = D |
| 21 Base.eltype(::Type{<:Grid{T}}) where T = T | 21 Base.eltype(::Type{<:Grid{T}}) where T = T |
| 22 coordinate_size(::Grid{T}) where T = _ncomponents(T) # TBD: Name of this function?! | 22 |
| 23 component_type(::Grid{T}) where T = eltype(T) | 23 coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T) |
| 24 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?! | |
| 25 | |
| 26 component_type(::Type{<:Grid{T}}) where T = eltype(T) | |
| 27 component_type(g::Grid) = component_type(typeof(g)) | |
| 24 | 28 |
| 25 """ | 29 """ |
| 26 refine(g::Grid, r) | 30 refine(g::Grid, r) |
| 27 | 31 |
| 28 `g` refined by the factor `r`. | 32 `g` refined by the factor `r`. |
