Mercurial > repos > public > sbplib_julia
comparison test/Grids/tensor_grid_test.jl @ 1824:7a2375080287 refactor/grids/iterable_boundary_indices
WIP
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 19 Jun 2024 11:16:42 +0200 |
parents | b459082533f7 |
children | 98ae79eb0709 |
comparison
equal
deleted
inserted
replaced
1624:888e4092e2ed | 1824:7a2375080287 |
---|---|
173 @testset "boundary_indices" begin | 173 @testset "boundary_indices" begin |
174 g₁ = EquidistantGrid(range(0,1,length=11)) | 174 g₁ = EquidistantGrid(range(0,1,length=11)) |
175 g₂ = EquidistantGrid(range(2,3,length=6)) | 175 g₂ = EquidistantGrid(range(2,3,length=6)) |
176 g₄ = ZeroDimGrid(@SVector[1,2]) | 176 g₄ = ZeroDimGrid(@SVector[1,2]) |
177 | 177 |
178 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}()) == (1,:) | 178 @test iterate(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}())) |
179 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == (11,:) | 179 |
180 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}()) == (:,1) | 180 gf = reshape(1:(11*6),11,6) |
181 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}()) == (:,6) | 181 @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}()))] == gf[1,:] |
182 @test boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}()) == (1,) | 182 @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()))] == gf[11,:] |
183 @test boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == (11,) | 183 @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}()))] == gf[:,1] |
184 @test boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Lower}()) == (1,) | 184 @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}()))] == gf[:,6] |
185 @test boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Upper}()) == (11,) | 185 |
186 @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}())) == [(1,i) for i ∈ 1:6] | |
187 @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}())) == [(11,i) for i ∈ 1:6] | |
188 @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}())) == [(i,1) for i ∈ 1:11] | |
189 @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}())) == [(i,6) for i ∈ 1:11] | |
190 @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}())) == [(1,)] | |
191 @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}())) == [(11,)] | |
192 @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Lower}())) == [(1,)] | |
193 @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Upper}())) == [(11,)] | |
186 end | 194 end |
187 end | 195 end |
188 | 196 |
189 @testset "combined_coordinate_vector_type" begin | 197 @testset "combined_coordinate_vector_type" begin |
190 @test Grids.combined_coordinate_vector_type(Float64) == Float64 | 198 @test Grids.combined_coordinate_vector_type(Float64) == Float64 |