comparison sbpD2.jl @ 91:c0f33eccd527 cell_based_test

Create types StencilIndex, LowerClosureIndex, UpperClosureIndex and InteriorIndex. First attempt at seperating out interior and closure indices from. Not fully implemented.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 29 Jan 2019 14:32:28 +0100
parents 8d505e9bc715
children 93df72e2b135
comparison
equal deleted inserted replaced
85:8d505e9bc715 91:c0f33eccd527
11 else 11 else
12 @inbounds uᵢ = apply(op.innerStencil, v, i)/h^2 12 @inbounds uᵢ = apply(op.innerStencil, v, i)/h^2
13 end 13 end
14 14
15 return uᵢ 15 return uᵢ
16 end
17
18 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::InteriorIndex)
19 return apply(op.innerStencil, v, i)/h^2
20 end
21
22 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::LowerClosureIndex)
23 return apply(op.closureStencils[i], v, i)/h^2
24 end
25
26 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::UpperClosureIndex)
27 return Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 #TODO: Write an applybackwards instead?
16 end 28 end
17 29
18 @enum Parity begin 30 @enum Parity begin
19 odd = -1 31 odd = -1
20 even = 1 32 even = 1