Mercurial > repos > public > sbplib_julia
comparison test/Grids/tensor_grid_test.jl @ 1465:88e738d807cb feature/grids/boundary_indicies
Implement boundary_indices for TensorGrid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 29 Nov 2023 09:14:06 +0100 |
parents | c0c5e0620b83 |
children | d9d9ab18cdfc 611ae2308aa1 |
comparison
equal
deleted
inserted
replaced
1464:37cf9f79caa4 | 1465:88e738d807cb |
---|---|
167 | 167 |
168 @testset "boundary_grid" begin | 168 @testset "boundary_grid" begin |
169 @test boundary_grid(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₂) | 169 @test boundary_grid(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₂) |
170 @test boundary_grid(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₄) | 170 @test boundary_grid(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₄) |
171 end | 171 end |
172 | |
173 @testset "boundary_indices" begin | |
174 g₁ = EquidistantGrid(range(0,1,length=11)) | |
175 g₂ = EquidistantGrid(range(2,3,length=6)) | |
176 g₄ = ZeroDimGrid(@SVector[1,2]) | |
177 | |
178 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}()) == (1,:) | |
179 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == (11,:) | |
180 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}()) == (:,1) | |
181 @test boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}()) == (:,6) | |
182 @test boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}()) == (1,) | |
183 @test boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == (11,) | |
184 @test boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Lower}()) == (1,) | |
185 @test boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Upper}()) == (11,) | |
186 end | |
172 end | 187 end |
173 | 188 |
174 @testset "combined_coordinate_vector_type" begin | 189 @testset "combined_coordinate_vector_type" begin |
175 @test Grids.combined_coordinate_vector_type(Float64) == Float64 | 190 @test Grids.combined_coordinate_vector_type(Float64) == Float64 |
176 @test Grids.combined_coordinate_vector_type(Float64, Int) == SVector{2,Float64} | 191 @test Grids.combined_coordinate_vector_type(Float64, Int) == SVector{2,Float64} |