Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 884:d228d1b26729 feature/variable_derivatives
Add tests for application
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 28 Jan 2022 10:37:57 +0100 |
parents | 9098fc936776 |
children | 069e58fb3829 |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl Fri Jan 21 13:20:33 2022 +0100 +++ b/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl Fri Jan 28 10:37:57 2022 +0100 @@ -47,18 +47,20 @@ LazyTensors.domain_size(op::SecondDerivativeVariable) = op.size function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Lower}) where T - return @inbounds apply_stencil(op.closure_stencils[Int(i)], v, Int(i)) + return @inbounds apply_stencil(op.closure_stencils[Int(i)], op.coefficient, v, Int(i)) end function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Interior}) where T - return apply_stencil(op.inner_stencil, v, Int(i)) + return apply_stencil(op.inner_stencil, op.coefficient, v, Int(i)) end function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Upper}) where T - return @inbounds Int(op.parity)*apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], v, Int(i)) + return @inbounds apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], op.coefficient, v, Int(i)) end function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i) where T r = getregion(i, closure_size(op), op.size[1]) return LazyTensors.apply(op, v, Index(i, r)) end + +# TODO: Rename SecondDerivativeVariable -> VariableSecondDerivative