Mercurial > repos > public > sbplib_julia
comparison sbpD2.jl @ 94:84b1ad5a3755 stencil_index
Made everything work(?) but also go really slow. And also not type-stable.
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Mon, 04 Feb 2019 16:09:07 +0100 |
parents | 93df72e2b135 |
children |
comparison
equal
deleted
inserted
replaced
93:93df72e2b135 | 94:84b1ad5a3755 |
---|---|
13 end | 13 end |
14 | 14 |
15 return uᵢ | 15 return uᵢ |
16 end | 16 end |
17 | 17 |
18 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::InteriorIndex) | 18 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::StencilIndex{Interior}) |
19 return apply(op.innerStencil, v, i)/h^2 | 19 return apply(op.innerStencil, v, i)/h^2 |
20 end | 20 end |
21 | 21 |
22 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::LowerClosureIndex) | 22 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::StencilIndex{Lower}) |
23 return apply(op.closureStencils[i], v, i)/h^2 | 23 return apply(op.closureStencils[i], v, i)/h^2 |
24 end | 24 end |
25 | 25 |
26 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::UpperClosureIndex) | 26 Base.@propagate_inbounds function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int, ::StencilIndex{Upper}) |
27 N = length(v) | 27 N = length(v) |
28 return Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 #TODO: Write an applybackwards instead? | 28 return Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 #TODO: Write an applybackwards instead? |
29 end | 29 end |
30 | 30 |
31 @enum Parity begin | 31 @enum Parity begin |