Mercurial > repos > public > sbplib_julia
diff 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 |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_restriction.jl Mon Feb 21 10:33:58 2022 +0100 +++ b/src/SbpOperators/boundaryops/boundary_restriction.jl Fri Feb 03 22:14:47 2023 +0100 @@ -1,18 +1,25 @@ """ - boundary_restriction(grid::EquidistantGrid, closure_stencil::Stencil, boundary::CartesianBoundary) - boundary_restriction(grid::EquidistantGrid{1}, closure_stencil::Stencil, region::Region) + boundary_restriction(grid, closure_stencil::Stencil, boundary) -Creates the boundary restriction operator `e` as a `TensorMapping` +Creates boundary restriction operators `e` as `LazyTensor`s on `boundary` -`e` is the restriction of a grid function to the boundary specified by `boundary` or `region` using some `closure_stencil`. -`e'` is the prolongation of a grid function on the boundary to the whole grid using the same `closure_stencil`. +`e` is the restriction of a grid function to `boundary` using a `Stencil` `closure_stencil`. +`e'` is the prolongation of a grid function on `boundary` to the whole grid using the same `closure_stencil`. On a one-dimensional `grid`, `e` is a `BoundaryOperator`. On a multi-dimensional `grid`, `e` is the inflation of -a `BoundaryOperator`. Also see the documentation of `SbpOperators.boundary_operator(...)` for more details. +a `BoundaryOperator`. + +See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref). """ -function boundary_restriction(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary) +function boundary_restriction(grid, closure_stencil, boundary) converted_stencil = convert(Stencil{eltype(grid)}, closure_stencil) - return SbpOperators.boundary_operator(grid, converted_stencil, boundary) + + op = BoundaryOperator(restrict(grid, dim(boundary)), converted_stencil, region(boundary)) + return LazyTensors.inflate(op, size(grid), dim(boundary)) end -boundary_restriction(grid::EquidistantGrid{1}, closure_stencil, region::Region) = boundary_restriction(grid, closure_stencil, CartesianBoundary{1,typeof(region)}()) + +""" + boundary_restriction(grid, stencil_set, boundary) -export boundary_restriction +Creates a `boundary_restriction` operator on `grid` given a `stencil_set`. +""" +boundary_restriction(grid, stencil_set::StencilSet, boundary) = boundary_restriction(grid, parse_stencil(stencil_set["e"]["closure"]), boundary)