1212# DifferentiationMethod
1313# ###############################################################################
1414
15+ """
16+ supports_autoenzyme(geometry)
17+
18+ Return whether a geometry (or geometry type) has a parametric function that can be
19+ differentiated with Enzyme. See GitHub Issue #154 for more information.
20+ """
1521supports_autoenzyme (:: Type{<:Meshes.Geometry} ) = true
1622supports_autoenzyme (:: Type{<:Meshes.BezierCurve} ) = false
1723supports_autoenzyme (:: Type{<:Meshes.CylinderSurface} ) = false
1824supports_autoenzyme (:: Type{<:Meshes.Cylinder} ) = false
1925supports_autoenzyme (:: Type{<:Meshes.ParametrizedCurve} ) = false
2026supports_autoenzyme (:: G ) where {G <: Geometry } = supports_autoenzyme (G)
2127
28+ """
29+ _check_diff_method_support(::Geometry, ::DifferentiationMethod) -> nothing
30+
31+ Throw an error if incompatible geometry-diff_method combination detected.
32+ """
2233_check_diff_method_support (:: Geometry , :: DifferentiationMethod ) = nothing
2334function _check_diff_method_support (geometry:: Geometry , :: AutoEnzyme )
2435 if ! supports_autoenzyme (geometry)
25- throw (ArgumentError (" Differentiation method AutoEnzyme not supported for this geometry." ))
36+ throw (ArgumentError (" AutoEnzyme not supported for this geometry." ))
2637 end
2738end
2839
29- # Return the default DifferentiationMethod instance for a particular geometry type
40+ """
41+ _default_diff_method(geometry, FP)
42+
43+ Return an instance of the default DifferentiationMethod for a particular geometry
44+ (or geometry type) and floating point type.
45+ """
3046function _default_diff_method (
3147 g:: Type{G} , FP:: Type{T}
3248) where {G <: Geometry , T <: AbstractFloat }
@@ -37,7 +53,6 @@ function _default_diff_method(
3753 end
3854end
3955
40- # Return the default DifferentiationMethod instance for a particular geometry instance
4156function _default_diff_method (:: G , :: Type{T} ) where {G <: Geometry , T <: AbstractFloat }
4257 _default_diff_method (G, T)
4358end
0 commit comments