Mercurial > repos > public > sbplib_julia
changeset 647:f13d45c10f55 feature/volume_and_boundary_operators
Remove ConstantStencilOperator
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 04 Jan 2021 18:38:21 +0100 |
parents | 27b4bcb22154 |
children | d6edde60909b |
files | src/SbpOperators/SbpOperators.jl src/SbpOperators/constantstenciloperator.jl src/SbpOperators/d2.jl |
diffstat | 3 files changed, 1 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/SbpOperators.jl Mon Jan 04 18:34:38 2021 +0100 +++ b/src/SbpOperators/SbpOperators.jl Mon Jan 04 18:38:21 2021 +0100 @@ -5,7 +5,6 @@ using Sbplib.Grids include("stencil.jl") -include("constantstenciloperator.jl") include("d2.jl") include("readoperator.jl") include("volumeops/volume_operator.jl")
--- a/src/SbpOperators/constantstenciloperator.jl Mon Jan 04 18:34:38 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -abstract type ConstantStencilOperator end - -# Apply for different regions Lower/Interior/Upper or Unknown region -@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Lower}) - return @inbounds h_inv*h_inv*apply_stencil(op.closureStencils[Int(i)], v, Int(i)) -end - -@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Interior}) - return @inbounds h_inv*h_inv*apply_stencil(op.innerStencil, v, Int(i)) -end - -@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Upper}) - N = length(v) - return @inbounds h_inv*h_inv*Int(op.parity)*apply_stencil_backwards(op.closureStencils[N-Int(i)+1], v, Int(i)) -end - -@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i) - N = length(v) - r = getregion(Int(index), closuresize(op), N) - i = Index(Int(index), r) - return apply_2nd_derivative(op, h_inv, v, i) -end -export apply_2nd_derivative - -apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Lower}, N::Integer) where T = v*h*op.quadratureClosure[Int(i)] -apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Upper}, N::Integer) where T = v*h*op.quadratureClosure[N-Int(i)+1] -apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h - -function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i, N::Integer) where T - r = getregion(i, closuresize(op), N) - return apply_quadrature(op, h, v, Index(i, r), N) -end -export apply_quadrature - -# TODO: Evaluate if divisions affect performance -apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Lower}, N::Integer) where T = h_inv*v/op.quadratureClosure[Int(i)] -apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Upper}, N::Integer) where T = h_inv*v/op.quadratureClosure[N-Int(i)+1] -apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h_inv - -function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i, N::Integer) where T - r = getregion(i, closuresize(op), N) - return apply_inverse_quadrature(op, h_inv, v, Index(i, r), N) -end - -export apply_inverse_quadrature - -function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Lower}) - @boundscheck if length(v) < closuresize(op) - throw(BoundsError()) - end - h_inv*apply_stencil(op.dClosure,v,1) -end - -function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Upper}) - @boundscheck if length(v) < closuresize(op) - throw(BoundsError()) - end - -h_inv*apply_stencil_backwards(op.dClosure,v,length(v)) -end - -export apply_normal_derivative_transpose - -function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i, N::Integer, ::Type{Lower}) - @boundscheck if !(0<length(Int(i)) <= N) - throw(BoundsError()) - end - h_inv*op.dClosure[Int(i)-1]*v -end - -function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i, N::Integer, ::Type{Upper}) - @boundscheck if !(0<length(Int(i)) <= N) - throw(BoundsError()) - end - -h_inv*op.dClosure[N-Int(i)]*v -end - -export apply_normal_derivative