Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/boundaryops/boundary_operator.jl @ 823:3c1dd7692797
Merge refactor/sbp_operators_method_signatures
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 13 Jan 2022 12:43:10 +0100 |
| parents | b4acd25943f4 |
| children | a8d64785f51b |
comparison
equal
deleted
inserted
replaced
| 817:a1d556611e3c | 823:3c1dd7692797 |
|---|---|
| 7 When `Dim=1`, the corresponding `BoundaryOperator` tensor mapping is returned. | 7 When `Dim=1`, the corresponding `BoundaryOperator` tensor mapping is returned. |
| 8 When `Dim>1`, the `BoundaryOperator` `op` is inflated by the outer product | 8 When `Dim>1`, the `BoundaryOperator` `op` is inflated by the outer product |
| 9 of `IdentityMappings` in orthogonal coordinate directions, e.g for `Dim=3`, | 9 of `IdentityMappings` in orthogonal coordinate directions, e.g for `Dim=3`, |
| 10 the boundary restriction operator in the y-direction direction is `Ix⊗op⊗Iz`. | 10 the boundary restriction operator in the y-direction direction is `Ix⊗op⊗Iz`. |
| 11 """ | 11 """ |
| 12 function boundary_operator(grid::EquidistantGrid{Dim,T}, closure_stencil::Stencil{T}, boundary::CartesianBoundary) where {Dim,T} | 12 function boundary_operator(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary) |
| 13 #TODO:Check that dim(boundary) <= Dim? | 13 #TODO:Check that dim(boundary) <= Dim? |
| 14 | 14 |
| 15 # Create 1D boundary operator | 15 # Create 1D boundary operator |
| 16 r = region(boundary) | 16 r = region(boundary) |
| 17 d = dim(boundary) | 17 d = dim(boundary) |
| 18 op = BoundaryOperator(restrict(grid, d), closure_stencil, r) | 18 op = BoundaryOperator(restrict(grid, d), closure_stencil, r) |
| 19 | 19 |
| 20 # Create 1D IdentityMappings for each coordinate direction | 20 # Create 1D IdentityMappings for each coordinate direction |
| 21 one_d_grids = restrict.(Ref(grid), Tuple(1:Dim)) | 21 one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) |
| 22 Is = IdentityMapping{T}.(size.(one_d_grids)) | 22 Is = IdentityMapping{eltype(grid)}.(size.(one_d_grids)) |
| 23 | 23 |
| 24 # Formulate the correct outer product sequence of the identity mappings and | 24 # Formulate the correct outer product sequence of the identity mappings and |
| 25 # the boundary operator | 25 # the boundary operator |
| 26 parts = Base.setindex(Is, op, d) | 26 parts = Base.setindex(Is, op, d) |
| 27 return foldl(⊗, parts) | 27 return foldl(⊗, parts) |
