diff src/SbpOperators/boundaryops/boundary_restriction.jl @ 925:6b47a9ee1632 feature/laplace_opset

Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 21 Feb 2022 13:13:37 +0100
parents 86776d06b883
children 22c80fb36400
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_restriction.jl	Mon Feb 21 13:12:47 2022 +0100
+++ b/src/SbpOperators/boundaryops/boundary_restriction.jl	Mon Feb 21 13:13:37 2022 +0100
@@ -1,16 +1,22 @@
 """
-    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 `TensorMapping`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 [`SbpOperators.boundary_operator`](@ref).
 """
-function boundary_restriction(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary)
+function boundary_restriction(grid, closure_stencil::Stencil, boundary)
     converted_stencil = convert(Stencil{eltype(grid)}, closure_stencil)
     return SbpOperators.boundary_operator(grid, converted_stencil, 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)
+
+Creates a `boundary_restriction` operator on `grid` given a parsed TOML
+`stencil_set`.
+"""
+boundary_restriction(grid, stencil_set, boundary) = boundary_restriction(grid, parse_stencil(stencil_set["e"]["closure"]), boundary)