Skip to content

Commit 4239cd2

Browse files
committed
Add const for N's, and tweak formatting
1 parent ee5bdae commit 4239cd2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/integral.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function integral(
3333
end
3434

3535
################################################################################
36-
# Generalized (n-Dimensional) Worker Methods
36+
# Integral Workers
3737
################################################################################
3838

3939
# GaussKronrod
@@ -44,15 +44,15 @@ function _integral(
4444
FP::Type{T} = Float64,
4545
diff_method::DM = _default_method(geometry)
4646
) where {DM <: DifferentiationMethod, T <: AbstractFloat}
47-
N = Meshes.paramdim(geometry)
48-
4947
# Implementation depends on number of parametric dimensions over which to integrate
48+
const N = Meshes.paramdim(geometry)
5049
if N == 1
5150
integrand(t) = f(geometry(t)) * differential(geometry, (t,), diff_method)
5251
return QuadGK.quadgk(integrand, zero(FP), one(FP); rule.kwargs...)[1]
5352
elseif N == 2
5453
# Issue deprecation warning
55-
#Base.depwarn("Use `HAdaptiveCubature` instead of nested `GaussKronrod` rules.", :integral)
54+
Base.depwarn("Use `HAdaptiveCubature` instead of \
55+
`GaussKronrod` for surfaces.", :integral)
5656

5757
# Nested integration
5858
integrand(u, v) = f(geometry(u, v)) * differential(geometry, (u, v), diff_method)
@@ -72,7 +72,7 @@ function _integral(
7272
FP::Type{T} = Float64,
7373
diff_method::DM = _default_method(geometry)
7474
) where {DM <: DifferentiationMethod, T <: AbstractFloat}
75-
N = Meshes.paramdim(geometry)
75+
const N = Meshes.paramdim(geometry)
7676

7777
# Get Gauss-Legendre nodes and weights for a region [-1,1]^N
7878
xs, ws = _gausslegendre(FP, rule.n)
@@ -98,7 +98,7 @@ function _integral(
9898
FP::Type{T} = Float64,
9999
diff_method::DM = _default_method(geometry)
100100
) where {DM <: DifferentiationMethod, T <: AbstractFloat}
101-
N = Meshes.paramdim(geometry)
101+
const N = Meshes.paramdim(geometry)
102102

103103
integrand(ts) = f(geometry(ts...)) * differential(geometry, ts, diff_method)
104104

0 commit comments

Comments
 (0)