Permalink
Browse files

wave-2d: Add tmp variable so that we rotate buffers correctly.

  • Loading branch information...
lkuper committed Nov 26, 2015
1 parent 3a7f6dc commit a9f7b2b094a8658436e428c9b38fa0dc590c9cea
Showing with 5 additions and 3 deletions.
  1. +5 −3 examples/wave-2d/wave-2d.jl
@@ -97,9 +97,11 @@ function wave2d(demo::Bool)
f[1,s] = ( 2 * c[1,s] + (r-1) * p[1,s] + 2*r*r* ( c[2,s] + c[1,s-1] - 2*c[1,s] )) / (1+r) # X:1 ; Y:s
f[s,1] = ( 2 * c[s,1] + (r-1) * p[s,1] + 2*r*r* ( c[s-1,1] + c[s,2] - 2*c[s,1] )) / (1+r) # X:s ; Y:1
# TODO: figure out what's going on with the array assignment bug.
p[1:s, 1:s] = c[1:s, 1:s]
c[1:s, 1:s] = f[1:s, 1:s]
# Rotate buffers for next iteration
tmp = p
p = c
c = f
f = tmp
if (demo)
if mod( t / dt , 10 ) == 0

0 comments on commit a9f7b2b

Please sign in to comment.