Skip to content

Commit

Permalink
And unit tests for d2_...a macros
Browse files Browse the repository at this point in the history
  • Loading branch information
omlins authored Dec 13, 2023
1 parent 7515982 commit 71481d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/test_FiniteDifferences2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ end
@parallel d_ya!(R, Ay) = (@all(R) = @d_ya(Ay); return)
@parallel d_xi!(R, Axyy) = (@all(R) = @d_xi(Axyy); return)
@parallel d_yi!(R, Axxy) = (@all(R) = @d_yi(Axxy); return)
@parallel d2_xa!(R, Axx) = (@all(R) = @d2_xa(Axx); return)
@parallel d2_ya!(R, Ayy) = (@all(R) = @d2_ya(Ayy); return)
@parallel d2_xi!(R, Axxyy) = (@all(R) = @d2_xi(Axxyy); return)
@parallel d2_yi!(R, Axxyy) = (@all(R) = @d2_yi(Axxyy); return)
R.=0; @parallel d_xa!(R, Ax); @test all(Array(R .== Ax[2:end, :].-Ax[1:end-1, :]))
R.=0; @parallel d_ya!(R, Ay); @test all(Array(R .== Ay[ :,2:end].-Ay[ :,1:end-1]))
R.=0; @parallel d_xi!(R, Axyy); @test all(Array(R .== Axyy[2:end ,2:end-1].-Axyy[1:end-1,2:end-1]))
R.=0; @parallel d_yi!(R, Axxy); @test all(Array(R .== Axxy[2:end-1,2:end ].-Axxy[2:end-1,1:end-1]))
R.=0; @parallel d2_xa!(R, Axx); @test all(Array(R .== (Axx[3:end, :].-Axx[2:end-1, :]).-(Axx[2:end-1, :].-Axx[1:end-2, :])))
R.=0; @parallel d2_ya!(R, Ayy); @test all(Array(R .== (Ayy[ :,3:end].-Ayy[ :,2:end-1]).-(Ayy[ :,2:end-1].-Ayy[ :,1:end-2])))
R.=0; @parallel d2_xi!(R, Axxyy); @test all(Array(R .== (Axxyy[3:end,2:end-1].-Axxyy[2:end-1,2:end-1]).-(Axxyy[2:end-1,2:end-1].-Axxyy[1:end-2,2:end-1])))
R.=0; @parallel d2_yi!(R, Axxyy); @test all(Array(R .== (Axxyy[2:end-1,3:end].-Axxyy[2:end-1,2:end-1]).-(Axxyy[2:end-1,2:end-1].-Axxyy[2:end-1,1:end-2])))
end;
Expand Down

0 comments on commit 71481d0

Please sign in to comment.