Skip to content

Commit a909838

Browse files
committed
Update docstrings for consistency and clarity, associated style improvements
1 parent 8849bb1 commit a909838

File tree

5 files changed

+23
-51
lines changed

5 files changed

+23
-51
lines changed

src/integral_aliases.jl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Numerically integrate a given function `f(::Point)` along a line-like `geometry`
99
using a particular numerical integration `rule` with floating point precision of
1010
type `FP`.
1111
12+
This is a convenience wrapper around [`integral`](@ref) that additionally enforces
13+
a requirement that the geometry have one parametric dimension.
14+
1215
Rule types available:
1316
- [`GaussKronrod`](@ref) (default)
1417
- [`GaussLegendre`](@ref)
@@ -20,14 +23,12 @@ function lineintegral(
2023
rule::IntegrationRule = GaussKronrod();
2124
kwargs...
2225
)
23-
N = Meshes.paramdim(geometry)
24-
25-
if N == 1
26-
return integral(f, geometry, rule; kwargs...)
27-
else
26+
if (N = Meshes.paramdim(geometry)) != 1
2827
throw(ArgumentError("Performing a line integral on a geometry \
2928
with $N parametric dimensions not supported."))
3029
end
30+
31+
return integral(f, geometry, rule; kwargs...)
3132
end
3233

3334
################################################################################
@@ -41,6 +42,9 @@ Numerically integrate a given function `f(::Point)` along a surface `geometry`
4142
using a particular numerical integration `rule` with floating point precision of
4243
type `FP`.
4344
45+
This is a convenience wrapper around [`integral`](@ref) that additionally enforces
46+
a requirement that the geometry have two parametric dimensions.
47+
4448
Algorithm types available:
4549
- [`GaussKronrod`](@ref)
4650
- [`GaussLegendre`](@ref)
@@ -52,14 +56,12 @@ function surfaceintegral(
5256
rule::IntegrationRule = HAdaptiveCubature();
5357
kwargs...
5458
)
55-
N = Meshes.paramdim(geometry)
56-
57-
if N == 2
58-
return integral(f, geometry, rule; kwargs...)
59-
else
59+
if (N = Meshes.paramdim(geometry)) != 2
6060
throw(ArgumentError("Performing a surface integral on a geometry \
6161
with $N parametric dimensions not supported."))
6262
end
63+
64+
return integral(f, geometry, rule; kwargs...)
6365
end
6466

6567
################################################################################
@@ -73,6 +75,9 @@ Numerically integrate a given function `f(::Point)` throughout a volumetric
7375
`geometry` using a particular numerical integration `rule` with floating point
7476
precision of type `FP`.
7577
78+
This is a convenience wrapper around [`integral`](@ref) that additionally enforces
79+
a requirement that the geometry have three parametric dimensions.
80+
7681
Algorithm types available:
7782
- [`GaussKronrod`](@ref)
7883
- [`GaussLegendre`](@ref)
@@ -84,12 +89,10 @@ function volumeintegral(
8489
rule::IntegrationRule = HAdaptiveCubature();
8590
kwargs...
8691
)
87-
N = Meshes.paramdim(geometry)
88-
89-
if N == 3
90-
return integral(f, geometry, rule; kwargs...)
91-
else
92+
if (N = Meshes.paramdim(geometry)) != 3
9293
throw(ArgumentError("Performing a volume integral on a geometry \
9394
with $N parametric dimensions not supported."))
9495
end
96+
97+
return integral(f, geometry, rule; kwargs...)
9598
end

src/specializations/BezierCurve.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,11 @@
1313
# integral
1414
################################################################################
1515
"""
16-
integral(f, curve::BezierCurve, rule = GaussKronrod();
17-
diff_method=Analytical(), FP=Float64, alg=Meshes.Horner())
16+
integral(f, curve::BezierCurve[, rule = GaussKronrod()]; kwargs...)
1817
1918
Like [`integral`](@ref) but integrates along the domain defined by `curve`.
2019
21-
# Arguments
22-
- `f`: an integrand function, i.e. any callable with a method `f(::Meshes.Point)`
23-
- `curve`: a `Meshes.BezierCurve` that defines the integration domain
24-
- `rule = GaussKronrod()`: optionally, the `IntegrationRule` used for integration
25-
26-
# Keyword Arguments
27-
- `diff_method::DifferentiationMethod = Analytical()`: the method to use for
28-
calculating Jacobians that are used to calculate differential elements
29-
- `FP = Float64`: the floating point precision desired
20+
# Special Keyword Arguments
3021
- `alg = Meshes.Horner()`: the method to use for parametrizing `curve`. Alternatively,
3122
`alg=Meshes.DeCasteljau()` can be specified for increased accuracy, but comes with a
3223
steep performance cost, especially for curves with a large number of control points.

src/specializations/PolyArea.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
################################################################################
1010

1111
"""
12-
integral(f, area::PolyArea, rule = HAdaptiveCubature(); kwargs...)
12+
integral(f, area::PolyArea[, rule = HAdaptiveCubature()]; kwargs...)
1313
1414
Like [`integral`](@ref) but integrates over the surface domain defined by a `PolyArea`.
1515
The surface is first discretized into facets that are integrated independently using

src/specializations/Ring.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,11 @@
99
################################################################################
1010

1111
"""
12-
integral(f, ring::Ring, rule = GaussKronrod();
13-
diff_method=FiniteDifference(), FP=Float64)
12+
integral(f, ring::Ring[, rule = GaussKronrod()]; kwargs...)
1413
1514
Like [`integral`](@ref) but integrates along the domain defined by `ring`. The
1615
specified integration `rule` is applied independently to each segment formed by
1716
consecutive points in the Ring.
18-
19-
# Arguments
20-
- `f`: an integrand function, i.e. any callable with a method `f(::Meshes.Point)`
21-
- `ring`: a `Ring` that defines the integration domain
22-
- `rule = GaussKronrod()`: optionally, the `IntegrationRule` used for integration
23-
24-
# Keyword Arguments
25-
- `diff_method::DifferentiationMethod = FiniteDifference()`: the method to use for
26-
calculating Jacobians that are used to calculate differential elements
27-
- `FP = Float64`: the floating point precision desired
2817
"""
2918
function integral(
3019
f,

src/specializations/Rope.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,11 @@
99
################################################################################
1010

1111
"""
12-
integral(f, rope::Rope, rule = GaussKronrod();
13-
diff_method=FiniteDifference(), FP=Float64)
12+
integral(f, rope::Rope[, rule = GaussKronrod()]; kwargs...)
1413
1514
Like [`integral`](@ref) but integrates along the domain defined by `rope`. The
1615
specified integration `rule` is applied independently to each segment formed by
1716
consecutive points in the Rope.
18-
19-
# Arguments
20-
- `f`: an integrand function, i.e. any callable with a method `f(::Meshes.Point)`
21-
- `rope`: a `Rope` that defines the integration domain
22-
- `rule = GaussKronrod()`: optionally, the `IntegrationRule` used for integration
23-
24-
# Keyword Arguments
25-
- `diff_method::DifferentiationMethod = FiniteDifference()`: the method to use for
26-
calculating Jacobians that are used to calculate differential elements
27-
- `FP = Float64`: the floating point precision desired
2817
"""
2918
function integral(
3019
f,

0 commit comments

Comments
 (0)