comparison SbpOperators/src/constantstenciloperator.jl @ 317:75c61d927153

Merge
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 09 Sep 2020 22:00:13 +0200
parents 36206445018b
children
comparison
equal deleted inserted replaced
316:d244f2e5f822 317:75c61d927153
44 return apply_inverse_quadrature(op, h_inv, v, i, N) 44 return apply_inverse_quadrature(op, h_inv, v, i, N)
45 end 45 end
46 46
47 export apply_inverse_quadrature 47 export apply_inverse_quadrature
48 48
49 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Lower})
50 @boundscheck if length(v) < closuresize(op)
51 throw(BoundsError())
52 end
53 apply_stencil(op.eClosure,v,1)
54 end
55
56 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Upper})
57 @boundscheck if length(v) < closuresize(op)
58 throw(BoundsError())
59 end
60 apply_stencil_backwards(op.eClosure,v,length(v))
61 end
62 export apply_boundary_value_transpose
63
64 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Lower})
65 @boundscheck if !(0<length(Int(i)) <= N)
66 throw(BoundsError())
67 end
68 op.eClosure[Int(i)-1]*v
69 end
70
71 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Upper})
72 @boundscheck if !(0<length(Int(i)) <= N)
73 throw(BoundsError())
74 end
75 op.eClosure[N-Int(i)]*v
76 end
77 export apply_boundary_value
78
79 function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Lower}) 49 function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Lower})
80 @boundscheck if length(v) < closuresize(op) 50 @boundscheck if length(v) < closuresize(op)
81 throw(BoundsError()) 51 throw(BoundsError())
82 end 52 end
83 h_inv*apply_stencil(op.dClosure,v,1) 53 h_inv*apply_stencil(op.dClosure,v,1)