diff src/Grids/manifolds.jl @ 1999:a1b2453c02c9 feature/grids/manifolds

Add check in jacobian for the coordinate to be in the parameterspace of the chart
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 25 Apr 2025 16:05:58 +0200
parents 6dd00ea0511a
children
line wrap: on
line diff
--- a/src/Grids/manifolds.jl	Fri Apr 25 08:28:34 2025 +0200
+++ b/src/Grids/manifolds.jl	Fri Apr 25 16:05:58 2025 +0200
@@ -36,7 +36,12 @@
 ```
 which will both allow calling `jacobian(c,ξ)`.
 """
-jacobian(c::Chart, ξ) = jacobian(c.mapping, ξ)
+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))