Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/volumeops/quadratures/quadrature.jl @ 693:d52902f36868
Merging feature/boundary_quads
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Sat, 13 Feb 2021 16:05:02 +0100 |
parents | 728fd5a2455a |
children | fc755b29d418 |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/quadratures/quadrature.jl Sun Feb 07 21:16:40 2021 +0100 +++ b/src/SbpOperators/volumeops/quadratures/quadrature.jl Sat Feb 13 16:05:02 2021 +0100 @@ -1,36 +1,29 @@ """ - Quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) + quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil) + quadrature(grid::EquidistantGrid, closure_stencils) Creates the quadrature operator `H` as a `TensorMapping` -The quadrature approximates the integral operator on the grid using +`H` approximiates the integral operator on `grid` the using the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` -for the points in the closure regions. +for the points in the closure regions. If `inner_stencil` is omitted a central +interior stencil with weight 1 is used. On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional `grid`, `H` is the outer product of the 1-dimensional quadrature operators in each coordinate direction. Also see the documentation of -`SbpOperators.volume_operator(...)` for more details. +`SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, +`H` is a 0-dimensional `IdentityMapping`. """ -function Quadrature(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim +function quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil = CenteredStencil(one(eltype(grid)))) h = spacing(grid) H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) - for i ∈ 2:Dim + for i ∈ 2:dimension(grid) Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) H = H∘Hᵢ end return H end -export Quadrature - -""" - DiagonalQuadrature(grid::EquidistantGrid, closure_stencils) +export quadrature -Creates the quadrature operator with the inner stencil 1/h and 1-element sized -closure stencils (i.e the operator is diagonal) -""" -function DiagonalQuadrature(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) where {M,T} - inner_stencil = Stencil(one(T), center=1) - return Quadrature(grid, inner_stencil, closure_stencils) -end -export DiagonalQuadrature +quadrature(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}()