comparison diffOp.jl @ 107:e3e32299fe72 cell_based_test

Replace loop in appl!(::Laplace) to avoid allocations
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 08 Feb 2019 11:17:27 +0100
parents 8010aadc4ff1
children d0a28888528a
comparison
equal deleted inserted replaced
106:8010aadc4ff1 107:e3e32299fe72
66 uᵢ = L.a * apply(L.op, h, v, i) 66 uᵢ = L.a * apply(L.op, h, v, i)
67 return uᵢ 67 return uᵢ
68 end 68 end
69 69
70 function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T 70 function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T
71 regions = (Lower, Interior, Upper) 71 apply!(L, u, v, Lower, Lower)
72 for r1 ∈ regions 72 apply!(L, u, v, Lower, Interior)
73 for r2 ∈ regions 73 apply!(L, u, v, Lower, Upper)
74 apply!(L, u, v, r1, r2) 74 apply!(L, u, v, Interior, Lower)
75 end 75 apply!(L, u, v, Interior, Interior)
76 end 76 apply!(L, u, v, Interior, Upper)
77 apply!(L, u, v, Upper, Lower)
78 apply!(L, u, v, Upper, Interior)
79 apply!(L, u, v, Upper, Upper)
77 return nothing 80 return nothing
78 end 81 end
79 82
80 function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T 83 function apply!(L::Laplace{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T
81 N = L.grid.numberOfPointsPerDim 84 N = L.grid.numberOfPointsPerDim