Mercurial > repos > public > sbplib_julia
comparison test/Grids/mapped_grid_test.jl @ 1740:9f2bc8ea6a07 feature/grids/curvilinear
Add some tests for the getters
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 11 Sep 2024 09:03:55 +0200 |
parents | e1ae5d8e30c3 |
children | 248304f88e49 |
comparison
equal
deleted
inserted
replaced
1739:e1ae5d8e30c3 | 1740:9f2bc8ea6a07 |
---|---|
28 end | 28 end |
29 | 29 |
30 @testset "MappedGrid" begin | 30 @testset "MappedGrid" begin |
31 @testset "Constructor" begin | 31 @testset "Constructor" begin |
32 lg = equidistant_grid((0,0), (1,1), 11, 21) | 32 lg = equidistant_grid((0,0), (1,1), 11, 21) |
33 x̄ = map(ξ̄ -> 2ξ̄, lg) | 33 |
34 J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) | 34 |
35 mg = MappedGrid(lg, x̄, J) | 35 x̄ = map(ξ̄ -> 2ξ̄, lg) |
36 J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) | |
37 mg = MappedGrid(lg, x̄, J) | |
38 | |
39 @test mg isa Grid{SVector{2, Float64},2} | |
40 @test jacobian(mg) isa Array{<:AbstractMatrix} | |
41 @test logicalgrid(mg) isa Grid | |
42 | |
43 @test collect(mg) == x̄ | |
44 @test jacobian(mg) == J | |
45 @test logicalgrid(mg) == lg | |
36 | 46 |
37 # TODO: Test constructor for different dims of range and domain for the coordinates | 47 # TODO: Test constructor for different dims of range and domain for the coordinates |
38 # TODO: Test constructor with different type than TensorGrid. a dummy type? | 48 # TODO: Test constructor with different type than TensorGrid. a dummy type? |
39 # TODO: Test that the element types agree | 49 # TODO: Test that the element types agree |
40 | 50 |
41 @test_broken false # @test_throws ArgumentError("Sizes must match") MappedGrid(lg, map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11)) | 51 @test_broken false # @test_throws ArgumentError("Sizes must match") MappedGrid(lg, map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11)) |
42 | 52 |
43 | 53 |
44 @test mg isa Grid{SVector{2, Float64},2} | |
45 | |
46 @test jacobian(mg) isa Array{<:AbstractMatrix} | |
47 @test logicalgrid(mg) isa Grid | |
48 end | 54 end |
49 | 55 |
50 @testset "Indexing Interface" begin | 56 @testset "Indexing Interface" begin |
51 lg = equidistant_grid((0,0), (1,1), 11, 21) | 57 lg = equidistant_grid((0,0), (1,1), 11, 21) |
52 x̄ = map(ξ̄ -> 2ξ̄, lg) | 58 x̄ = map(ξ̄ -> 2ξ̄, lg) |