Skip to content

Commit 7a70870

Browse files
committed
Mirror GeometryOrDomain internally
1 parent 242b3f0 commit 7a70870

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

ext/MeshIntegralsEnzymeExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end
1818

1919
# Supports all geometries except for those that throw errors
2020
# See GitHub Issue #154 for more information
21-
MeshIntegrals.supports_autoenzyme(::Type{<:Meshes.GeometryOrDomain}) = true
21+
MeshIntegrals.supports_autoenzyme(::Type{<:GeometryOrDomain}) = true
2222
MeshIntegrals.supports_autoenzyme(::Type{<:Meshes.BezierCurve}) = false
2323
MeshIntegrals.supports_autoenzyme(::Type{<:Meshes.CylinderSurface}) = false
2424
MeshIntegrals.supports_autoenzyme(::Type{<:Meshes.Cylinder}) = false

src/MeshIntegrals.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
module MeshIntegrals
22
using CliffordNumbers: CliffordNumbers, VGA,
33
using CoordRefSystems: CoordRefSystems, CRS
4-
using Meshes: Meshes, Geometry, GeometryOrDomain
4+
using Meshes: Meshes, Geometry
55

66
import FastGaussQuadrature
77
import HCubature
88
import LinearAlgebra
99
import QuadGK
1010
import Unitful
1111

12+
# Same as the internal-only Meshes.GeometryOrDomain
13+
const GeometryOrDomain = Union{Meshes.Geometry, Meshes.Domain}
14+
1215
include("differentiation.jl")
1316
export DifferentiationMethod, FiniteDifference, AutoEnzyme, jacobian
1417

src/specializations/PolyArea.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function integral(
3434
) where {I <: IntegrationRule}
3535
# Partition the PolyArea, sum the integrals over each of those areas
3636
subintegral(area) = integral(f, area, rule; kwargs...)
37-
subgeometries = Meshes.elements(Meshes.discretize(area)) |> collect
37+
subgeometries = collect(Meshes.elements(Meshes.discretize(area)))
3838
return sum(subintegral, subgeometries)
3939
end
4040

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function supports_autoenzyme end
2525
supports_autoenzyme(::Type{<:Any}) = false
2626

2727
# If provided a geometry instance, re-run with the type as argument
28-
supports_autoenzyme(::G) where {G <: Meshes.GeometryOrDomain} = supports_autoenzyme(G)
28+
supports_autoenzyme(::G) where {G <: GeometryOrDomain} = supports_autoenzyme(G)
2929

3030
"""
3131
_check_diff_method_support(::Geometry, ::DifferentiationMethod) -> nothing

test/combinations.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This file includes tests for:
1717
using CoordRefSystems
1818
import LinearAlgebra: norm
1919
using Meshes
20-
using MeshIntegrals
20+
using MeshIntegrals: MeshIntegrals, GeometryOrDomain
2121
import Unitful: @u_str, Quantity, ustrip
2222
import Enzyme
2323

@@ -28,7 +28,7 @@ This file includes tests for:
2828
(c::Callable)(p::Meshes.Point) = c.f(p)
2929

3030
# Stores a testable combination
31-
struct TestableGeometry{F <: Function, G <: Meshes.GeometryOrDomain, U <: Quantity}
31+
struct TestableGeometry{F <: Function, G <: GeometryOrDomain, U <: Quantity}
3232
integrand::F
3333
geometry::G
3434
solution::U
@@ -49,7 +49,7 @@ This file includes tests for:
4949
end
5050

5151
# Shortcut constructor for geometries with typical support structure
52-
function SupportStatus(geometry::G) where {G <: Meshes.GeometryOrDomain}
52+
function SupportStatus(geometry::G) where {G <: GeometryOrDomain}
5353
# Check whether AutoEnzyme should be supported, i.e. not on blacklist
5454
unsupported_Gs = Union{BezierCurve, Cylinder, CylinderSurface, ParametrizedCurve}
5555
autoenzyme = !(G <: unsupported_Gs)

0 commit comments

Comments
 (0)