Mercurial > repos > public > sbplib_julia
comparison test/Grids/geometry_test.jl @ 2010:cf0fa2967361 feature/grids/geometry_functions
Add test for transfinite interpolation with a non-linear edge
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 01 May 2025 17:25:24 +0200 |
| parents | 486b3c6f919e |
| children | d0b6c63c506e |
comparison
equal
deleted
inserted
replaced
| 2009:fe217ad46f9b | 2010:cf0fa2967361 |
|---|---|
| 201 @test ti(1/2, 0) == (a+b)/2 | 201 @test ti(1/2, 0) == (a+b)/2 |
| 202 @test ti(1/2, 1) == (c+d)/2 | 202 @test ti(1/2, 1) == (c+d)/2 |
| 203 @test ti(0, 1/2) == (a+d)/2 | 203 @test ti(0, 1/2) == (a+d)/2 |
| 204 @test ti(1, 1/2) == (b+c)/2 | 204 @test ti(1, 1/2) == (b+c)/2 |
| 205 | 205 |
| 206 # TODO: Some test with curved edges? | 206 a, b, c, d = [0,0],[1,1/2],[1,3/2],[0,1] |
| 207 ti = TransfiniteInterpolationSurface( | |
| 208 t->@SVector[t, t^2/2], | |
| 209 LineSegment(b,c), | |
| 210 LineSegment(c,d), | |
| 211 LineSegment(d,a), | |
| 212 ) | |
| 213 | |
| 214 @test ti(0,0) == a | |
| 215 @test ti(1,0) == b | |
| 216 @test ti(1,1) == c | |
| 217 @test ti(0,1) == d | |
| 218 | |
| 219 @test ti(1/2, 0) == [1/2, 1/8] | |
| 220 @test ti(1/2, 1) == (c+d)/2 | |
| 221 @test ti(0, 1/2) == (a+d)/2 | |
| 222 @test ti(1, 1/2) == (b+c)/2 | |
| 207 end | 223 end |
| 208 | 224 |
| 209 @testset "check_transfiniteinterpolation" begin | 225 @testset "check_transfiniteinterpolation" begin |
| 210 cs = polygon_edges([0,0],[1,0],[1,1],[0,1]) | 226 cs = polygon_edges([0,0],[1,0],[1,1],[0,1]) |
| 211 ti = TransfiniteInterpolationSurface(cs...) | 227 ti = TransfiniteInterpolationSurface(cs...) |
| 266 mid(x,y) = (x+y)/2 | 282 mid(x,y) = (x+y)/2 |
| 267 @test Grids.jacobian(ti, [1/2, 0]) ≈ [b-a mid(c,d)-mid(a,b)] | 283 @test Grids.jacobian(ti, [1/2, 0]) ≈ [b-a mid(c,d)-mid(a,b)] |
| 268 @test Grids.jacobian(ti, [1/2, 1]) ≈ [c-d mid(c,d)-mid(a,b)] | 284 @test Grids.jacobian(ti, [1/2, 1]) ≈ [c-d mid(c,d)-mid(a,b)] |
| 269 @test Grids.jacobian(ti, [0, 1/2]) ≈ [mid(b,c)-mid(a,d) d-a] | 285 @test Grids.jacobian(ti, [0, 1/2]) ≈ [mid(b,c)-mid(a,d) d-a] |
| 270 @test Grids.jacobian(ti, [1, 1/2]) ≈ [mid(b,c)-mid(a,d) c-b] | 286 @test Grids.jacobian(ti, [1, 1/2]) ≈ [mid(b,c)-mid(a,d) c-b] |
| 271 | 287 end |
| 272 # TODO: Some test with curved edges? | 288 end |
| 273 end | |
| 274 end |
