Mercurial > repos > public > sbplib_julia
changeset 62:17b971a0b852 cell_based_test
Inline all the things
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Jan 2019 10:53:12 +0100 |
parents | 7ab0043aca53 |
children | cfe7d091aca2 |
files | diffOp.jl |
diffstat | 1 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
diff -r 7ab0043aca53 -r 17b971a0b852 diffOp.jl --- a/diffOp.jl Thu Jan 17 09:41:25 2019 +0100 +++ b/diffOp.jl Thu Jan 17 10:53:12 2019 +0100 @@ -38,8 +38,22 @@ Nx, Ny = D.grid.numberOfPointsPerDim + h = Grid.spacings(D.grid) + li = LinearIndices(D.grid.numberOfPointsPerDim) + ci = CartesianIndices(D.grid.numberOfPointsPerDim) + is = D.op.innerStencil for i ∈ view(li, 5:Nx-4, 5:Ny-4) - u[i] = apply(D, v, i) + I = ci[i] + + + u[i] = zero(eltype(v)) + for j ∈ is.range[1]:is.range[2] + u[i] += is[j]*v[(I[2]-1)*Nx - 1 + I[1]+j]/h[1]^2 + end + + for j ∈ is.range[1]:is.range[2] + u[i] += is[j]*v[(I[2]-1)*Nx - 1 + I[1]+ j*Nx]/h[2]^2 + end end return nothing @@ -81,10 +95,8 @@ ci = CartesianIndices(L.grid.numberOfPointsPerDim) I = ci[i] - # 2nd x-derivative - uᵢ = apply(L.op, h[1], view(v, li[:,I[2]]), I[1]) - # 2nd y-derivative - uᵢ += apply(L.op, h[2], view(v, li[I[1],:]), I[2]) + uᵢ = apply(L.op.innerStencil, view(v, li[:,I[2]]), I[1])/h[1]^2 + uᵢ += apply(L.op.innerStencil, view(v, li[I[1],:]), I[2])/h[2]^2 return uᵢ end