Mercurial > repos > public > sbplib_julia
comparison src/Grids/multiblockgrids.jl @ 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 | 1b6f150d95c5 |
| children |
comparison
equal
deleted
inserted
replaced
| 2027:0f27ddff6f92 | 2028:06f4b2ab43e8 |
|---|---|
| 1 | |
| 2 struct MultiBlockGrid{T,D,GT, CT} <: Grid{T,D} | 1 struct MultiBlockGrid{T,D,GT, CT} <: Grid{T,D} |
| 3 grids::GT | 2 grids::GT |
| 4 connections::CT | 3 connections::CT |
| 5 end | 4 end |
| 6 | 5 |
| 13 | 12 |
| 14 grids(g::MultiBlockGrid) = g.grids | 13 grids(g::MultiBlockGrid) = g.grids |
| 15 connections(g::MultiBlockGrid) = g.connections | 14 connections(g::MultiBlockGrid) = g.connections |
| 16 | 15 |
| 17 Base.getindex(g::MultiBlockGrid, I...) = g.grids[I...] | 16 Base.getindex(g::MultiBlockGrid, I...) = g.grids[I...] |
| 18 # function boundary_identifiers end # Requires function from manifolds? | |
| 19 # function boundary_grid end # Should return a MultiBlockGrid with the right connections? | |
| 20 | |
| 21 | 17 |
| 22 min_spacing(g::MultiBlockGrid) = minimum(min_spacing, grids(g)) | 18 min_spacing(g::MultiBlockGrid) = minimum(min_spacing, grids(g)) |
| 23 | 19 |
| 24 function refine(g::MultiBlockGrid, n) | 20 function refine(g::MultiBlockGrid, n) |
| 25 gs = map(grids(g)) do gᵢ | 21 gs = map(grids(g)) do gᵢ |
| 34 coarsen(gᵢ,n) | 30 coarsen(gᵢ,n) |
| 35 end | 31 end |
| 36 | 32 |
| 37 return MultiBlockGrid(gs, connections(g)) | 33 return MultiBlockGrid(gs, connections(g)) |
| 38 end | 34 end |
| 39 | |
| 40 | |
| 41 # function boundary_indices end # Need to figure out the grid functions first? | |
| 42 # function eval_on end # Need to figure out the grid functions first? | |
| 43 # function Base.map end # Need to figure out the grid functions first? Should only have to implement the iterator interface | |
| 44 | |
| 45 # Plotting recipes | |
| 46 | 35 |
| 47 | 36 |
| 48 """ | 37 """ |
| 49 MultiBlockBoundary{N, BID} <: BoundaryIdentifier | 38 MultiBlockBoundary{N, BID} <: BoundaryIdentifier |
| 50 | 39 |
| 63 ) | 52 ) |
| 64 end | 53 end |
| 65 | 54 |
| 66 connection(t::Tuple) = connection(t...) | 55 connection(t::Tuple) = connection(t...) |
| 67 | 56 |
| 57 # function boundary_identifiers end # Requires function from manifolds? | |
| 58 | |
| 59 function boundary_grid(g::MultiBlockGrid, bId::MultiBlockBoundary) | |
| 60 return boundary_grid(grids(g)[grid_id(bId)], boundary_id(bId)) | |
| 61 end | |
| 62 | |
| 63 # function boundary_indices end # Need to figure out the grid functions first? | |
| 64 # function eval_on end # Need to figure out the grid functions first? | |
| 65 # function Base.map end # Need to figure out the grid functions first? Should only have to implement the iterator interface | |
| 66 | |
| 67 # Plotting recipes | |
| 68 | 68 |
| 69 | 69 |
| 70 # Nested indices?? | 70 # Nested indices?? |
| 71 # motsvarande eachindex | 71 # motsvarande eachindex |
| 72 # Kolla notebooks med experiment | 72 # Kolla notebooks med experiment |
