comparison 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
comparison
equal deleted inserted replaced
1975:79adad4a15d6 1976:34a7e3919e9a
128 @test c(π/2) ≈ [0,2] 128 @test c(π/2) ≈ [0,2]
129 @test c(π) ≈ [-2,0] 129 @test c(π) ≈ [-2,0]
130 @test c(3π/2) ≈ [0,-2] 130 @test c(3π/2) ≈ [0,-2]
131 @test c(π/4) ≈ [√(2),√(2)] 131 @test c(π/4) ≈ [√(2),√(2)]
132 end 132 end
133
134 @testset "Grids.jacobian" begin
135 c = Circle([0,0], 1)
136 @test Grids.jacobian(c, 0) ≈ [0,1]
137 @test Grids.jacobian(c, π/2) ≈ [-1,0]
138 @test Grids.jacobian(c, π) ≈ [0,-1]
139 @test Grids.jacobian(c, 3π/2) ≈ [1,0]
140 @test Grids.jacobian(c, π/4) ≈ [-1/√(2),1/√(2)]
141
142 c = Circle([0,0], 2)
143 @test Grids.jacobian(c, 0) ≈ [0,2]
144 @test Grids.jacobian(c, π/2) ≈ [-2,0]
145 @test Grids.jacobian(c, π) ≈ [0,-2]
146 @test Grids.jacobian(c, 3π/2) ≈ [2,0]
147 @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)]
148
149 c = Circle([-1,1], 1)
150 @test Grids.jacobian(c, 0) ≈ [0,1]
151 @test Grids.jacobian(c, π/2) ≈ [-1,0]
152 @test Grids.jacobian(c, π) ≈ [0,-1]
153 @test Grids.jacobian(c, 3π/2) ≈ [1,0]
154 @test Grids.jacobian(c, π/4) ≈ [-1/√(2),1/√(2)]
155
156 c = Circle([-1,1], 2)
157 @test Grids.jacobian(c, 0) ≈ [0,2]
158 @test Grids.jacobian(c, π/2) ≈ [-2,0]
159 @test Grids.jacobian(c, π) ≈ [0,-2]
160 @test Grids.jacobian(c, 3π/2) ≈ [2,0]
161 @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)]
162 end
133 end 163 end
134 164
135 @testset "TransfiniteInterpolationSurface" begin 165 @testset "TransfiniteInterpolationSurface" begin
136 @testset "Constructors" begin 166 @testset "Constructors" begin
137 @test TransfiniteInterpolationSurface(t->[1,2], t->[2,1], t->[0,0], t->[1,1]) isa TransfiniteInterpolationSurface 167 @test TransfiniteInterpolationSurface(t->[1,2], t->[2,1], t->[0,0], t->[1,1]) isa TransfiniteInterpolationSurface