Public API
Integrals
MeshIntegrals.integral
— Functionintegral(f, geometry[, rule]; diff_method=_default_method(geometry), FP=Float64)
Numerically integrate a given function f(::Point)
over the domain defined by a geometry
using a particular numerical integration rule
with floating point precision of type FP
.
Arguments
f
: an integrand function, i.e. any callable with a methodf(::Meshes.Point)
geometry
: someMeshes.Geometry
that defines the integration domainrule
: optionally, theIntegrationRule
used for integration (by default
GaussKronrod()
in 1D and HAdaptiveCubature()
else)
Keyword Arguments
diff_method::DifferentiationMethod = _default_method(geometry)
: the method to
use for calculating Jacobians that are used to calculate differential elements
FP = Float64
: the floating point precision desired.
Specializations
MeshIntegrals.integral
— Methodintegral(f, curve::BezierCurve, rule = GaussKronrod();
+ diff_method=Analytical(), FP=Float64, alg=Meshes.Horner())
Like integral
but integrates along the domain defined by curve
.
Arguments
f
: an integrand function, i.e. any callable with a methodf(::Meshes.Point)
curve
: aMeshes.BezierCurve
that defines the integration domainrule = GaussKronrod()
: optionally, theIntegrationRule
used for integration
Keyword Arguments
diff_method::DifferentiationMethod = Analytical()
: the method to use for
calculating Jacobians that are used to calculate differential elements
FP = Float64
: the floating point precision desiredalg = Meshes.Horner()
: the method to use for parametrizingcurve
. Alternatively,
alg=Meshes.DeCasteljau()
can be specified for increased accuracy, but comes with a steep performance cost, especially for curves with a large number of control points.
MeshIntegrals.integral
— Methodintegral(f, ring::Ring, rule = GaussKronrod();
+ diff_method=FiniteDifference(), FP=Float64)
Like integral
but integrates along the domain defined by ring
. The specified integration rule
is applied independently to each segment formed by consecutive points in the Ring.
Arguments
f
: an integrand function, i.e. any callable with a methodf(::Meshes.Point)
ring
: aRing
that defines the integration domainrule = GaussKronrod()
: optionally, theIntegrationRule
used for integration
Keyword Arguments
diff_method::DifferentiationMethod = FiniteDifference()
: the method to use for
calculating Jacobians that are used to calculate differential elements
FP = Float64
: the floating point precision desired
MeshIntegrals.integral
— Methodintegral(f, rope::Rope, rule = GaussKronrod();
+ diff_method=FiniteDifference(), FP=Float64)
Like integral
but integrates along the domain defined by rope
. The specified integration rule
is applied independently to each segment formed by consecutive points in the Rope.
Arguments
f
: an integrand function, i.e. any callable with a methodf(::Meshes.Point)
rope
: aRope
that defines the integration domainrule = GaussKronrod()
: optionally, theIntegrationRule
used for integration
Keyword Arguments
diff_method::DifferentiationMethod = FiniteDifference()
: the method to use for
calculating Jacobians that are used to calculate differential elements
FP = Float64
: the floating point precision desired
MeshIntegrals._ParametricGeometry
— Type_ParametricGeometry <: Meshes.Primitive <: Meshes.Geometry
_ParametricGeometry is used internally in MeshIntegrals.jl to behave like a generic wrapper for geometries with custom parametric functions. This type is used for transforming other geometries to enable integration over the standard rectangular [0,1]^n
domain.
Meshes.jl adopted a ParametrizedCurve
type that performs a similar role as of v0.51.20
, but only supports geometries with one parametric dimension. Support is additionally planned for more types that span surfaces and volumes, at which time this custom type will probably no longer be required.
Fields
fun
- anything callable representing a parametric function: (ts...) -> Meshes.Point
Type Structure
M <: Meshes.Manifold
- same usage as inMeshes.Geometry{M, C}
C <: CoordRefSystems.CRS
- same usage as inMeshes.Geometry{M, C}
F
- type of the callable parametric functionDim
- number of parametric dimensions
MeshIntegrals._ParametricGeometry
— Method_ParametricGeometry(fun, dims)
Construct a _ParametricGeometry
using a provided parametric function fun
for a geometry with dims
parametric dimensions.
Arguments
fun
- anything callable representing a parametric function mapping(ts...) -> Meshes.Point
dims::Int64
- number of parametric dimensions, i.e.length(ts)
MeshIntegrals._parametric
— Function_parametric(geometry::G) where {G <: Meshes.Geometry} -> Function
Used in MeshIntegrals.jl for defining parametric functions that transform non-standard geometries into a form that can be integrated over the standard rectangular [0,1]^n limits.
Aliases
MeshIntegrals.lineintegral
— Functionlineintegral(f, geometry[, rule]; FP=Float64)
Numerically integrate a given function f(::Point)
along a line-like geometry
using a particular numerical integration rule
with floating point precision of type FP
.
Rule types available:
MeshIntegrals.surfaceintegral
— Functionsurfaceintegral(f, geometry[, rule]; FP=Float64)
Numerically integrate a given function f(::Point)
along a surface geometry
using a particular numerical integration rule
with floating point precision of type FP
.
Algorithm types available:
MeshIntegrals.volumeintegral
— Functionvolumeintegral(f, geometry[, rule]; FP=Float64)
Numerically integrate a given function f(::Point)
throughout a volumetric geometry
using a particular numerical integration rule
with floating point precision of type FP
.
Algorithm types available:
Integration Rules
MeshIntegrals.GaussKronrod
— TypeGaussKronrod(kwargs...)
The h-adaptive Gauss-Kronrod quadrature rule implemented by QuadGK.jl. All standard QuadGK.quadgk
keyword arguments are supported. This rule works natively for one dimensional geometries; some two- and three-dimensional geometries are additionally supported using nested integral solvers with the specified kwarg
settings.
MeshIntegrals.GaussLegendre
— TypeGaussLegendre(n)
An n
'th-order Gauss-Legendre quadrature rule. Nodes and weights are efficiently calculated using FastGaussQuadrature.jl.
So long as the integrand function can be well-approximated by a polynomial of order 2n-1
, this method should yield results with 16-digit accuracy in O(n)
time. If the function is know to have some periodic content, then n
should (at a minimum) be greater than the expected number of periods over the geometry, e.g. length(geometry)/λ
.
MeshIntegrals.HAdaptiveCubature
— TypeHAdaptiveCubature(kwargs...)
The h-adaptive cubature rule implemented by HCubature.jl. All standard HCubature.hcubature
keyword arguments are supported.
Derivatives
MeshIntegrals.DifferentiationMethod
— TypeDifferentiationMethod
A category of types used to specify the desired method for calculating derivatives. Derivatives are used to form Jacobian matrices when calculating the differential element size throughout the integration region.
See also FiniteDifference
.
MeshIntegrals.FiniteDifference
— TypeFiniteDifference(ε=1e-6)
Use to specify use of a finite-difference approximation method with a step size of ε
for calculating derivatives.
MeshIntegrals.differential
— Methoddifferential(geometry, ts[, diff_method])
Calculate the differential element (length, area, volume, etc) of the parametric function for geometry
at arguments ts
. Optionally, direct the use of a particular differentiation method diff_method
; by default use analytic solutions where possible and finite difference approximations otherwise.
Arguments
geometry
: someMeshes.Geometry
of N parametric dimensionsts
: a parametric point specified as a vector or tuple of length Ndiff_method
: the desiredDifferentiationMethod
to use
MeshIntegrals.jacobian
— Methodjacobian(geometry, ts[, diff_method])
Calculate the Jacobian of a geometry
's parametric function at some point ts
. Optionally, direct the use of a particular differentiation method diff_method
; by default use analytic solutions where possible and finite difference approximations otherwise.
Arguments
geometry
: someMeshes.Geometry
of N parametric dimensionsts
: a parametric point specified as a vector or tuple of length Ndiff_method
: the desiredDifferentiationMethod
to use