Mercurial > repos > public > sbplib_julia
changeset 108:d0a28888528a cell_based_test
Change input type of apply(::Laplace) to ::DiffOpCartesian
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 08 Feb 2019 12:47:21 +0100 |
parents | e3e32299fe72 |
children | b3fbef345810 |
files | diffOp.jl |
diffstat | 1 files changed, 23 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/diffOp.jl Fri Feb 08 11:17:27 2019 +0100 +++ b/diffOp.jl Fri Feb 08 12:47:21 2019 +0100 @@ -44,6 +44,29 @@ return nothing end +function apply!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T + apply!(D, u, v, Lower, Lower) + apply!(D, u, v, Lower, Interior) + apply!(D, u, v, Lower, Upper) + apply!(D, u, v, Interior, Lower) + apply!(D, u, v, Interior, Interior) + apply!(D, u, v, Interior, Upper) + apply!(D, u, v, Upper, Lower) + apply!(D, u, v, Upper, Interior) + apply!(D, u, v, Upper, Upper) + return nothing +end + +function apply!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T + N = D.grid.numberOfPointsPerDim + closuresize = closureSize(D.op) + for I ∈ regionindices(N, closuresize, (r1,r2)) + @inbounds indextuple = (Index(I[1], r1), Index(I[2], r2)) + @inbounds u[I] = apply(D, v, indextuple) + end + return nothing +end + function apply(D::DiffOp, v::AbstractVector)::AbstractVector u = zeros(eltype(v), size(v)) apply!(D,v,u) @@ -67,29 +90,6 @@ return uᵢ end -function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T - apply!(L, u, v, Lower, Lower) - apply!(L, u, v, Lower, Interior) - apply!(L, u, v, Lower, Upper) - apply!(L, u, v, Interior, Lower) - apply!(L, u, v, Interior, Interior) - apply!(L, u, v, Interior, Upper) - apply!(L, u, v, Upper, Lower) - apply!(L, u, v, Upper, Interior) - apply!(L, u, v, Upper, Upper) - return nothing -end - -function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T - N = L.grid.numberOfPointsPerDim - closuresize = closureSize(L.op) - for I ∈ regionindices(N, closuresize, (r1,r2)) - @inbounds indextuple = (Index(I[1], r1), Index(I[2], r2)) - @inbounds u[I] = apply(L, v, indextuple) - end - return nothing -end - using UnsafeArrays function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, I::Tuple{Index{R1}, Index{R2}}) where {R1, R2} h = Grid.spacings(L.grid)