Mercurial > repos > public > sbplib_julia
comparison test/testSbpOperators.jl @ 566:fe026b4f99ec feature/boundary_ops
Simplify tests abit
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 01 Dec 2020 13:22:38 +0100 |
parents | 15423a868d28 |
children | d14d8de27546 |
comparison
equal
deleted
inserted
replaced
565:15423a868d28 | 566:fe026b4f99ec |
---|---|
237 @test_throws BoundsError (e_l*v)[2] | 237 @test_throws BoundsError (e_l*v)[2] |
238 @test_throws BoundsError (e_l'*u)[5] | 238 @test_throws BoundsError (e_l'*u)[5] |
239 | 239 |
240 # 2D | 240 # 2D |
241 v = zeros(Float64, 4, 5) | 241 v = zeros(Float64, 4, 5) |
242 v[:,5] = [1, 2, 3,4] | 242 v[:,5] = [1, 2, 3, 4] |
243 v[:,4] = [1, 2, 3,4] | 243 v[:,4] = [1, 2, 3, 4] |
244 v[:,3] = [4, 5, 6, 7] | 244 v[:,3] = [4, 5, 6, 7] |
245 v[:,2] = [7, 8, 9, 10] | 245 v[:,2] = [7, 8, 9, 10] |
246 v[:,1] = [10, 11, 12, 13] | 246 v[:,1] = [10, 11, 12, 13] |
247 | 247 |
248 @test e_w*v == [10,7,4,1.0,1] | 248 @test e_w*v == v[1,:] |
249 @test e_e*v == [13,10,7,4,4.0] | 249 @test e_e*v == v[end,:] |
250 @test e_s*v == [10,11,12,13.0] | 250 @test e_s*v == v[:,1] |
251 @test e_n*v == [1,2,3,4.0] | 251 @test e_n*v == v[:,end] |
252 | 252 |
253 I_w = [(Index{Lower}(1),), | 253 I_w = [ |
254 (Index{Interior}(2),), | 254 Index{Lower}(1), |
255 (Index{Interior}(3),), | 255 Index{Interior}(2), |
256 (Index{Interior}(4),), | 256 Index{Interior}(3), |
257 (Index{Upper}(5),)] | 257 Index{Interior}(4), |
258 Index{Upper}(5), | |
259 ] | |
258 for i = 1:length(I_w) | 260 for i = 1:length(I_w) |
259 @test (e_w*v)[I_w[i]...] == [10,7,4,1.0,1][i]; | 261 @test (e_w*v)[I_w[i]] == v[1,i]; |
260 end | 262 end |
261 | 263 |
262 g_x = [1,2,3,4.0] | 264 g_x = [1., 2., 3., 4.] |
263 g_y = [5,4,3,2,1.0] | 265 g_y = [5., 4., 3., 2., 1.] |
264 | 266 |
265 G_w = zeros(Float64, (4,5)) | 267 G_w = zeros(Float64, (4,5)) |
266 G_w[1,:] = g_y | 268 G_w[1,:] = g_y |
267 | 269 |
268 G_e = zeros(Float64, (4,5)) | 270 G_e = zeros(Float64, (4,5)) |