Mercurial > repos > public > sbplib_julia
changeset 1272:3637daad71e8 refactor/grids
Add function target_manifold_dim for Grid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 25 Feb 2023 22:49:43 +0100 |
parents | 5977d7628d55 |
children | 7fab13c07412 |
files | src/Grids/Grids.jl src/Grids/grid.jl test/Grids/grid_test.jl |
diffstat | 3 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/Grids.jl Sat Feb 25 22:49:21 2023 +0100 +++ b/src/Grids/Grids.jl Sat Feb 25 22:49:43 2023 +0100 @@ -6,6 +6,7 @@ # Grid export Grid +export target_manifold_dim export dims export TensorGrid
--- a/src/Grids/grid.jl Sat Feb 25 22:49:21 2023 +0100 +++ b/src/Grids/grid.jl Sat Feb 25 22:49:43 2023 +0100 @@ -13,6 +13,7 @@ Base.ndims(::Grid{T,D}) where {T,D} = D Base.eltype(::Type{<:Grid{T}}) where T = T +target_manifold_dim(::Grid{T}) where T = _ncomponents(T) # TBD: Name of this function?! """ # TODO
--- a/test/Grids/grid_test.jl Sat Feb 25 22:49:21 2023 +0100 +++ b/test/Grids/grid_test.jl Sat Feb 25 22:49:43 2023 +0100 @@ -11,6 +11,9 @@ @test ndims(DummyGrid{Int, 2}()) == 2 @test dims(DummyGrid{Int, 2}()) == 1:2 + + @test target_manifold_dim(DummyGrid{Int, 1}()) == 1 + @test target_manifold_dim(DummyGrid{SVector{3,Float64}, 2}()) == 3 end @testset "eval_on" begin