Skip to content

Commit b44869a

Browse files
committed
Docstring and style updates
1 parent f2a7ea0 commit b44869a

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/integral.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,33 @@
33
################################################################################
44

55
"""
6-
integral(f, geometry[, rule]; diff_method=_default_diff_method(geometry, FP), FP=Float64)
6+
integral(f, geometry[, rule]; kwargs...)
77
88
Numerically integrate a given function `f(::Point)` over the domain defined by
99
a `geometry` using a particular numerical integration `rule` with floating point
1010
precision of type `FP`.
1111
1212
# Arguments
1313
- `f`: an integrand function, i.e. any callable with a method `f(::Meshes.Point)`
14-
- `geometry`: some `Meshes.Geometry` that defines the integration domain
14+
- `geometry`: a Meshes `Geometry` or `Domain` that defines the integration domain
1515
- `rule`: optionally, the `IntegrationRule` used for integration (by default
1616
`GaussKronrod()` in 1D and `HAdaptiveCubature()` else)
1717
1818
# Keyword Arguments
19-
- `diff_method::DifferentiationMethod = _default_diff_method(geometry, FP)`: the method to
20-
use for calculating Jacobians that are used to calculate differential elements
21-
- `FP = Float64`: the floating point precision desired.
19+
- `diff_method::DifferentiationMethod`: manually specifies the differentiation method use to
20+
calculate Jacobians within the integration domain.
21+
- `FP = Float64`: manually specifies the desired output floating point precision
2222
"""
2323
function integral end
2424

25+
# Default integration rule to use if unspecified
26+
_defrule(geometry) = (Meshes.paramdim(geometry) == 1) ? GaussKronrod() : HAdaptiveCubature()
27+
2528
# If only f and geometry are specified, select default rule
2629
function integral(
2730
f,
2831
geometry::Geometry,
29-
rule::I = Meshes.paramdim(geometry) == 1 ? GaussKronrod() : HAdaptiveCubature();
32+
rule::I = _defrule(geometry);
3033
kwargs...
3134
) where {I <: IntegrationRule}
3235
_integral(f, geometry, rule; kwargs...)
@@ -35,12 +38,12 @@ end
3538
function integral(
3639
f,
3740
domain::Meshes.Domain,
38-
rule::I = Meshes.paramdim(domain) == 1 ? GaussKronrod() : HAdaptiveCubature();
41+
rule::I = _defrule(domain);
3942
kwargs...
4043
) where {I <: IntegrationRule}
4144
# Discretize the Domain into primitive geometries, sum the integrals over those
4245
subintegral(geometry) = integral(f, geometry, rule; kwargs...)
43-
subgeometries = Meshes.elements(Meshes.discretize(domain)) |> collect
46+
subgeometries = collect(Meshes.elements(Meshes.discretize(domain)))
4447
return sum(subintegral, subgeometries)
4548
end
4649

src/specializations/PolyArea.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, area::PolyArea, rule = HAdaptiveCubature();
13-
diff_method=FiniteDifference(), FP=Float64)
12+
integral(f, area::PolyArea, rule = HAdaptiveCubature(); kwargs...)
1413
1514
Like [`integral`](@ref) but integrates over the surface domain defined by a `PolyArea`.
1615
The surface is first discretized into facets that are integrated independently using
1716
the specified integration `rule`.
18-
19-
# Arguments
20-
- `f`: an integrand function, i.e. any callable with a method `f(::Meshes.Point)`
21-
- `area`: a `PolyArea` that defines the integration domain
22-
- `rule = HAdaptiveCubature()`: optionally, the `IntegrationRule` used for integration
23-
24-
# Keyword Arguments
25-
- `diff_method::DifferentiationMethod`: 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)