Skip to content

Commit e94fbfa

Browse files
authored
Obsolete nested GaussKronrod rules (#196)
* Remove support for GK in more than one dimension * Bump version to 17-dev * Update docs and changelog * Update support status for surfaces * Remove unused deprecated status entry from legend * Tweak error check * Tweak other error checks * Update benchmarks to skip unsupported GK usages * Update outdated entries * Use helper function for alias error message generation * Revert error message
1 parent 68f022f commit e94fbfa

File tree

9 files changed

+59
-78
lines changed

9 files changed

+59
-78
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
12+
- Removed previously-deprecated support for use of `GaussKronrod` rules on geometries with more than one parametric dimension.
13+
1014

1115
## [0.16.4] - 2025-08-10
1216

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MeshIntegrals"
22
uuid = "dadec2fd-bbe0-4da4-9dbe-476c782c8e47"
3-
version = "0.16.4"
3+
version = "0.17.0-DEV"
44

55
[deps]
66
CliffordNumbers = "3998ac73-6bd4-4031-8035-f167dd3ed523"

benchmark/benchmarks.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ rules = (
2121
(name = "HAdaptiveCubature", rule = HAdaptiveCubature())
2222
)
2323
geometries = (
24-
(name = "Segment", item = Segment(Point(0, 0, 0), Point(1, 1, 1))),
25-
(name = "Sphere", item = Sphere(Point(0, 0, 0), 1.0))
24+
(name = "Segment", item = Segment(Point(0, 0, 0), Point(1, 1, 1))), # 1D
25+
(name = "Sphere", item = Sphere(Point(0, 0), 1.0)), # 2D
26+
(name = "Sphere", item = Sphere(Point(0, 0, 0), 1.0)) # 3D
2627
)
2728

2829
SUITE["Integrals"] = let s = BenchmarkGroup()
2930
for (int, rule, geometry) in Iterators.product(integrands, rules, geometries)
31+
# Skip unsupported applications of GaussKronrod
32+
if (Meshes.paramdim(geometry.item) > 1) && (rule.rule == GaussKronrod())
33+
continue
34+
end
35+
36+
# Construct benchmark and add it to test suite
3037
n1 = geometry.name
3138
n2 = "$(int.name) $(rule.name)"
3239
s[n1][n2] = @benchmarkable integral($int.f, $geometry.item, $rule.rule)

docs/src/support.md

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,13 @@
22

33
This library aims to enable users to calculate the value of integrals over all
44
[**Meshes.jl**](https://github.com/JuliaGeometry/Meshes.jl) geometry types using
5-
a number of numerical integration rules and techniques. However, some combinations
6-
of geometry types and integration rules are ill-suited (and a few are simply not
7-
yet implemented).
8-
9-
## General Recommendations
5+
a number of numerical integration rules and techniques.
106

117
In general, `GaussKronrod` integration rules are recommended (and the default) for
128
geometries with one parametric dimension. For geometries with more than one
139
parametric dimension, e.g. surfaces and volumes, `HAdaptiveCubature` rules are
1410
recommended (and the default).
1511

16-
While it is currently possible to apply nested `GaussKronrod` rules to numerically
17-
integrate surfaces, this produces results that are strictly inferior to using an
18-
equivalent `HAdaptiveCubature` rule, so support for this usage has been deprecated.
19-
In version 16.x of MeshIntegrals.jl, using a `GaussKronrod` rule for a surface
20-
will work but will yield a deprecation warning. Beginning with a future version
21-
17.0, this combination will simply be unsupported and throw an error.
22-
2312
## The Support Matrix
2413

2514
The following Support Matrix captures the current state of support for all geometry/rule
@@ -28,46 +17,47 @@ designed to check for accuracy.
2817

2918
| `Meshes.Geometry/Domain` | `GaussKronrod` | `GaussLegendre` | `HAdaptiveCubature` |
3019
|----------|----------------|---------------|---------------------|
31-
| `Ball` in `𝔼{2}` | ⚠️ |||
20+
| `Ball` in `𝔼{2}` | 🛑 |||
3221
| `Ball` in `𝔼{3}` | 🛑 |||
3322
| `BezierCurve` ||||
3423
| `Box` in `𝔼{1}` ||||
35-
| `Box` in `𝔼{2}` | ⚠️ |||
24+
| `Box` in `𝔼{2}` | 🛑 |||
3625
| `Box` in `𝔼{≥3}` | 🛑 |||
37-
| `CartesianGrid` ||||
26+
| `CartesianGrid` in `𝔼{1}` ||||
27+
| `CartesianGrid` in `𝔼{≥2}` | 🛑 |||
3828
| `Circle` ||||
3929
| `Cone` | 🛑 |||
40-
| `ConeSurface` | ⚠️ |||
30+
| `ConeSurface` | 🛑 |||
4131
| `Cylinder` | 🛑 |||
42-
| `CylinderSurface` | ⚠️ |||
43-
| `Disk` | ⚠️ |||
44-
| `Ellipsoid` | |||
45-
| `Frustum` | ⚠️ |||
46-
| `FrustumSurface` | ⚠️ |||
47-
| `Hexahedron` | |||
32+
| `CylinderSurface` | 🛑 |||
33+
| `Disk` | 🛑 |||
34+
| `Ellipsoid` | 🛑 |||
35+
| `Frustum` | 🛑 |||
36+
| `FrustumSurface` | 🛑 |||
37+
| `Hexahedron` | 🛑 |||
4838
| `Line` ||||
49-
| `ParaboloidSurface` | ⚠️ |||
39+
| `ParaboloidSurface` | 🛑 |||
5040
| `ParametrizedCurve` ||||
51-
| `Plane` | |||
52-
| `PolyArea` | ⚠️ |||
53-
| `Pyramid` | ⚠️ |||
54-
| `Quadrangle` | ⚠️ |||
41+
| `Plane` | 🛑 |||
42+
| `PolyArea` | 🛑 |||
43+
| `Pyramid` | 🛑 |||
44+
| `Quadrangle` | 🛑 |||
5545
| `Ray` ||||
56-
| `RegularGrid` ||||
46+
| `RegularGrid` in `𝔼{1}` ||||
47+
| `RegularGrid` in `𝔼{≥2}` | 🛑 |||
5748
| `Ring` ||||
5849
| `Rope` ||||
5950
| `Segment` ||||
60-
| `SimpleMesh` | ⚠️ |||
61-
| `Sphere` in `𝔼{2}` | |||
62-
| `Sphere` in `𝔼{3}` | ⚠️ |||
63-
| `StructuredGrid` | |||
64-
| `Tetrahedron` | ⚠️ |||
65-
| `Triangle` | |||
66-
| `Torus` | ⚠️ |||
67-
| `Wedge` | ⚠️ |||
51+
| `SimpleMesh` | 🛑 |||
52+
| `Sphere` | 🛑 |||
53+
| `StructuredGrid` in `𝔼{1}` | |||
54+
| `StructuredGrid` in `𝔼{≥2}` | 🛑 |||
55+
| `Tetrahedron` | 🛑 |||
56+
| `Triangle` | 🛑 |||
57+
| `Torus` | 🛑 |||
58+
| `Wedge` | 🛑 |||
6859

6960
| Symbol | Support Level |
7061
|--------|---------|
7162
|| Supported |
72-
| ⚠️ | Deprecated |
7363
| 🛑 | Not supported |

src/integral.jl

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,14 @@ function _integral(
6363
) where {DM <: DifferentiationMethod, T <: AbstractFloat}
6464
_check_diff_method_support(geometry, diff_method)
6565

66-
# Implementation depends on number of parametric dimensions over which to integrate
67-
N = Meshes.paramdim(geometry)
68-
if N == 1
69-
integrand(t) = f(geometry(t)) * differential(geometry, (t,), diff_method)
70-
return QuadGK.quadgk(integrand, zero(FP), one(FP); rule.kwargs...)[1]
71-
elseif N == 2
72-
# Issue deprecation warning
73-
Base.depwarn("Use `HAdaptiveCubature` instead of \
74-
`GaussKronrod` for surfaces.", :integral)
75-
76-
# Nested integration
77-
integrand2D(u, v) = f(geometry(u, v)) * differential(geometry, (u, v), diff_method)
78-
∫₁(v) = QuadGK.quadgk(u -> integrand2D(u, v), zero(FP), one(FP); rule.kwargs...)[1]
79-
return QuadGK.quadgk(v -> ∫₁(v), zero(FP), one(FP); rule.kwargs...)[1]
80-
else
81-
_error_unsupported_combination("geometry with more than two parametric dimensions",
82-
"GaussKronrod")
66+
# Only supported for 1D geometries
67+
if Meshes.paramdim(geometry) != 1
68+
msg = "GaussKronrod rules not supported in more than one parametric dimension."
69+
throw(ArgumentError(msg))
8370
end
71+
72+
integrand(t) = f(geometry(t)) * differential(geometry, (t,), diff_method)
73+
return QuadGK.quadgk(integrand, zero(FP), one(FP); rule.kwargs...)[1]
8474
end
8575

8676
# GaussLegendre

src/integral_aliases.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
function _alias_error_msg(name, N)
2+
"Performing a $name integral on a geometry with $N parametric dimensions not supported."
3+
end
4+
15
################################################################################
26
# Line Integral
37
################################################################################
@@ -24,8 +28,7 @@ function lineintegral(
2428
kwargs...
2529
)
2630
if (N = Meshes.paramdim(geometry)) != 1
27-
throw(ArgumentError("Performing a line integral on a geometry \
28-
with $N parametric dimensions not supported."))
31+
throw(ArgumentError(_alias_error_msg("line", N)))
2932
end
3033

3134
return integral(f, geometry, rule; kwargs...)
@@ -57,8 +60,7 @@ function surfaceintegral(
5760
kwargs...
5861
)
5962
if (N = Meshes.paramdim(geometry)) != 2
60-
throw(ArgumentError("Performing a surface integral on a geometry \
61-
with $N parametric dimensions not supported."))
63+
throw(ArgumentError(_alias_error_msg("surface", N)))
6264
end
6365

6466
return integral(f, geometry, rule; kwargs...)
@@ -90,8 +92,7 @@ function volumeintegral(
9092
kwargs...
9193
)
9294
if (N = Meshes.paramdim(geometry)) != 3
93-
throw(ArgumentError("Performing a volume integral on a geometry \
94-
with $N parametric dimensions not supported."))
95+
throw(ArgumentError(_alias_error_msg("volume", N)))
9596
end
9697

9798
return integral(f, geometry, rule; kwargs...)

src/integration_rules.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ abstract type IntegrationRule end
1212
GaussKronrod(kwargs...)
1313
1414
The h-adaptive Gauss-Kronrod quadrature rule implemented by
15-
[QuadGK.jl](https://github.com/JuliaMath/QuadGK.jl). All standard
16-
`QuadGK.quadgk` keyword arguments are supported. This rule works natively for one
17-
dimensional geometries; some two- and three-dimensional geometries are additionally
18-
supported using nested integral solvers with the specified `kwarg` settings.
15+
[QuadGK.jl](https://github.com/JuliaMath/QuadGK.jl) which can be used for any
16+
single-dimensional geometry. All standard `QuadGK.quadgk` keyword arguments are
17+
supported.
1918
"""
2019
struct GaussKronrod <: IntegrationRule
2120
kwargs::Base.Pairs

src/utils.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
################################################################################
2-
# Misc. Internal Tools
3-
################################################################################
4-
5-
# Common error message structure
6-
function _error_unsupported_combination(geometry, rule)
7-
msg = "Integrating a $geometry using a $rule rule not supported."
8-
throw(ArgumentError(msg))
9-
end
10-
111
################################################################################
122
# DifferentiationMethod
133
################################################################################

test/combinations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This file includes tests for:
6363
elseif N == 2
6464
# surface
6565
aliases = Bool.((0, 1, 0))
66-
rules = Bool.((1, 1, 1))
66+
rules = Bool.((0, 1, 1))
6767
return SupportStatus(aliases..., rules..., autoenzyme)
6868
elseif N == 3
6969
# volume

0 commit comments

Comments
 (0)