Mercurial > repos > public > sbplib_julia
changeset 699:40f2999f57b2 refactor/operator_naming
Rename folders and files from quadrature to inner_product
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Sun, 14 Feb 2021 13:56:43 +0100 |
parents | 5ddf28ddee18 |
children | 75b0c1a19fae |
files | src/SbpOperators/SbpOperators.jl src/SbpOperators/volumeops/inner_products/inner_product.jl src/SbpOperators/volumeops/inner_products/inverse_inner_product.jl src/SbpOperators/volumeops/quadratures/inverse_quadrature.jl src/SbpOperators/volumeops/quadratures/quadrature.jl |
diffstat | 5 files changed, 74 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/SbpOperators.jl Sun Feb 14 13:52:13 2021 +0100 +++ b/src/SbpOperators/SbpOperators.jl Sun Feb 14 13:56:43 2021 +0100 @@ -10,8 +10,8 @@ include("volumeops/volume_operator.jl") include("volumeops/derivatives/secondderivative.jl") include("volumeops/laplace/laplace.jl") -include("volumeops/quadratures/quadrature.jl") -include("volumeops/quadratures/inverse_quadrature.jl") +include("volumeops/inner_products/inner_product.jl") +include("volumeops/inner_products/inverse_inner_product.jl") include("boundaryops/boundary_operator.jl") include("boundaryops/boundary_restriction.jl") include("boundaryops/normal_derivative.jl")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SbpOperators/volumeops/inner_products/inner_product.jl Sun Feb 14 13:56:43 2021 +0100 @@ -0,0 +1,29 @@ +""" + inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil) + +Creates the discrete inner product operator `H` as a `TensorMapping` on an equidistant +grid, defined as `(u,v) = u'Hv` for grid functions `u,v`. + +`inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil)` creates +`H` on `grid` the using a set of stencils `closure_stencils` for the points in +the closure regions and the stencil and `inner_stencil` in the interior. If +`inner_stencil` is omitted a central interior stencil with weight 1 is used. + +On a 1-dimensional `grid`, `H` is a `VolumeOperator`. On a N-dimensional +`grid`, `H` is the outer product of the 1-dimensional inner product operators in +each coordinate direction. Also see the documentation of +`SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, +`H` is a 0-dimensional `IdentityMapping`. +""" +function inner_product(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: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 inner_product + +inner_product(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SbpOperators/volumeops/inner_products/inverse_inner_product.jl Sun Feb 14 13:56:43 2021 +0100 @@ -0,0 +1,43 @@ +""" + inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils) + inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) + +Creates the inverse inner product operator `H⁻¹` as a `TensorMapping` on an +equidistant grid. `H⁻¹` is defined implicitly by `H⁻¹∘H = I`, where +`H` is the corresponding inner product operator and `I` is the `IdentityMapping`. + +`inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils)` +constructs `H⁻¹` using a set of stencils `inv_closure_stencils` for the points +in the closure regions and the stencil `inv_inner_stencil` in the interior. If +`inv_closure_stencils` is omitted, a central interior stencil with weight 1 is used. + +`inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}})` +constructs a diagonal inverse inner product operator where `closure_stencils` are the +closure stencils of `H` (not `H⁻¹`!). + +On a 1-dimensional `grid`, `H⁻¹` is a `VolumeOperator`. On a N-dimensional +`grid`, `H⁻¹` is the outer product of the 1-dimensional inverse inner product +operators in each coordinate direction. Also see the documentation of +`SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, +`H⁻¹` is a 0-dimensional `IdentityMapping`. +""" +function inverse_inner_product(grid::EquidistantGrid, inv_closure_stencils, inv_inner_stencil = CenteredStencil(one(eltype(grid)))) + h⁻¹ = inverse_spacing(grid) + H⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[1]),scale.(inv_closure_stencils,h⁻¹[1]),even,1) + for i ∈ 2:dimension(grid) + Hᵢ⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[i]),scale.(inv_closure_stencils,h⁻¹[i]),even,i) + H⁻¹ = H⁻¹∘Hᵢ⁻¹ + end + return H⁻¹ +end +export inverse_inner_product + +inverse_inner_product(grid::EquidistantGrid{0}, inv_closure_stencils, inv_inner_stencil) = IdentityMapping{eltype(grid)}() + +function inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) where {M,T} + inv_closure_stencils = reciprocal_stencil.(closure_stencils) + inv_inner_stencil = CenteredStencil(one(T)) + return inverse_inner_product(grid, inv_closure_stencils, inv_inner_stencil) +end + +reciprocal_stencil(s::Stencil{T}) where T = Stencil(s.range,one(T)./s.weights)
--- a/src/SbpOperators/volumeops/quadratures/inverse_quadrature.jl Sun Feb 14 13:52:13 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -""" - inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils) - inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) - -Creates the inverse inner product operator `H⁻¹` as a `TensorMapping` on an -equidistant grid. `H⁻¹` is defined implicitly by `H⁻¹∘H = I`, where -`H` is the corresponding inner product operator and `I` is the `IdentityMapping`. - -`inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils)` -constructs `H⁻¹` using a set of stencils `inv_closure_stencils` for the points -in the closure regions and the stencil `inv_inner_stencil` in the interior. If -`inv_closure_stencils` is omitted, a central interior stencil with weight 1 is used. - -`inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}})` -constructs a diagonal inverse inner product operator where `closure_stencils` are the -closure stencils of `H` (not `H⁻¹`!). - -On a 1-dimensional `grid`, `H⁻¹` is a `VolumeOperator`. On a N-dimensional -`grid`, `H⁻¹` is the outer product of the 1-dimensional inverse inner product -operators in each coordinate direction. Also see the documentation of -`SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, -`H⁻¹` is a 0-dimensional `IdentityMapping`. -""" -function inverse_inner_product(grid::EquidistantGrid, inv_closure_stencils, inv_inner_stencil = CenteredStencil(one(eltype(grid)))) - h⁻¹ = inverse_spacing(grid) - H⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[1]),scale.(inv_closure_stencils,h⁻¹[1]),even,1) - for i ∈ 2:dimension(grid) - Hᵢ⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[i]),scale.(inv_closure_stencils,h⁻¹[i]),even,i) - H⁻¹ = H⁻¹∘Hᵢ⁻¹ - end - return H⁻¹ -end -export inverse_inner_product - -inverse_inner_product(grid::EquidistantGrid{0}, inv_closure_stencils, inv_inner_stencil) = IdentityMapping{eltype(grid)}() - -function inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) where {M,T} - inv_closure_stencils = reciprocal_stencil.(closure_stencils) - inv_inner_stencil = CenteredStencil(one(T)) - return inverse_inner_product(grid, inv_closure_stencils, inv_inner_stencil) -end - -reciprocal_stencil(s::Stencil{T}) where T = Stencil(s.range,one(T)./s.weights)
--- a/src/SbpOperators/volumeops/quadratures/quadrature.jl Sun Feb 14 13:52:13 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -""" - inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil) - -Creates the discrete inner product operator `H` as a `TensorMapping` on an equidistant -grid, defined as `(u,v) = u'Hv` for grid functions `u,v`. - -`inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil)` creates -`H` on `grid` the using a set of stencils `closure_stencils` for the points in -the closure regions and the stencil and `inner_stencil` in the interior. If -`inner_stencil` is omitted a central interior stencil with weight 1 is used. - -On a 1-dimensional `grid`, `H` is a `VolumeOperator`. On a N-dimensional -`grid`, `H` is the outer product of the 1-dimensional inner product operators in -each coordinate direction. Also see the documentation of -`SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, -`H` is a 0-dimensional `IdentityMapping`. -""" -function inner_product(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: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 inner_product - -inner_product(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}()