comparison 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
comparison
equal deleted inserted replaced
883:61f5850ca456 884:d228d1b26729
45 45
46 LazyTensors.range_size(op::SecondDerivativeVariable) = op.size 46 LazyTensors.range_size(op::SecondDerivativeVariable) = op.size
47 LazyTensors.domain_size(op::SecondDerivativeVariable) = op.size 47 LazyTensors.domain_size(op::SecondDerivativeVariable) = op.size
48 48
49 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Lower}) where T 49 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Lower}) where T
50 return @inbounds apply_stencil(op.closure_stencils[Int(i)], v, Int(i)) 50 return @inbounds apply_stencil(op.closure_stencils[Int(i)], op.coefficient, v, Int(i))
51 end 51 end
52 52
53 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Interior}) where T 53 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Interior}) where T
54 return apply_stencil(op.inner_stencil, v, Int(i)) 54 return apply_stencil(op.inner_stencil, op.coefficient, v, Int(i))
55 end 55 end
56 56
57 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Upper}) where T 57 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i::Index{Upper}) where T
58 return @inbounds Int(op.parity)*apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], v, Int(i)) 58 return @inbounds apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], op.coefficient, v, Int(i))
59 end 59 end
60 60
61 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i) where T 61 function LazyTensors.apply(op::SecondDerivativeVariable{T}, v::AbstractVector{T}, i) where T
62 r = getregion(i, closure_size(op), op.size[1]) 62 r = getregion(i, closure_size(op), op.size[1])
63 return LazyTensors.apply(op, v, Index(i, r)) 63 return LazyTensors.apply(op, v, Index(i, r))
64 end 64 end
65
66 # TODO: Rename SecondDerivativeVariable -> VariableSecondDerivative