Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
wave-2d: Add tmp variable so that we rotate buffers correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuper committed Nov 26, 2015
1 parent 3a7f6dc commit a9f7b2b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/wave-2d/wave-2d.jl
Expand Up @@ -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
Expand Down

0 comments on commit a9f7b2b

Please sign in to comment.