diff src/Grids/grid.jl @ 1520:97af5489dcf0

Merge refactor/component_type
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 22 Mar 2024 08:48:00 +0100
parents b6f6425e34ac
children 0cd6cf62af93
line wrap: on
line diff
--- a/src/Grids/grid.jl	Thu Mar 21 15:36:52 2024 +0100
+++ b/src/Grids/grid.jl	Fri Mar 22 08:48:00 2024 +0100
@@ -33,12 +33,20 @@
 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?!
 
 """
-    component_type(g)
+    component_type(gf)
+
+The type of the components of the elements of `gf`. I.e if `gf` is a vector
+valued grid function, `component_view(gf)` is the element type of the vectors
+at each grid point.
 
-The type of the components of the coordinate vector of `Grid` `g`.
+# Examples
+```julia-repl
+julia> component_type([[1,2], [2,3], [3,4]])
+Int64
+```
 """
-component_type(::Type{<:Grid{T}}) where T = eltype(T)
-component_type(g::Grid) = component_type(typeof(g))
+component_type(T::Type) = eltype(eltype(T))
+component_type(t) = component_type(typeof(t))
 
 """
     refine(g::Grid, r)