Mercurial > repos > public > sbplib_julia
changeset 1464:37cf9f79caa4 feature/grids/boundary_indicies
Make boundary_indices for EquidistantGrid return a tuple to be more concistent with how TensorGrid will implement it
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 29 Nov 2023 09:04:12 +0100 |
parents | 4ad1282f8bab |
children | 88e738d807cb |
files | src/Grids/equidistant_grid.jl test/Grids/equidistant_grid_test.jl |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Tue Nov 28 08:55:22 2023 +0100 +++ b/src/Grids/equidistant_grid.jl Wed Nov 29 09:04:12 2023 +0100 @@ -51,8 +51,8 @@ boundary_identifiers(::EquidistantGrid) = (Lower(), Upper()) boundary_grid(g::EquidistantGrid, id::Lower) = ZeroDimGrid(g[begin]) boundary_grid(g::EquidistantGrid, id::Upper) = ZeroDimGrid(g[end]) -boundary_indices(g::EquidistantGrid, id::Lower) = 1 -boundary_indices(g::EquidistantGrid, id::Upper) = length(g) +boundary_indices(g::EquidistantGrid, id::Lower) = (1,) +boundary_indices(g::EquidistantGrid, id::Upper) = (length(g),) """ refine(g::EquidistantGrid, r::Int)
--- a/test/Grids/equidistant_grid_test.jl Tue Nov 28 08:55:22 2023 +0100 +++ b/test/Grids/equidistant_grid_test.jl Wed Nov 29 09:04:12 2023 +0100 @@ -70,12 +70,12 @@ @testset "boundary_indices" begin g = EquidistantGrid(0:0.1:1) - @test boundary_indices(g, Lower()) == 1 - @test boundary_indices(g, Upper()) == 11 + @test boundary_indices(g, Lower()) == (1,) + @test boundary_indices(g, Upper()) == (11,) g = EquidistantGrid(2:0.1:10) - @test boundary_indices(g, Lower()) == 1 - @test boundary_indices(g, Upper()) == 81 + @test boundary_indices(g, Lower()) == (1,) + @test boundary_indices(g, Upper()) == (81,) end