Mercurial > repos > public > sbplib_julia
comparison sbpD2.jl @ 60:7ab0043aca53 cell_based_test
Only do inner stencil
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Jan 2019 09:41:25 +0100 |
parents | 27a8d3021a1c |
children |
comparison
equal
deleted
inserted
replaced
57:178a203f3e6d | 60:7ab0043aca53 |
---|---|
2 | 2 |
3 function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int) | 3 function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int) |
4 cSize = closureSize(op) | 4 cSize = closureSize(op) |
5 N = length(v) | 5 N = length(v) |
6 | 6 |
7 if i ∈ range(1; length=cSize) | 7 uᵢ = apply(op.innerStencil, v, i)/h^2 |
8 uᵢ = apply(op.closureStencils[i], v, i)/h^2 | |
9 elseif i ∈ range(N - cSize+1, length=cSize) | |
10 uᵢ = Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 | |
11 else | |
12 uᵢ = apply(op.innerStencil, v, i)/h^2 | |
13 end | |
14 | 8 |
15 return uᵢ | 9 return uᵢ |
16 end | 10 end |
17 | 11 |
18 @enum Parity begin | 12 @enum Parity begin |