Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/boundaryops/boundary_operator.jl @ 1025:e74c41c4b60e feature/dissipation_operators
Merge refactor/sbpoperators/inflation
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 21 Mar 2022 15:12:59 +0100 |
parents | 52f07c77299d |
children | 5a3281429a48 62f321caa964 05a25a5063bb |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_operator.jl Fri Mar 18 15:44:03 2022 +0100 +++ b/src/SbpOperators/boundaryops/boundary_operator.jl Mon Mar 21 15:12:59 2022 +0100 @@ -6,37 +6,32 @@ When `Dim=1`, the corresponding `BoundaryOperator` tensor mapping is returned. When `Dim>1`, the `BoundaryOperator` `op` is inflated by the outer product -of `IdentityMappings` in orthogonal coordinate directions, e.g for `Dim=3`, +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) + op = BoundaryOperator(restrict(grid, d), closure_stencil, region(boundary)) - # Create 1D IdentityMappings for each coordinate direction + # Create 1D IdentityTensors for each coordinate direction one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) - Is = IdentityMapping{eltype(grid)}.(size.(one_d_grids)) + 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) + return LazyTensors.inflate(op, size(grid), d) end """ - BoundaryOperator{T,R,N} <: TensorMapping{T,0,1} + BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} -Implements the boundary operator `op` for 1D as a `TensorMapping` +Implements the boundary operator `op` for 1D as a `LazyTensor` `op` is the restriction of a grid function to the boundary using some closure `Stencil{T,N}`. The boundary to restrict to is determined by `R`. `op'` is the prolongation of a zero dimensional array to the whole grid using the same closure stencil. """ -struct BoundaryOperator{T,R<:Region,N} <: TensorMapping{T,0,1} +struct BoundaryOperator{T,R<:Region,N} <: LazyTensor{T,0,1} stencil::Stencil{T,N} size::Int end