Mercurial > repos > public > sbplib_julia
changeset 1565:c3425b4302b8 feature/grids/manifolds
Add equidistant_grid method for HyperBox
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 25 Apr 2024 13:21:12 +0200 |
parents | 35fe4375b35f |
children | b9c7bab94241 |
files | src/Grids/equidistant_grid.jl test/Grids/equidistant_grid_test.jl |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Thu Apr 25 13:17:48 2024 +0200 +++ b/src/Grids/equidistant_grid.jl Thu Apr 25 13:21:12 2024 +0200 @@ -127,6 +127,10 @@ return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead? end + +equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(hb.a, hb.b, dims...) + + CartesianBoundary{D,BID} = TensorGridBoundary{D,BID} # TBD: What should we do about the naming of this boundary?
--- a/test/Grids/equidistant_grid_test.jl Thu Apr 25 13:17:48 2024 +0200 +++ b/test/Grids/equidistant_grid_test.jl Thu Apr 25 13:21:12 2024 +0200 @@ -2,6 +2,7 @@ using Test using Sbplib.RegionIndices using Sbplib.LazyTensors +using StaticArrays @testset "EquidistantGrid" begin @@ -143,6 +144,13 @@ @test [gp[i]...] ≈ [p[i]...] atol=5e-13 end end + + + @testset "equidistant_grid(::ParameterSpace)" begin + ps = HyperBox((0,0),(2,1)) + + @test equidistant_grid(ps, 3,4) == equidistant_grid((0,0), (2,1), 3,4) + end end