Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/boundaryops/boundary_operator.jl @ 1073:5a3281429a48 feature/variable_derivatives
Merge feature/variable_derivatives
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 24 Mar 2022 12:35:14 +0100 |
parents | 3bb94ce74697 52f07c77299d |
children | 102ebdaf7c11 |
comparison
equal
deleted
inserted
replaced
1068:0b0444adacd3 | 1073:5a3281429a48 |
---|---|
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 IdentityTensors for each coordinate direction | 18 # Create 1D IdentityTensors for each coordinate direction |
21 one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) | 19 one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) |
22 Is = IdentityTensor{eltype(grid)}.(size.(one_d_grids)) | 20 Is = IdentityTensor{eltype(grid)}.(size.(one_d_grids)) |
23 | 21 |
24 # Formulate the correct outer product sequence of the identity mappings and | 22 return LazyTensors.inflate(op, size(grid), d) |
25 # the boundary operator | |
26 parts = Base.setindex(Is, op, d) | |
27 return foldl(⊗, parts) | |
28 end | 23 end |
29 | 24 |
30 """ | 25 """ |
31 BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} | 26 BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} |
32 | 27 |