Mercurial > repos > public > sbplib_julia
diff test/Grids/geometry_test.jl @ 1976:34a7e3919e9a feature/grids/geometry_functions
Implement Grids.jacobian for Circle
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 25 Feb 2025 22:48:42 +0100 |
parents | 79adad4a15d6 |
children | 270675bb97be |
line wrap: on
line diff
--- a/test/Grids/geometry_test.jl Tue Feb 25 22:42:14 2025 +0100 +++ b/test/Grids/geometry_test.jl Tue Feb 25 22:48:42 2025 +0100 @@ -130,6 +130,36 @@ @test c(3π/2) ≈ [0,-2] @test c(π/4) ≈ [√(2),√(2)] end + + @testset "Grids.jacobian" begin + c = Circle([0,0], 1) + @test Grids.jacobian(c, 0) ≈ [0,1] + @test Grids.jacobian(c, π/2) ≈ [-1,0] + @test Grids.jacobian(c, π) ≈ [0,-1] + @test Grids.jacobian(c, 3π/2) ≈ [1,0] + @test Grids.jacobian(c, π/4) ≈ [-1/√(2),1/√(2)] + + c = Circle([0,0], 2) + @test Grids.jacobian(c, 0) ≈ [0,2] + @test Grids.jacobian(c, π/2) ≈ [-2,0] + @test Grids.jacobian(c, π) ≈ [0,-2] + @test Grids.jacobian(c, 3π/2) ≈ [2,0] + @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)] + + c = Circle([-1,1], 1) + @test Grids.jacobian(c, 0) ≈ [0,1] + @test Grids.jacobian(c, π/2) ≈ [-1,0] + @test Grids.jacobian(c, π) ≈ [0,-1] + @test Grids.jacobian(c, 3π/2) ≈ [1,0] + @test Grids.jacobian(c, π/4) ≈ [-1/√(2),1/√(2)] + + c = Circle([-1,1], 2) + @test Grids.jacobian(c, 0) ≈ [0,2] + @test Grids.jacobian(c, π/2) ≈ [-2,0] + @test Grids.jacobian(c, π) ≈ [0,-2] + @test Grids.jacobian(c, 3π/2) ≈ [2,0] + @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)] + end end @testset "TransfiniteInterpolationSurface" begin