Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/quadratures/quadrature.jl @ 689:728fd5a2455a feature/boundary_quads
Change order of arguments for quadrature, and make inner_stencil have a default argument
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 12 Feb 2021 16:43:29 +0100 |
parents | 43cf58c69f91 |
children | fc755b29d418 |
comparison
equal
deleted
inserted
replaced
688:e9e46a587370 | 689:728fd5a2455a |
---|---|
1 """ | 1 """ |
2 quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) | 2 quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil) |
3 quadrature(grid::EquidistantGrid, closure_stencils) | 3 quadrature(grid::EquidistantGrid, closure_stencils) |
4 | 4 |
5 Creates the quadrature operator `H` as a `TensorMapping` | 5 Creates the quadrature operator `H` as a `TensorMapping` |
6 | 6 |
7 `H` approximiates the integral operator on `grid` the using the stencil | 7 `H` approximiates the integral operator on `grid` the using the stencil |
10 interior stencil with weight 1 is used. | 10 interior stencil with weight 1 is used. |
11 | 11 |
12 On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional | 12 On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional |
13 `grid`, `H` is the outer product of the 1-dimensional quadrature operators in | 13 `grid`, `H` is the outer product of the 1-dimensional quadrature operators in |
14 each coordinate direction. Also see the documentation of | 14 each coordinate direction. Also see the documentation of |
15 `SbpOperators.volume_operator(...)` for more details. On 0-dimensional `grid`, | 15 `SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, |
16 `H` is a 0-dimensional `IdentityMapping`. | 16 `H` is a 0-dimensional `IdentityMapping`. |
17 """ | 17 """ |
18 function quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) | 18 function quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil = CenteredStencil(one(eltype(grid)))) |
19 h = spacing(grid) | 19 h = spacing(grid) |
20 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) | 20 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) |
21 for i ∈ 2:dimension(grid) | 21 for i ∈ 2:dimension(grid) |
22 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) | 22 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) |
23 H = H∘Hᵢ | 23 H = H∘Hᵢ |
24 end | 24 end |
25 return H | 25 return H |
26 end | 26 end |
27 export quadrature | 27 export quadrature |
28 | 28 |
29 quadrature(grid::EquidistantGrid{0,T}, inner_stencil, closure_stencils) where T = IdentityMapping{T}() | 29 quadrature(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}() |
30 #TODO: Consider changing the interface of volume_operator to volume_operator(grid,closure_stencils,inner_stencil) | |
31 # in order to allow for having quadrature(grid, closure_stencils, inner_stencil = CenteredStencil(one(T))) | |
32 # Then the below function can be removed. | |
33 function quadrature(grid::EquidistantGrid{Dim,T}, closure_stencils) where {Dim,T} | |
34 inner_stencil = CenteredStencil(one(T)) | |
35 return quadrature(grid, inner_stencil, closure_stencils) | |
36 end |