Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/boundaryops/boundary_restriction.jl @ 1281:1cc45207817e refactor/grids
Fix tests for boundary operator and boundary restriction
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 27 Feb 2023 08:48:38 +0100 |
parents | c0ab81e4c39c |
children | e94ddef5e72f |
comparison
equal
deleted
inserted
replaced
1280:17d435c08773 | 1281:1cc45207817e |
---|---|
1 """ | 1 """ |
2 boundary_restriction(grid, closure_stencil::Stencil, boundary) | 2 boundary_restriction(g, closure_stencil::Stencil, boundary) |
3 | 3 |
4 Creates boundary restriction operators `e` as `LazyTensor`s on `boundary` | 4 Creates boundary restriction operators `e` as `LazyTensor`s on `boundary` |
5 | 5 |
6 `e` is the restriction of a grid function to `boundary` using a `Stencil` `closure_stencil`. | 6 `e` is the restriction of a grid function to `boundary` using a `Stencil` `closure_stencil`. |
7 `e'` is the prolongation of a grid function on `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`. |
8 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 |
9 a `BoundaryOperator`. | 9 a `BoundaryOperator`. |
10 | 10 |
11 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref). | 11 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref). |
12 """ | 12 """ |
13 function boundary_restriction(grid, closure_stencil, boundary) | 13 #TODO: Check docstring |
14 converted_stencil = convert(Stencil{eltype(grid)}, closure_stencil) | 14 function boundary_restriction(g::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary) |
15 | 15 op = boundary_restriction(g.grids[grid_id(boundary)], stencil_set, boundary_id(boundary)) |
16 op = BoundaryOperator(restrict(grid, dim(boundary)), converted_stencil, region(boundary)) | 16 return LazyTensors.inflate(op, size(g), grid_id(boundary)) |
17 return LazyTensors.inflate(op, size(grid), dim(boundary)) | |
18 end | 17 end |
19 | 18 |
20 """ | 19 function boundary_restriction(g::EquidistantGrid, stencil_set::StencilSet, boundary) |
21 boundary_restriction(grid, stencil_set, boundary) | 20 closure_stencil = parse_stencil(stencil_set["e"]["closure"]) |
22 | 21 converted_stencil = convert(Stencil{eltype(g)}, closure_stencil) |
23 Creates a `boundary_restriction` operator on `grid` given a `stencil_set`. | 22 return BoundaryOperator(g, converted_stencil, boundary) |
24 """ | 23 end |
25 boundary_restriction(grid, stencil_set::StencilSet, boundary) = boundary_restriction(grid, parse_stencil(stencil_set["e"]["closure"]), boundary) |