diff src/Grids/manifolds.jl @ 2003:524a52f190d7 feature/sbp_operators/laplace_curvilinear

Merge feature/grids/geometry_functions
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 29 Apr 2025 09:03:05 +0200
parents a1b2453c02c9
children
line wrap: on
line diff
--- a/src/Grids/manifolds.jl	Tue Feb 11 09:03:04 2025 +0100
+++ b/src/Grids/manifolds.jl	Tue Apr 29 09:03:05 2025 +0200
@@ -9,9 +9,15 @@
 end
 
 Base.ndims(::Chart{D}) where D = D
-(c::Chart)(ξ) = c.mapping(ξ)
 parameterspace(c::Chart) = c.parameterspace
 
+function (c::Chart)(ξ)
+    if ξ ∉ parameterspace(c)
+        throw(DomainError(ξ, "chart was called logical coordinates outside the parameterspace. If this was inteded, use the `mapping` field from the Chart struct instead."))
+    end
+    return c.mapping(ξ)
+end
+
 """
     jacobian(c::Chart, ξ)
 
@@ -30,8 +36,12 @@
 ```
 which will both allow calling `jacobian(c,ξ)`.
 """
-jacobian(c::Chart, ξ) = jacobian(c.mapping, ξ)
-# TBD: Can we register a error hint for when jacobian is called with a function that doesn't have a registered jacobian?
+function jacobian(c::Chart, ξ)
+    if ξ ∉ parameterspace(c)
+        throw(DomainError(ξ, "jacobian was called with logical coordinates outside the parameterspace of the chart. If this was inteded, use the `mapping` field from the Chart struct instead."))
+    end
+    return jacobian(c.mapping, ξ)
+end
 
 boundary_identifiers(c::Chart) = boundary_identifiers(parameterspace(c))
 
@@ -54,7 +64,7 @@
 """
     connections(::Atlas)
 
-Collection of pairs of multiblock boundary identifiers.
+Collection of 2-tuples of multiblock boundary identifiers.
 """
 function connections end