diff src/Grids/geometry.jl @ 1973:8e9575b518a1 feature/grids/geometry_functions

Add tests for TransfiniteInterpolationSurface and implemnet check_tranfiniteinterpolation
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 14 Feb 2025 22:19:06 +0100
parents 9e89084cbba4
children 3ed7ca1f60c4
line wrap: on
line diff
--- a/src/Grids/geometry.jl	Fri Feb 14 08:32:12 2025 +0100
+++ b/src/Grids/geometry.jl	Fri Feb 14 22:19:06 2025 +0100
@@ -83,6 +83,33 @@
     s(ξ̄...)
 end
 
+function check_transfiniteinterpolation(s::TransfiniteInterpolationSurface)
+    if check_transfiniteinterpolation(Bool, s)
+        return nothing
+    else
+        error("The end of each curve in the transfinite interpolation should be the same as the beginning of the next curve.")
+    end
+end
+
+function check_transfiniteinterpolation(::Type{Bool}, s::TransfiniteInterpolationSurface)
+    if !isapprox(s.c₁(1), s.c₂(0))
+        return false
+    end
+
+    if !isapprox(s.c₂(1), s.c₃(0))
+        return false
+    end
+
+    if !isapprox(s.c₃(1), s.c₄(0))
+        return false
+    end
+
+    if !isapprox(s.c₄(1), s.c₁(0))
+        return false
+    end
+
+    return true
+end
+
 # TODO: Implement jacobian() for the different mapping helpers
-# TODO: Implement a check function for transfinite interpolations
 # TODO: Add doc strings