Mercurial > repos > public > sbplib_julia
comparison sbpD2.jl @ 61:8a7a537f54e5 default_perf_test
Only do inner stencil
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Jan 2019 09:44:06 +0100 |
parents | 8c4cfa680e5a |
children |
comparison
equal
deleted
inserted
replaced
59:60d575e4a2d8 | 61:8a7a537f54e5 |
---|---|
2 | 2 |
3 function apply!(op::ConstantStencilOperator, u::AbstractVector, v::AbstractVector, h::Real) | 3 function apply!(op::ConstantStencilOperator, u::AbstractVector, v::AbstractVector, h::Real) |
4 N = length(v) | 4 N = length(v) |
5 cSize = closureSize(op) | 5 cSize = closureSize(op) |
6 | 6 |
7 for i ∈ range(1; length=cSize) | |
8 u[i] = apply(op.closureStencils[i], v, i)/h^2 | |
9 end | |
10 | |
11 innerStart = 1 + cSize | 7 innerStart = 1 + cSize |
12 innerEnd = N - cSize | 8 innerEnd = N - cSize |
13 for i ∈ range(innerStart, stop=innerEnd) | 9 for i ∈ range(innerStart, stop=innerEnd) |
14 u[i] = apply(op.innerStencil, v, i)/h^2 | 10 u[i] = apply(op.innerStencil, v, i)/h^2 |
15 end | |
16 | |
17 for i ∈ range(innerEnd+1, length=cSize) | |
18 u[i] = Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 | |
19 end | 11 end |
20 | 12 |
21 return nothing | 13 return nothing |
22 end | 14 end |
23 | 15 |