Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 42:c061d1bddba5
Merge latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 10 Jan 2019 16:49:20 +0100 |
parents | bb841977d198 |
children | ef060ab3b035 |
comparison
equal
deleted
inserted
replaced
41:3d8bfb695497 | 42:c061d1bddba5 |
---|---|
1 abstract type DiffOp end | 1 abstract type DiffOp end |
2 | 2 |
3 function apply(D::DiffOp, v::AbstractVector) | 3 function apply!(D::DiffOp, u::AbstractVector, v::AbstractVector) |
4 error("not implemented") | 4 error("not implemented") |
5 end | 5 end |
6 | 6 |
7 function innerProduct(D::DiffOp, u::AbstractVector, v::AbstractVector)::Real | 7 function innerProduct(D::DiffOp, u::AbstractVector, v::AbstractVector)::Real |
8 error("not implemented") | 8 error("not implemented") |
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) | 36 h = scaling(L.grid) |
37 | 37 |
38 for i ∈ 1:N | 38 apply!(L.op, u, v, grid.spacings(L.grid)[1], 1, L.grid.numberOfPointsPerDim, stride=1) |
39 u[i] = apply(L.op.closureStencils[i], v, i)/h^2 | |
40 end | |
41 | |
42 for i ∈ N+1:M-N | |
43 u[i] = apply(L.op.innerStencil, i)/h^2 | |
44 end | |
45 | |
46 for i ∈ M:-1:M-N+1 | |
47 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i)/h^2 | |
48 end | |
49 | |
50 return nothing | 39 return nothing |
51 end | 40 end |