diff diffOp.jl @ 118:4c0c02a80cd4 cell_based_test

Change uview to view. It seems the compiler is now able to remove the allocation
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 12 Feb 2019 13:15:16 +0100
parents ff7f377433b4
children 631eb9b35d72
line wrap: on
line diff
--- a/diffOp.jl	Tue Feb 12 13:13:03 2019 +0100
+++ b/diffOp.jl	Tue Feb 12 13:15:16 2019 +0100
@@ -119,14 +119,13 @@
     return uᵢ
 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)
     # 2nd x-derivative
-    @inbounds vx = uview(v, :, Int(I[2]))
+    @inbounds vx = view(v, :, Int(I[2]))
     @inbounds uᵢ = L.a*apply(L.op, h[1], vx , I[1])
     # 2nd y-derivative
-    @inbounds vy = uview(v, Int(I[1]), :)
+    @inbounds vy = view(v, Int(I[1]), :)
     @inbounds uᵢ += L.a*apply(L.op, h[2], vy, I[2])
     return uᵢ
 end