Mercurial > repos > public > sbplib_julia
comparison test/Grids/multiblockgrids_test.jl @ 2027:0f27ddff6f92 feature/grids/multiblock_grids
Update test grids
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 11 Apr 2025 08:13:21 +0200 |
| parents | 1b6f150d95c5 |
| children | 06f4b2ab43e8 |
comparison
equal
deleted
inserted
replaced
| 2026:1b6f150d95c5 | 2027:0f27ddff6f92 |
|---|---|
| 2 using StaticArrays | 2 using StaticArrays |
| 3 | 3 |
| 4 | 4 |
| 5 function multiblockgrid1d() | 5 function multiblockgrid1d() |
| 6 g₁ = equidistant_grid(0,1,5) | 6 g₁ = equidistant_grid(0,1,5) |
| 7 g₂ = equidistant_grid(0,1,5) | 7 g₂ = equidistant_grid(1,2,5) |
| 8 g₃ = equidistant_grid(0,1,5) | 8 g₃ = equidistant_grid(2,3,5) |
| 9 | 9 |
| 10 C = connection.([ | 10 C = connection.([ |
| 11 (1, UpperBoundary(), 2, LowerBoundary()), | 11 (1, UpperBoundary(), 2, LowerBoundary()), |
| 12 (2, UpperBoundary(), 3, LowerBoundary()), | 12 (2, UpperBoundary(), 3, LowerBoundary()), |
| 13 ]) | 13 ]) |
| 15 return [g₁,g₂,g₃], C | 15 return [g₁,g₂,g₃], C |
| 16 end | 16 end |
| 17 | 17 |
| 18 function multiblockgrid2d() | 18 function multiblockgrid2d() |
| 19 g₁₁ = equidistant_grid((0,0),(1,1),5,5) | 19 g₁₁ = equidistant_grid((0,0),(1,1),5,5) |
| 20 g₁₂ = equidistant_grid((0,0),(1,1),5,5) | 20 g₁₂ = equidistant_grid((0,1),(1,2),5,5) |
| 21 g₂₁ = equidistant_grid((0,0),(1,1),11,11) | 21 g₂₁ = equidistant_grid((1,0),(2,1),11,11) |
| 22 g₂₂ = equidistant_grid((0,0),(1,1),5,5) | 22 g₂₂ = equidistant_grid((1,1),(2,2),5,5) |
| 23 | 23 |
| 24 C = map(((i1,d1,b1,i2,d2,b2),)->connection(i1,CartesianBoundary{d1,b1}(), i2, CartesianBoundary{d2,b2}()),[ | 24 C = map(((i1,d1,b1,i2,d2,b2),)->connection(i1,CartesianBoundary{d1,b1}(), i2, CartesianBoundary{d2,b2}()),[ |
| 25 (1, 1, UpperBoundary, 2, 1, LowerBoundary), | 25 (1, 1, UpperBoundary, 2, 1, LowerBoundary), |
| 26 (3, 1, UpperBoundary, 4, 1, LowerBoundary), | 26 (3, 1, UpperBoundary, 4, 1, LowerBoundary), |
| 27 (1, 2, UpperBoundary, 3, 2, LowerBoundary), | 27 (1, 2, UpperBoundary, 3, 2, LowerBoundary), |
| 31 return [g₁₁, g₁₂, g₂₁, g₂₂], C | 31 return [g₁₁, g₁₂, g₂₁, g₂₂], C |
| 32 end | 32 end |
| 33 | 33 |
| 34 function multiblockgrid_matrix() | 34 function multiblockgrid_matrix() |
| 35 g₁₁ = equidistant_grid((0,0),(1,1),5,5) | 35 g₁₁ = equidistant_grid((0,0),(1,1),5,5) |
| 36 g₁₂ = equidistant_grid((0,0),(1,1),5,5) | 36 g₁₂ = equidistant_grid((0,1),(1,2),5,5) |
| 37 g₂₁ = equidistant_grid((0,0),(1,1),11,11) | 37 g₂₁ = equidistant_grid((1,0),(2,1),11,11) |
| 38 g₂₂ = equidistant_grid((0,0),(1,1),5,5) | 38 g₂₂ = equidistant_grid((1,1),(2,2),5,5) |
| 39 | 39 |
| 40 C = map(((i1,d1,b1,i2,d2,b2),)->connection(CartesianIndex(i1),CartesianBoundary{d1,b1}(), CartesianIndex(i2), CartesianBoundary{d2,b2}()),[ | 40 C = map(((i1,d1,b1,i2,d2,b2),)->connection(CartesianIndex(i1),CartesianBoundary{d1,b1}(), CartesianIndex(i2), CartesianBoundary{d2,b2}()),[ |
| 41 ((1,1), 1, UpperBoundary, (1,2), 1, LowerBoundary), | 41 ((1,1), 1, UpperBoundary, (1,2), 1, LowerBoundary), |
| 42 ((2,1), 1, UpperBoundary, (2,2), 1, LowerBoundary), | 42 ((2,1), 1, UpperBoundary, (2,2), 1, LowerBoundary), |
| 43 ((1,1), 2, UpperBoundary, (1,2), 2, LowerBoundary), | 43 ((1,1), 2, UpperBoundary, (1,2), 2, LowerBoundary), |
| 135 | 135 |
| 136 rg = refine(MultiBlockGrid(gs,cs),2) | 136 rg = refine(MultiBlockGrid(gs,cs),2) |
| 137 @test connections(rg) == cs | 137 @test connections(rg) == cs |
| 138 @test grids(rg) == [ | 138 @test grids(rg) == [ |
| 139 equidistant_grid((0,0),(1,1),9,9), | 139 equidistant_grid((0,0),(1,1),9,9), |
| 140 equidistant_grid((0,0),(1,1),9,9), | 140 equidistant_grid((0,1),(1,2),9,9), |
| 141 equidistant_grid((0,0),(1,1),21,21), | 141 equidistant_grid((1,0),(2,1),21,21), |
| 142 equidistant_grid((0,0),(1,1),9,9), | 142 equidistant_grid((1,1),(2,2),9,9), |
| 143 ] | 143 ] |
| 144 end | 144 end |
| 145 | 145 |
| 146 @testset "coarsen" begin | 146 @testset "coarsen" begin |
| 147 gs, cs = multiblockgrid2d() | 147 gs, cs = multiblockgrid2d() |
| 149 | 149 |
| 150 cg = coarsen(MultiBlockGrid(gs,cs),2) | 150 cg = coarsen(MultiBlockGrid(gs,cs),2) |
| 151 @test connections(cg) == cs | 151 @test connections(cg) == cs |
| 152 @test grids(cg) == [ | 152 @test grids(cg) == [ |
| 153 equidistant_grid((0,0),(1,1),3,3), | 153 equidistant_grid((0,0),(1,1),3,3), |
| 154 equidistant_grid((0,0),(1,1),3,3), | 154 equidistant_grid((0,1),(1,2),3,3), |
| 155 equidistant_grid((0,0),(1,1),6,6), | 155 equidistant_grid((1,0),(2,1),6,6), |
| 156 equidistant_grid((0,0),(1,1),3,3), | 156 equidistant_grid((1,1),(2,2),3,3), |
| 157 ] | 157 ] |
| 158 end | 158 end |
| 159 | 159 |
| 160 @testset "boundary_indices" begin | 160 @testset "boundary_indices" begin |
| 161 @test_broken false | 161 @test_broken false |
