Skip to content

Commit c677cd5

Browse files
Use @autodocs to dynamically include all docstrings (#123)
* use autodocs to dynamically include all docstrings * add section for specializations * add some links and crossreferences * unify docstrings for BezierCurve spezialization * add link and fix typo
1 parent 879b238 commit c677cd5

File tree

6 files changed

+47
-49
lines changed

6 files changed

+47
-49
lines changed

docs/make.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
using Documenter
22
using MeshIntegrals
33

4+
# Dynamically set all files in subdirectories of the source directory to include all files in these subdirectories.
5+
# This way they don't need to be listed explicitly.
6+
SPECIALIZATIONS_FILES = joinpath.(Ref("specializations"),
7+
readdir(joinpath(dirname(@__DIR__), "src",
8+
"specializations")))
9+
410
makedocs(
511
sitename = "MeshIntegrals.jl",
612
pages = [

docs/src/api.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
# Public API
22

3+
```@meta
4+
CurrentModule = MeshIntegrals
5+
```
6+
37
## Integrals
48

5-
```@docs
6-
MeshIntegrals.integral
9+
```@autodocs
10+
Modules = [MeshIntegrals]
11+
Pages = ["integral.jl"]
12+
```
13+
14+
### Specializations
15+
16+
```@autodocs
17+
Modules = [MeshIntegrals]
18+
Pages = Main.SPECIALIZATIONS_FILES
719
```
820

921
### Aliases
1022

11-
```@docs
12-
MeshIntegrals.lineintegral
13-
MeshIntegrals.surfaceintegral
14-
MeshIntegrals.volumeintegral
23+
```@autodocs
24+
Modules = [MeshIntegrals]
25+
Pages = ["integral_aliases.jl"]
1526
```
1627

1728
## Integration Rules
1829

19-
```@docs
20-
MeshIntegrals.GaussKronrod
21-
MeshIntegrals.GaussLegendre
22-
MeshIntegrals.HAdaptiveCubature
30+
```@autodocs
31+
Modules = [MeshIntegrals]
32+
Pages = ["integration_rules.jl"]
2333
```
2434

2535
## Derivatives
2636

27-
```@docs
28-
MeshIntegrals.jacobian
37+
```@autodocs
38+
Modules = [MeshIntegrals]
39+
Pages = ["differentiation.jl"]
2940
```

docs/src/supportmatrix.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Support Matrix
22

3-
While this library aims to support all possible integration rules and **Meshes.jl**
4-
geometry types, some combinations are ill-suited and some others are simplu not yet
3+
While this library aims to support all possible integration rules and [**Meshes.jl**](https://github.com/JuliaGeometry/Meshes.jl)
4+
geometry types, some combinations are ill-suited and some others are simply not yet
55
implemented. The following Support Matrix aims to capture the current development state of
66
all geometry/rule combinations. Entries with a green check mark are fully supported
77
and have passing unit tests that provide some confidence they produce accurate results.

src/integral_aliases.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ using a particular numerical integration `rule` with floating point precision of
1010
type `FP`.
1111
1212
Rule types available:
13-
- GaussKronrod (default)
14-
- GaussLegendre
15-
- HAdaptiveCubature
13+
- [`GaussKronrod`](@ref) (default)
14+
- [`GaussLegendre`](@ref)
15+
- [`HAdaptiveCubature`](@ref)
1616
"""
1717
function lineintegral(
1818
f::Function,
@@ -42,9 +42,9 @@ using a particular numerical integration `rule` with floating point precision of
4242
type `FP`.
4343
4444
Algorithm types available:
45-
- GaussKronrod
46-
- GaussLegendre
47-
- HAdaptiveCubature (default)
45+
- [`GaussKronrod`](@ref)
46+
- [`GaussLegendre`](@ref)
47+
- [`HAdaptiveCubature`](@ref) (default)
4848
"""
4949
function surfaceintegral(
5050
f::Function,
@@ -74,9 +74,9 @@ Numerically integrate a given function `f(::Point)` throughout a volumetric
7474
precision of type `FP`.
7575
7676
Algorithm types available:
77-
- GaussKronrod
78-
- GaussLegendre
79-
- HAdaptiveCubature (default)
77+
- [`GaussKronrod`](@ref)
78+
- [`GaussLegendre`](@ref)
79+
- [`HAdaptiveCubature`](@ref) (default)
8080
"""
8181
function volumeintegral(
8282
f::Function,

src/integration_rules.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ abstract type IntegrationRule end
77
"""
88
GaussKronrod(kwargs...)
99
10-
The h-adaptive Gauss-Kronrod quadrature rule implemented by QuadGK.jl. All standard
10+
The h-adaptive Gauss-Kronrod quadrature rule implemented by
11+
[QuadGK.jl](https://github.com/JuliaMath/QuadGK.jl). All standard
1112
`QuadGK.quadgk` keyword arguments are supported. This rule works natively for one
1213
dimensional geometries; some two- and three-dimensional geometries are additionally
1314
supported using nested integral solvers with the specified `kwarg` settings.
@@ -21,7 +22,8 @@ end
2122
GaussLegendre(n)
2223
2324
An `n`'th-order Gauss-Legendre quadrature rule. Nodes and weights are
24-
efficiently calculated using FastGaussQuadrature.jl.
25+
efficiently calculated using
26+
[FastGaussQuadrature.jl](https://github.com/JuliaApproximation/FastGaussQuadrature.jl).
2527
2628
So long as the integrand function can be well-approximated by a polynomial of
2729
order `2n-1`, this method should yield results with 16-digit accuracy in `O(n)`
@@ -36,7 +38,8 @@ end
3638
"""
3739
HAdaptiveCubature(kwargs...)
3840
39-
The h-adaptive cubature rule implemented by HCubature.jl. All standard
41+
The h-adaptive cubature rule implemented by
42+
[HCubature.jl](https://github.com/JuliaMath/HCubature.jl). All standard
4043
`HCubature.hcubature` keyword arguments are supported.
4144
"""
4245
struct HAdaptiveCubature <: IntegrationRule

src/specializations/BezierCurve.jl

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
################################################################################
1111

1212
"""
13-
integral(f, curve::BezierCurve, ::GaussLegendre;
13+
integral(f, curve::BezierCurve, rule = GaussKronrod();
1414
FP=Float64, alg=Meshes.Horner())
1515
1616
Like [`integral`](@ref) but integrates along the domain defined a `curve`. By
@@ -39,17 +39,6 @@ function integral(
3939
return FP(1 // 2) * sum(w .* integrand(x) for (w, x) in zip(ws, xs))
4040
end
4141

42-
"""
43-
integral(f, curve::BezierCurve, ::GaussKronrod;
44-
FP=Float64, alg=Meshes.Horner())
45-
46-
Like [`integral`](@ref) but integrates along the domain defined a `curve`. By
47-
default this uses Horner's method to improve performance when parameterizing
48-
the `curve` at the expense of a small loss of precision. Additional accuracy
49-
can be obtained by specifying the use of DeCasteljau's algorithm instead with
50-
`alg=Meshes.DeCasteljau()` but can come at a steep cost in memory allocations,
51-
especially for curves with a large number of control points.
52-
"""
5342
function integral(
5443
f::F,
5544
curve::Meshes.BezierCurve,
@@ -62,17 +51,6 @@ function integral(
6251
return QuadGK.quadgk(integrand, zero(FP), one(FP); rule.kwargs...)[1]
6352
end
6453

65-
"""
66-
integral(f, curve::BezierCurve, ::HAdaptiveCubature;
67-
FP=Float64, alg=Meshes.Horner())
68-
69-
Like [`integral`](@ref) but integrates along the domain defined a `curve`. By
70-
default this uses Horner's method to improve performance when parameterizing
71-
the `curve` at the expense of a small loss of precision. Additional accuracy
72-
can be obtained by specifying the use of DeCasteljau's algorithm instead with
73-
`alg=Meshes.DeCasteljau()` but can come at a steep cost in memory allocations,
74-
especially for curves with a large number of control points.
75-
"""
7654
function integral(
7755
f::F,
7856
curve::Meshes.BezierCurve,

0 commit comments

Comments
 (0)