comparison test/testGrids.jl @ 680:1d3e29ffc6c6 feature/boundary_quads

Add support for 0-dimensional grid, and add method boundary_grid
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 08 Feb 2021 18:43:38 +0100
parents f0ceddeae993
children 3ed922e95a35
comparison
equal deleted inserted replaced
675:1ce3a104afc8 680:1d3e29ffc6c6
61 CartesianBoundary{2,Lower}(),CartesianBoundary{2,Upper}(), 61 CartesianBoundary{2,Lower}(),CartesianBoundary{2,Upper}(),
62 CartesianBoundary{3,Lower}(),CartesianBoundary{3,Upper}()) 62 CartesianBoundary{3,Lower}(),CartesianBoundary{3,Upper}())
63 @test boundary_identifiers(g) == bids 63 @test boundary_identifiers(g) == bids
64 @inferred boundary_identifiers(g) 64 @inferred boundary_identifiers(g)
65 end 65 end
66
67 @testset "boundary_grid" begin
68 @testset "1D" begin
69 g = EquidistantGrid(5,0.0,2.0)
70 (id_l, id_r) = boundary_identifiers(g)
71 @test boundary_grid(g,id_l) == EquidistantGrid((),(),())
72 @test boundary_grid(g,id_r) == EquidistantGrid((),(),())
73
74 end
75 @testset "2D" begin
76 g = EquidistantGrid((5,3),(0.0,0.0),(1.0,3.0))
77 (id_w, id_e, id_s, id_n) = boundary_identifiers(g)
78 @test boundary_grid(g,id_w) == restrict(g,2)
79 @test boundary_grid(g,id_e) == restrict(g,2)
80 @test boundary_grid(g,id_s) == restrict(g,1)
81 @test boundary_grid(g,id_n) == restrict(g,1)
82 end
83 @testset "3D" begin
84 g = EquidistantGrid((2,5,3), (0.0,0.0,0.0), (2.0,1.0,3.0))
85 (id_w, id_e,
86 id_s, id_n,
87 id_t, id_b) = boundary_identifiers(g)
88 @test boundary_grid(g,id_w) == restrict(g,[2,3])
89 @test boundary_grid(g,id_e) == restrict(g,[2,3])
90 @test boundary_grid(g,id_s) == restrict(g,[1,3])
91 @test boundary_grid(g,id_n) == restrict(g,[1,3])
92 @test boundary_grid(g,id_t) == restrict(g,[1,2])
93 @test boundary_grid(g,id_b) == restrict(g,[1,2])
94 end
95 end
66 end 96 end
67 97
68 end 98 end