diff 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
line wrap: on
line diff
--- a/src/Grids/grid.jl	Wed May 03 15:31:53 2023 +0200
+++ b/src/Grids/grid.jl	Wed May 03 15:39:34 2023 +0200
@@ -19,8 +19,12 @@
 
 Base.ndims(::Grid{T,D}) where {T,D} = D
 Base.eltype(::Type{<:Grid{T}}) where T = T
-coordinate_size(::Grid{T}) where T = _ncomponents(T) # TBD: Name of this function?!
-component_type(::Grid{T}) where T = eltype(T)
+
+coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T)
+coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?!
+
+component_type(::Type{<:Grid{T}}) where T = eltype(T)
+component_type(g::Grid) = component_type(typeof(g))
 
 """
     refine(g::Grid, r)