Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1334:47e309eac131 refactor/grids
Add docs for coordinate_size and component_type
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 03 May 2023 15:41:45 +0200 |
parents | 79a2193da5c1 |
children | 52087a6c0682 |
comparison
equal
deleted
inserted
replaced
1333:79a2193da5c1 | 1334:47e309eac131 |
---|---|
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 | 22 |
23 """ | |
24 coordinate_size(grid) | |
25 | |
26 The lenght of the coordinate vector for the given grid. | |
27 """ | |
23 coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T) | 28 coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T) |
24 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?! | 29 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?! |
25 | 30 |
31 """ | |
32 component_type(grid) | |
33 | |
34 The type of the components of the coordinate vector. | |
35 """ | |
26 component_type(::Type{<:Grid{T}}) where T = eltype(T) | 36 component_type(::Type{<:Grid{T}}) where T = eltype(T) |
27 component_type(g::Grid) = component_type(typeof(g)) | 37 component_type(g::Grid) = component_type(typeof(g)) |
28 | 38 |
29 """ | 39 """ |
30 refine(g::Grid, r) | 40 refine(g::Grid, r) |