comparison test/testSbpOperators.jl @ 703:988e9cfcd58d feature/laplace_opset

Add function for == comparison of the fields for a struct, and apply to Laplace tests
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 15 Feb 2021 17:20:03 +0100
parents 3cd582257072
children bf1387f867b8
comparison
equal deleted inserted replaced
702:3cd582257072 703:988e9cfcd58d
356 356
357 H_l = inner_product(boundary_grid(g_1D,id_l),op.quadratureClosure) 357 H_l = inner_product(boundary_grid(g_1D,id_l),op.quadratureClosure)
358 H_r = inner_product(boundary_grid(g_1D,id_r),op.quadratureClosure) 358 H_r = inner_product(boundary_grid(g_1D,id_r),op.quadratureClosure)
359 Hb_dict = Dict(Pair(id_l,H_l),Pair(id_r,H_r)) 359 Hb_dict = Dict(Pair(id_l,H_l),Pair(id_r,H_r))
360 360
361 # TODO: Not sure why this doesnt work? Comparing the fields of
362 # Laplace seems to work. Reformulate below once solved.
363 @test_broken Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict) == Laplace(g_1D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
364 L = Laplace(g_1D, sbp_operators_path()*"standard_diagonal.toml"; order=4) 361 L = Laplace(g_1D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
365 @test L.D == Δ 362 @test cmp_fields(L,Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict))
366 @test L.H == H
367 @test L.H_inv == Hi
368 @test L.e == e_dict
369 @test L.d == d_dict
370 @test L.H_boundary == Hb_dict
371
372 @test L isa TensorMapping{T,1,1} where T 363 @test L isa TensorMapping{T,1,1} where T
373 @inferred Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict) 364 @inferred Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict)
374 end 365 end
375 @testset "3D" begin 366 @testset "3D" begin
376 # Create all tensor mappings included in Laplace 367 # Create all tensor mappings included in Laplace
408 H_t = inner_product(boundary_grid(g_3D,id_t),op.quadratureClosure) 399 H_t = inner_product(boundary_grid(g_3D,id_t),op.quadratureClosure)
409 Hb_dict = Dict(Pair(id_l,H_l),Pair(id_r,H_r), 400 Hb_dict = Dict(Pair(id_l,H_l),Pair(id_r,H_r),
410 Pair(id_s,H_s),Pair(id_n,H_n), 401 Pair(id_s,H_s),Pair(id_n,H_n),
411 Pair(id_b,H_b),Pair(id_t,H_t)) 402 Pair(id_b,H_b),Pair(id_t,H_t))
412 403
413 # TODO: Not sure why this doesnt work? Comparing the fields of
414 # Laplace seems to work. Reformulate below once solved.
415 @test_broken Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict) == Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
416 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4) 404 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
417 @test L.D == Δ 405 @test cmp_fields(L,Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict))
418 @test L.H == H
419 @test L.H_inv == Hi
420 @test L.e == e_dict
421 @test L.d == d_dict
422 @test L.H_boundary == Hb_dict
423 @test L isa TensorMapping{T,3,3} where T 406 @test L isa TensorMapping{T,3,3} where T
424 @inferred Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict) 407 @inferred Laplace(Δ,H,Hi,e_dict,d_dict,Hb_dict)
425 end 408 end
426 end 409 end
427 410