view src/Grids/multiblockgrids.jl @ 2018:a3ffc3202813 feature/grids/multiblock_grids

Start implementation of MultiBlockGrid
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 12 Mar 2025 09:34:00 +0100
parents ea2a15454cf2
children fb2dc185c197
line wrap: on
line source


struct MultiBlockGrid{T,D,GT, CT} <: Grid{T,D}
    grids::GT
    connections::CT
end

function MultiBlockGrid(grids, connections)
    T = eltype(valtype(grids))
    D = ndims(valtype(grids))

    MultiBlockGrid{T,D,typeof(grids), typeof(connections)}(grids,connections)
end


"""
    MultiBlockBoundary{N, BID} <: BoundaryIdentifier

A boundary identifier for a multiblock grids. `N` Specifies which grid and
`BID` which boundary on that grid.
"""
struct MultiBlockBoundary{N, BID} <: BoundaryIdentifier end
grid_id(::MultiBlockBoundary{N, BID}) where {N, BID} = N
boundary_id(::MultiBlockBoundary{N, BID}) where {N, BID} = BID()


function connection(k1, b1::BoundaryIdentifier, k2, b2::BoundaryIdentifier)
    return (
        MultiBlockBoundary{k1,typeof(b1)}(),
        MultiBlockBoundary{k2,typeof(b2)}(),
    )
end

connection(t::Tuple) = connection(t...)