Mercurial > repos > public > sbplib_julia
changeset 109:b3fbef345810 cell_based_test
Introduce apply! for given indices
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 08 Feb 2019 13:08:07 +0100 |
parents | d0a28888528a |
children | ee071b8ed58c |
files | diffOp.jl |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/diffOp.jl Fri Feb 08 12:47:21 2019 +0100 +++ b/diffOp.jl Fri Feb 08 13:08:07 2019 +0100 @@ -57,10 +57,15 @@ return nothing end -function apply!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T +@inline 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)) + apply!(D, u, v, r1, r2, regionindices(N, closuresize, (r1,r2))) + return nothing +end + +@inline function apply!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}, ri::CartesianIndices{2}) where T + for I ∈ ri @inbounds indextuple = (Index(I[1], r1), Index(I[2], r2)) @inbounds u[I] = apply(D, v, indextuple) end