comparison 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
comparison
equal deleted inserted replaced
1513:d7bc11053951 1520:97af5489dcf0
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(::Type{<:Grid{T}}) where T = eltype(T) 48 component_type(T::Type) = eltype(eltype(T))
41 component_type(g::Grid) = component_type(typeof(g)) 49 component_type(t) = component_type(typeof(t))
42 50
43 """ 51 """
44 refine(g::Grid, r) 52 refine(g::Grid, r)
45 53
46 The grid where `g` is refined by the factor `r`. 54 The grid where `g` is refined by the factor `r`.