Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 6529c42

Browse files
committed
last set of tests added - regular and irregular grid operators mixing on the same grid
1 parent 22308ab commit 6529c42

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/2D_3D_fast_multiplication.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ end
501501

502502
N = 100
503503
dx = 0.25
504+
dx_vec = 0.25:0.25:(N+2)*0.25
504505
dy = cumsum(rand(N+2))
505506
M = zeros(N+2,N+2)
506507

@@ -542,12 +543,30 @@ end
542543
mul!(M_temp, A, M)
543544
@test 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])
544545

546+
# Last case where we now have some `irregular-grid` operators operating on the
547+
# regular-spaced axis x
548+
549+
# These operators are operating on the regular grid x, but are constructed as though
550+
# they were irregular grid operators. Hence we test if we can seperate irregular and
551+
# regular gird operators on the same axis
552+
# Lx2 has 0 boundary points
553+
_Lx2 = 4.532*CenteredDifference{1}(2,2,dx_vec,N)
554+
# Lx3 has 1 boundary point
555+
_Lx3 = 0.235*CenteredDifference{1}(3,3,dx_vec,N)
556+
# Lx4 has 2 boundary points
557+
_Lx4 = CenteredDifference{1}(4,4,dx_vec,N)
558+
559+
A += _Lx2 + _Lx3 + _Lx4
560+
mul!(M_temp, A, M)
561+
@test M_temp ((_Lx2*M)[1:N,2:N+1]+(_Lx3*M)[1:N,2:N+1]+(_Lx4*M)[1:N,2:N+1]+(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])
562+
545563
end
546564

547565
@testset "irregular x grid and regular y grid (dy = 0.25)" begin
548566

549567
N = 100
550568
dy = 0.25
569+
dy_vec = 0.25:0.25:(N+2)*0.25
551570
dx = cumsum(rand(N+2))
552571
M = zeros(N+2,N+2)
553572

@@ -589,4 +608,21 @@ end
589608
mul!(M_temp, A, M)
590609
@test 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])
591610

611+
# Last case where we now have some `irregular-grid` operators operating on the
612+
# regular-spaced axis y
613+
614+
# These operators are operating on the regular grid y, but are constructed as though
615+
# they were irregular grid operators. Hence we test if we can seperate irregular and
616+
# regular gird operators on the same axis
617+
# Ly2 has 0 boundary points
618+
_Ly2 = CenteredDifference{2}(2,2,dy_vec,N)
619+
# Ly3 has 1 boundary point
620+
_Ly3 = CenteredDifference{2}(3,3,dy_vec,N)
621+
# Ly4 has 2 boundary points
622+
_Ly4 = 12.1*CenteredDifference{2}(4,4,dy_vec,N)
623+
624+
A += _Ly2 + _Ly3 + _Ly4
625+
mul!(M_temp, A, M)
626+
@test 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]+(_Ly2*M)[2:N+1,1:N]+(_Ly3*M)[2:N+1,1:N]+(_Ly4*M)[2:N+1,1:N])
627+
592628
end

0 commit comments

Comments
 (0)