Public API
Integrals
MeshIntegrals.integral — Functionintegral(f, geometry[, rule]; kwargs...)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: a Meshes.jlGeometryorDomainthat defines the integration domainrule: optionally, theIntegrationRuleused for integration (by default
GaussKronrod() in 1D and HAdaptiveCubature() else)
Keyword Arguments
diff_method::DifferentiationMethod: manually specifies the differentiation method use to
calculate Jacobians within the integration domain.
FP = Float64: manually specifies the desired output floating point precision
Specializations
MeshIntegrals.integral — Methodintegral(f, curve::BezierCurve[, rule = GaussKronrod()]; kwargs...)Like integral but integrates along the domain defined by curve.
Special Keyword Arguments
alg = 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, area::PolyArea[, rule = HAdaptiveCubature()]; kwargs...)Like integral but integrates over the surface domain defined by a PolyArea. The surface is first discretized into facets that are integrated independently using the specified integration rule.
MeshIntegrals.integral — Methodintegral(f, ring::Ring[, rule = GaussKronrod()]; kwargs...)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.
MeshIntegrals.integral — Methodintegral(f, rope::Rope[, rule = GaussKronrod()]; kwargs...)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.
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.Pointdims::Int64- number of parametric dimensions, i.e.length(ts)
MeshIntegrals._parametric — Function_parametric(geometry::G) where {G <: Meshes.Geometry} -> FunctionUsed 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.
This is a convenience wrapper around integral that additionally enforces a requirement that the geometry have one parametric dimension.
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.
This is a convenience wrapper around integral that additionally enforces a requirement that the geometry have two parametric dimensions.
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.
This is a convenience wrapper around integral that additionally enforces a requirement that the geometry have three parametric dimensions.
Algorithm types available:
Integration Rules
MeshIntegrals.GaussKronrod — TypeGaussKronrod(kwargs...)The h-adaptive Gauss-Kronrod quadrature rule implemented by QuadGK.jl which can be used for any single-dimensional geometry. All standard QuadGK.quadgk keyword arguments are supported.
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.AutoEnzyme — TypeAutoEnzyme()Use to specify use of the Enzyme.jl for calculating derivatives.
MeshIntegrals.DifferentiationMethod — TypeDifferentiationMethodA 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, AutoEnzyme.
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.Geometryof N parametric dimensionsts: a parametric point specified as a vector or tuple of length Ndiff_method: the desiredDifferentiationMethodto 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.Geometryof N parametric dimensionsts: a parametric point specified as a vector or tuple of length Ndiff_method: the desiredDifferentiationMethodto use