diff 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
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_operator.jl	Wed Mar 16 18:39:00 2022 +0100
+++ b/src/SbpOperators/boundaryops/boundary_operator.jl	Fri Mar 18 16:57:00 2022 +0100
@@ -12,19 +12,10 @@
 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
-    one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid)))
-    Is = IdentityMapping{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
 
 """