Mercurial > repos > public > sbplib_julia
changeset 2028:06f4b2ab43e8 feature/grids/multiblock_grids
Implement boundary_grid
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 11 Apr 2025 15:58:17 +0200 |
| parents | 0f27ddff6f92 |
| children | |
| files | src/Grids/multiblockgrids.jl test/Grids/multiblockgrids_test.jl |
| diffstat | 2 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/multiblockgrids.jl Fri Apr 11 08:13:21 2025 +0200 +++ b/src/Grids/multiblockgrids.jl Fri Apr 11 15:58:17 2025 +0200 @@ -1,4 +1,3 @@ - struct MultiBlockGrid{T,D,GT, CT} <: Grid{T,D} grids::GT connections::CT @@ -15,9 +14,6 @@ connections(g::MultiBlockGrid) = g.connections Base.getindex(g::MultiBlockGrid, I...) = g.grids[I...] -# function boundary_identifiers end # Requires function from manifolds? -# function boundary_grid end # Should return a MultiBlockGrid with the right connections? - min_spacing(g::MultiBlockGrid) = minimum(min_spacing, grids(g)) @@ -38,13 +34,6 @@ end -# function boundary_indices end # Need to figure out the grid functions first? -# function eval_on end # Need to figure out the grid functions first? -# function Base.map end # Need to figure out the grid functions first? Should only have to implement the iterator interface - -# Plotting recipes - - """ MultiBlockBoundary{N, BID} <: BoundaryIdentifier @@ -65,6 +54,17 @@ connection(t::Tuple) = connection(t...) +# function boundary_identifiers end # Requires function from manifolds? + +function boundary_grid(g::MultiBlockGrid, bId::MultiBlockBoundary) + return boundary_grid(grids(g)[grid_id(bId)], boundary_id(bId)) +end + +# function boundary_indices end # Need to figure out the grid functions first? +# function eval_on end # Need to figure out the grid functions first? +# function Base.map end # Need to figure out the grid functions first? Should only have to implement the iterator interface + +# Plotting recipes # Nested indices??
--- a/test/Grids/multiblockgrids_test.jl Fri Apr 11 08:13:21 2025 +0200 +++ b/test/Grids/multiblockgrids_test.jl Fri Apr 11 15:58:17 2025 +0200 @@ -120,7 +120,17 @@ end @testset "boundary_grid" begin - @test_broken false + g1 = MultiBlockGrid(multiblockgrid1d()...) + @test boundary_grid(g1, MultiBlockBoundary{1,LowerBoundary}()) == ZeroDimGrid(0.) + @test boundary_grid(g1, MultiBlockBoundary{3,UpperBoundary}()) == ZeroDimGrid(3.) + + g2 = MultiBlockGrid(multiblockgrid2d()...) + b1lb = MultiBlockBoundary{1,CartesianBoundary{1,LowerBoundary}}() + @test boundary_grid(g2, b1lb) == TensorGrid(ZeroDimGrid(0.),equidistant_grid(0,1,5)) + + gm = MultiBlockGrid(multiblockgrid_matrix()...) + b21lb = MultiBlockBoundary{CartesianIndex(2,1),CartesianBoundary{2,LowerBoundary}}() + @test boundary_grid(gm, b21lb) == TensorGrid(equidistant_grid(1,2,11),ZeroDimGrid(0.)) end @testset "min_spacing" begin
