|
391 | 391 |
|
392 | 392 | # THis testset uses the last testset which has a several non-trivial cases, |
393 | 393 | # and additionally tests coefficient handling. All operators are handled by the |
394 | | -# fast 2D/3D dispatch |
| 394 | +# fast 2D/3D dispatch. |
395 | 395 | @testset "2D coefficient handling" begin |
396 | 396 |
|
397 | 397 | dx = 0.1 |
|
449 | 449 |
|
450 | 450 | @test M_temp ≈ ((Lx2*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Lx3*M)[1:N,2:N+1] +(Ly3*M)[2:N+1,1:N] + (Lx4*M)[1:N,2:N+1] +(Ly4*M)[2:N+1,1:N]) |
451 | 451 | end |
| 452 | + |
| 453 | +@testset "x and y are both irregular grids" begin |
| 454 | + |
| 455 | + N = 100 |
| 456 | + dx = cumsum(rand(N+2)) |
| 457 | + dy = cumsum(rand(N+2)) |
| 458 | + M = zeros(N+2,N+2) |
| 459 | + |
| 460 | + for i in 1:N+2 |
| 461 | + for j in 1:N+2 |
| 462 | + M[i,j] = cos(dx[i])+sin(dy[j]) |
| 463 | + end |
| 464 | + end |
| 465 | + |
| 466 | + # Lx2 has 0 boundary points |
| 467 | + Lx2 = CenteredDifference{1}(2,2,dx,N) |
| 468 | + # Lx3 has 1 boundary point |
| 469 | + Lx3 = 1.45*CenteredDifference{1}(3,3,dx,N) |
| 470 | + # Lx4 has 2 boundary points |
| 471 | + Lx4 = CenteredDifference{1}(4,4,dx,N) |
| 472 | + |
| 473 | + # Ly2 has 0 boundary points |
| 474 | + Ly2 = 8.14*CenteredDifference{2}(2,2,dy,N) |
| 475 | + # Ly3 has 1 boundary point |
| 476 | + Ly3 = CenteredDifference{2}(3,3,dy,N) |
| 477 | + # Ly4 has 2 boundary points |
| 478 | + Ly4 = 4.567*CenteredDifference{2}(4,4,dy,N) |
| 479 | + |
| 480 | + |
| 481 | + |
| 482 | + # Test composition of all first-dimension operators |
| 483 | + A = Lx2+Lx3+Lx4 |
| 484 | + M_temp = zeros(N,N+2) |
| 485 | + @test_broken mul!(M_temp, A, M) |
| 486 | + @test_broken M_temp ≈ (Lx2*M + Lx3*M + Lx4*M) |
| 487 | + |
| 488 | + # Test composition of all second-dimension operators |
| 489 | + A = Ly2+Ly3+Ly4 |
| 490 | + M_temp = zeros(N+2,N) |
| 491 | + @test_broken mul!(M_temp, A, M) |
| 492 | + @test_broken M_temp ≈ (Ly2*M + Ly3*M + Ly4*M) |
| 493 | + |
| 494 | + # Test composition of all operators |
| 495 | + A = Lx2+Lx3+Lx4+Ly2+Ly3+Ly4 |
| 496 | + M_temp = zeros(N,N) |
| 497 | + @test_broken mul!(M_temp, A, M) |
| 498 | + @test_broken M_temp = ((Lx2*M)[1:N,2:N+1]+(Lx3*M)[1:N,2:N+1]+(Lx4*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Ly3*M)[2:N+1,1:N]+(Ly4*M)[2:N+1,1:N]) |
| 499 | + |
| 500 | +end |
0 commit comments