Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/constantstenciloperator.jl @ 562:8f7919a9b398 feature/boundary_ops
Merge with default
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 30 Nov 2020 18:30:24 +0100 |
parents | d1929491180b |
children |
line wrap: on
line diff
--- a/src/SbpOperators/constantstenciloperator.jl Thu Nov 26 09:03:54 2020 +0100 +++ b/src/SbpOperators/constantstenciloperator.jl Mon Nov 30 18:30:24 2020 +0100 @@ -14,7 +14,7 @@ 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, index::Index{Unknown}) +@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) @@ -26,10 +26,9 @@ 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, index::Index{Unknown}, N::Integer) where T - r = getregion(Int(index), closuresize(op), N) - i = Index(Int(index), r) - return apply_quadrature(op, h, v, i, N) +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 @@ -38,10 +37,9 @@ 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, index::Index{Unknown}, N::Integer) where T - r = getregion(Int(index), closuresize(op), N) - i = Index(Int(index), r) - return apply_inverse_quadrature(op, h_inv, v, i, N) +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 @@ -62,14 +60,14 @@ export apply_normal_derivative_transpose -function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i::Index, N::Integer, ::Type{Lower}) +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::Index, N::Integer, ::Type{Upper}) +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