Mercurial > repos > public > sbplib_julia
diff test/Grids/mapped_grid_test.jl @ 1743:49bd573ab07f feature/grids/curvilinear
Implement checking of sizes for inputs to MappedGrid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 11 Sep 2024 13:46:33 +0200 |
parents | c9c601678a14 |
children | c38eead8be17 |
line wrap: on
line diff
--- a/test/Grids/mapped_grid_test.jl Wed Sep 11 12:09:59 2024 +0200 +++ b/test/Grids/mapped_grid_test.jl Wed Sep 11 13:46:33 2024 +0200 @@ -57,9 +57,25 @@ @test logicalgrid(mg) == lg # TODO: Test that the element types agree + sz1 = (10,11) + sz2 = (10,12) + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz2...), + rand(SVector{2},sz1...), + rand(SMatrix{2,2},sz1...), + ) - @test_broken false # @test_throws ArgumentError("Sizes must match") MappedGrid(lg, map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11)) + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz1...), + rand(SVector{2},sz2...), + rand(SMatrix{2,2},sz1...), + ) + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz1...), + rand(SVector{2},sz1...), + rand(SMatrix{2,2},sz2...), + ) end @@ -111,11 +127,13 @@ lg = equidistant_grid((0,0), (1,1), 11, 21) x̄ = map(ξ̄ -> 2ξ̄, lg) J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + lg2 = equidistant_grid((0,0), (1,1), 15, 11) sg = MappedGrid( equidistant_grid((0,0), (1,1), 15, 11), - map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11) + map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg2), rand(SMatrix{2,3,Float64},15,11) ) @test eltype(mg) == SVector{2,Float64}