comparison src/SbpOperators/boundaryops/boundary_restriction.jl @ 1207:f1c2a4fa0ee1 performance/get_region_type_inference

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 03 Feb 2023 22:14:47 +0100
parents c0ab81e4c39c
children 1cc45207817e
comparison
equal deleted inserted replaced
919:b41180efb6c2 1207:f1c2a4fa0ee1
1 """ 1 """
2 boundary_restriction(grid::EquidistantGrid, closure_stencil::Stencil, boundary::CartesianBoundary) 2 boundary_restriction(grid, closure_stencil::Stencil, boundary)
3 boundary_restriction(grid::EquidistantGrid{1}, closure_stencil::Stencil, region::Region)
4 3
5 Creates the boundary restriction operator `e` as a `TensorMapping` 4 Creates boundary restriction operators `e` as `LazyTensor`s on `boundary`
6 5
7 `e` is the restriction of a grid function to the boundary specified by `boundary` or `region` using some `closure_stencil`. 6 `e` is the restriction of a grid function to `boundary` using a `Stencil` `closure_stencil`.
8 `e'` is the prolongation of a grid function on the boundary to the whole grid using the same `closure_stencil`. 7 `e'` is the prolongation of a grid function on `boundary` to the whole grid using the same `closure_stencil`.
9 On a one-dimensional `grid`, `e` is a `BoundaryOperator`. On a multi-dimensional `grid`, `e` is the inflation of 8 On a one-dimensional `grid`, `e` is a `BoundaryOperator`. On a multi-dimensional `grid`, `e` is the inflation of
10 a `BoundaryOperator`. Also see the documentation of `SbpOperators.boundary_operator(...)` for more details. 9 a `BoundaryOperator`.
10
11 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref).
11 """ 12 """
12 function boundary_restriction(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary) 13 function boundary_restriction(grid, closure_stencil, boundary)
13 converted_stencil = convert(Stencil{eltype(grid)}, closure_stencil) 14 converted_stencil = convert(Stencil{eltype(grid)}, closure_stencil)
14 return SbpOperators.boundary_operator(grid, converted_stencil, boundary) 15
16 op = BoundaryOperator(restrict(grid, dim(boundary)), converted_stencil, region(boundary))
17 return LazyTensors.inflate(op, size(grid), dim(boundary))
15 end 18 end
16 boundary_restriction(grid::EquidistantGrid{1}, closure_stencil, region::Region) = boundary_restriction(grid, closure_stencil, CartesianBoundary{1,typeof(region)}())
17 19
18 export boundary_restriction 20 """
21 boundary_restriction(grid, stencil_set, boundary)
22
23 Creates a `boundary_restriction` operator on `grid` given a `stencil_set`.
24 """
25 boundary_restriction(grid, stencil_set::StencilSet, boundary) = boundary_restriction(grid, parse_stencil(stencil_set["e"]["closure"]), boundary)