comparison src/SbpOperators/boundaryops/boundary_operator.jl @ 1022:bbbc31953367 refactor/sbpoperators/inflation

Introduce an inflate function in lazy tensors and use it in volume_operator and boundary_operator
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 18 Mar 2022 16:57:00 +0100
parents 469ed954b493
children 52f07c77299d
comparison
equal deleted inserted replaced
988:83046af6143a 1022:bbbc31953367
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, closure_stencil, boundary::CartesianBoundary) 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
16 r = region(boundary)
17 d = dim(boundary) 15 d = dim(boundary)
18 op = BoundaryOperator(restrict(grid, d), closure_stencil, r) 16 op = BoundaryOperator(restrict(grid, d), closure_stencil, region(boundary))
19 17
20 # Create 1D IdentityMappings for each coordinate direction 18 return LazyTensors.inflate(op, size(grid), d)
21 one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid)))
22 Is = IdentityMapping{eltype(grid)}.(size.(one_d_grids))
23
24 # Formulate the correct outer product sequence of the identity mappings and
25 # the boundary operator
26 parts = Base.setindex(Is, op, d)
27 return foldl(⊗, parts)
28 end 19 end
29 20
30 """ 21 """
31 BoundaryOperator{T,R,N} <: TensorMapping{T,0,1} 22 BoundaryOperator{T,R,N} <: TensorMapping{T,0,1}
32 23