comparison src/Grids/grid.jl @ 1512:7476877c0b0e refactor/component_type

Improve docstring for component_view
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 21 Mar 2024 08:00:05 +0100
parents 606975cdb1f3
children b6f6425e34ac
comparison
equal deleted inserted replaced
1511:d50ea06813d5 1512:7476877c0b0e
31 """ 31 """
32 coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T) 32 coordinate_size(::Type{<:Grid{T}}) where T = _ncomponents(T)
33 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?! 33 coordinate_size(g::Grid) = coordinate_size(typeof(g)) # TBD: Name of this function?!
34 34
35 """ 35 """
36 component_type(g) 36 component_type(gf)
37 37
38 The type of the components of the coordinate vector of `Grid` `g`. 38 The type of the components of the elements of `gf`. I.e if `gf` is a vector
39 valued grid function, `component_view(gf)` is the element type of the vectors
40 at each grid point.
41
42 # Examples
43 ```julia-repl
44 julia> component_type([[1,2], [2,3], [3,4]])
45 Int64
46 ```
39 """ 47 """
40 component_type(T::Type) = eltype(eltype(T)) 48 component_type(T::Type) = eltype(eltype(T))
41 component_type(t) = component_type(typeof(t)) 49 component_type(t) = component_type(typeof(t))
42 50
43 """ 51 """