Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/boundaryops/boundary_operator.jl @ 1160:1e44375d8a67
Merge refactor/sbpoperators/inflation
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 29 Nov 2022 22:11:01 +0100 |
| parents | 716e721ce3eb |
| children | f1c2a4fa0ee1 1cc45207817e 102ebdaf7c11 |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_operator.jl Fri Oct 21 21:41:43 2022 +0200 +++ b/src/SbpOperators/boundaryops/boundary_operator.jl Tue Nov 29 22:11:01 2022 +0100 @@ -1,32 +1,3 @@ -""" - boundary_operator(grid,closure_stencil,boundary) - -Creates a boundary operator on a `Dim`-dimensional grid for the -specified `boundary`. The action of the operator is determined by `closure_stencil`. - -When `Dim=1`, the corresponding `BoundaryOperator` tensor mapping is returned. -When `Dim>1`, the `BoundaryOperator` `op` is inflated by the outer product -of `IdentityTensors` in orthogonal coordinate directions, e.g for `Dim=3`, -the boundary restriction operator in the y-direction direction is `Ix⊗op⊗Iz`. -""" -function boundary_operator(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary) - #TODO:Check that dim(boundary) <= Dim? - - # Create 1D boundary operator - r = region(boundary) - d = dim(boundary) - op = BoundaryOperator(restrict(grid, d), closure_stencil, r) - - # Create 1D IdentityTensors for each coordinate direction - one_d_grids = restrict.(Ref(grid), Tuple(dims(grid))) - Is = IdentityTensor{eltype(grid)}.(size.(one_d_grids)) - - # Formulate the correct outer product sequence of the identity mappings and - # the boundary operator - parts = Base.setindex(Is, op, d) - return foldl(⊗, parts) -end - """ BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} @@ -41,8 +12,6 @@ size::Int end -BoundaryOperator{R}(stencil::Stencil{T,N}, size::Int) where {T,R,N} = BoundaryOperator{T,R,N}(stencil, size) - """ BoundaryOperator(grid::EquidistantGrid{1}, closure_stencil, region) @@ -55,6 +24,7 @@ """ closure_size(::BoundaryOperator) + The size of the closure stencil. """ closure_size(::BoundaryOperator{T,R,N}) where {T,R,N} = N
