Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 9:aafc4bdbe675
Add h in stencil application
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 17 Dec 2018 14:44:17 +0100 |
parents | 433008d3b7d3 |
children | 10a5e7c77fb8 |
comparison
equal
deleted
inserted
replaced
8:433008d3b7d3 | 9:aafc4bdbe675 |
---|---|
27 a | 27 a |
28 op | 28 op |
29 end | 29 end |
30 | 30 |
31 # u = L*v | 31 # u = L*v |
32 function apply(L::Laplace1D, u::AbstractVector, v::AbstractVector)::AbstractVector | 32 function apply(L::Laplace1D, u::AbstractVector, v::AbstractVector) |
33 N = closureSize(L.op) | 33 N = closureSize(L.op) |
34 M = length(v) | 34 M = length(v) |
35 | 35 |
36 h = scaling(L.grid) | |
37 | |
36 for i ∈ 1:N | 38 for i ∈ 1:N |
37 u[i] = apply(L.op.closureStencils[i], v, i) | 39 u[i] = apply(L.op.closureStencils[i], v, i)/h^2 |
38 end | 40 end |
39 | 41 |
40 for i ∈ N+1:M-N | 42 for i ∈ N+1:M-N |
41 u[i] = apply(L.op.innerStencil, i); | 43 u[i] = apply(L.op.innerStencil, i)/h^2 |
42 end | 44 end |
43 | 45 |
44 for i ∈ M:-1:M-N+1 | 46 for i ∈ M:-1:M-N+1 |
45 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i) | 47 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i)/h^2 |
46 end | 48 end |
49 | |
50 return nothing | |
47 end | 51 end |