comparison test/Grids/manifolds_test.jl @ 1999:a1b2453c02c9 feature/grids/manifolds

Add check in jacobian for the coordinate to be in the parameterspace of the chart
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 25 Apr 2025 16:05:58 +0200
parents 6dd00ea0511a
children
comparison
equal deleted inserted replaced
1998:6dd00ea0511a 1999:a1b2453c02c9
13 bottom = CartesianBoundary{3, LowerBoundary} 13 bottom = CartesianBoundary{3, LowerBoundary}
14 top = CartesianBoundary{3, UpperBoundary} 14 top = CartesianBoundary{3, UpperBoundary}
15 15
16 @testset "Chart" begin 16 @testset "Chart" begin
17 X(ξ) = 2ξ 17 X(ξ) = 2ξ
18 Grids.jacobian(::typeof(X), ξ) = @SVector[2,2] 18 Grids.jacobian(::typeof(X), ξ) = @SMatrix[2 0; 0 2]
19 c = Chart(X, unitsquare()) 19 c = Chart(X, unitsquare())
20 @test c isa Chart{2} 20 @test c isa Chart{2}
21 @test parameterspace(c) == unitsquare() 21 @test parameterspace(c) == unitsquare()
22 @test ndims(c) == 2 22 @test ndims(c) == 2
23 23
25 c = Chart(X, unitsquare()) 25 c = Chart(X, unitsquare())
26 @test c([.3,.2]) == [.6,.4] 26 @test c([.3,.2]) == [.6,.4]
27 @test_throws DomainError c([3,2]) 27 @test_throws DomainError c([3,2])
28 end 28 end
29 29
30 @test jacobian(c, [3,2]) == [2,2] 30 @testset "jacobian(::Chart, ⋅)" begin
31 c = Chart(X, unitsquare())
32 @test_throws DomainError jacobian(c, [3,2])
33 @test jacobian(c, [.3,.2]) == [2 0; 0 2]
34 end
31 35
32 @test Set(boundary_identifiers(Chart(X,unitsquare()))) == Set([east(),west(),south(),north()]) 36 @test Set(boundary_identifiers(Chart(X,unitsquare()))) == Set([east(),west(),south(),north()])
33 end 37 end
34 38
35 @testset "CartesianAtlas" begin 39 @testset "CartesianAtlas" begin