Mercurial > repos > public > sbplib_julia
diff test/Grids/equidistant_grid_test.jl @ 1146:31041ef8092a refactor/grids
Specialize evalOn for EquidistantGrid to return a LazyArray
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 19 Oct 2022 23:23:36 +0200 |
parents | cfe6a09974fb |
children | c150eabaf656 |
line wrap: on
line diff
--- a/test/Grids/equidistant_grid_test.jl Wed Oct 19 23:14:00 2022 +0200 +++ b/test/Grids/equidistant_grid_test.jl Wed Oct 19 23:23:36 2022 +0200 @@ -1,6 +1,7 @@ using Sbplib.Grids using Test using Sbplib.RegionIndices +using Sbplib.LazyTensors @testset "EquidistantGrid" begin @@ -56,6 +57,16 @@ @test g[CartesianIndex(1,3)] == (-1.0,7.11) end + @testset "evalOn" begin + g = EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0)) + + @test evalOn(g, (x,y) -> 0.) isa LazyArray + @test evalOn(g, (x,y) -> 0.) == fill(0., (5,3)) + + f(x,y) = sin(x)*cos(y) + @test evalOn(g, f) == map(p->f(p...), points(g)) + end + @testset "restrict" begin g = EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0)) @test restrict(g, 1) == EquidistantGrid(5,0.0,2.0)