Mercurial > repos > public > sbplib_julia
changeset 1436:433245fd33c0 feature/grids/curvilinear
Merge refactor/grids/tensor_grid_eltype
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 07 Sep 2023 16:51:46 +0200 |
parents | 29adc06e5b56 (current diff) 25af92b4a7ea (diff) |
children | 0322c181a1cd |
files | src/Grids/tensor_grid.jl test/Grids/tensor_grid_test.jl |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/tensor_grid.jl Thu Sep 07 16:49:45 2023 +0200 +++ b/src/Grids/tensor_grid.jl Thu Sep 07 16:51:46 2023 +0200 @@ -45,7 +45,6 @@ _iterate_combine_coords((next,state)) = combine_coordinates(next...), state Base.IteratorSize(::Type{<:TensorGrid{<:Any, D}}) where D = Base.HasShape{D}() -Base.eltype(::Type{<:TensorGrid{T}}) where T = T Base.length(g::TensorGrid) = prod(length, g.grids) Base.size(g::TensorGrid) = LazyTensors.concatenate_tuples(size.(g.grids)...)
--- a/test/Grids/tensor_grid_test.jl Thu Sep 07 16:49:45 2023 +0200 +++ b/test/Grids/tensor_grid_test.jl Thu Sep 07 16:51:46 2023 +0200 @@ -85,6 +85,12 @@ @test eltype(TensorGrid(g₁, g₄)) == SVector{3,Float64} @test eltype(TensorGrid(g₁, g₄, g₂)) == SVector{4,Float64} + @test eltype(typeof(TensorGrid(g₁, g₂))) == SVector{2,Float64} + @test eltype(typeof(TensorGrid(g₁, g₃))) == SVector{2,Float64} + @test eltype(typeof(TensorGrid(g₁, g₂, g₃))) == SVector{3,Float64} + @test eltype(typeof(TensorGrid(g₁, g₄))) == SVector{3,Float64} + @test eltype(typeof(TensorGrid(g₁, g₄, g₂))) == SVector{4,Float64} + @test size(TensorGrid(g₁, g₂)) == (11,6) @test size(TensorGrid(g₁, g₃)) == (11,10) @test size(TensorGrid(g₁, g₂, g₃)) == (11,6,10)