changeset 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 fe217ad46f9b
children d0b6c63c506e
files test/Grids/geometry_test.jl
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/Grids/geometry_test.jl	Thu May 01 15:09:13 2025 +0200
+++ b/test/Grids/geometry_test.jl	Thu May 01 17:25:24 2025 +0200
@@ -203,7 +203,23 @@
         @test ti(0, 1/2) == (a+d)/2
         @test ti(1, 1/2) == (b+c)/2
 
-        # TODO: Some test with curved edges?
+        a, b, c, d = [0,0],[1,1/2],[1,3/2],[0,1]
+        ti = TransfiniteInterpolationSurface(
+            t->@SVector[t, t^2/2],
+            LineSegment(b,c),
+            LineSegment(c,d),
+            LineSegment(d,a),
+        )
+
+        @test ti(0,0) == a
+        @test ti(1,0) == b
+        @test ti(1,1) == c
+        @test ti(0,1) == d
+
+        @test ti(1/2, 0) == [1/2, 1/8]
+        @test ti(1/2, 1) == (c+d)/2
+        @test ti(0, 1/2) == (a+d)/2
+        @test ti(1, 1/2) == (b+c)/2
     end
 
     @testset "check_transfiniteinterpolation" begin
@@ -268,7 +284,5 @@
         @test Grids.jacobian(ti, [1/2, 1]) ≈ [c-d mid(c,d)-mid(a,b)]
         @test Grids.jacobian(ti, [0, 1/2]) ≈ [mid(b,c)-mid(a,d) d-a]
         @test Grids.jacobian(ti, [1, 1/2]) ≈ [mid(b,c)-mid(a,d) c-b]
-
-        # TODO: Some test with curved edges?
     end
 end