archimedes.quadrature.composite_quad¶

archimedes.quadrature.composite_quad(
base: QuadratureRule | Sequence[QuadratureRule],
breakpoints: ndarray,
) → QuadratureRule¶

Tile base across elements of its reference domain.

Partitions base.measure.support at breakpoints and applies base, affinely rescaled, to each element, concatenating the resulting nodes and weights. The result is itself a QuadratureRule on the same reference domain – its nodes are just clustered at the element boundaries rather than spread uniformly – so it can be mapped onto a target domain/measure via map_to/integrate exactly like any other rule of base.measure. This works because measure.affine_params maps affinely, and affine maps commute with subdivision: rescaling the whole composite pattern onto [a, b] is the same as building the elements directly on the rescaled sub-intervals of [a, b].

base may instead be a sequence of rules, one per element, letting each element carry its own order (or even its own family) – e.g. composite_quad([gauss_legendre(2), gauss_legendre(4)], breakpoints) for two elements of different degree. A single base rule is exactly equivalent to passing that same rule len(breakpoints) - 1 times.

Only defined for families whose reference weight is uniform (see Measure.uniform_weight) – otherwise each interior element boundary would pick up a spurious copy of the weight’s shape, which is only meaningful at the true endpoints of the reference domain.

Parameters:
  • base (QuadratureRule or sequence of QuadratureRule) – Rule (or per-element rules) to tile across elements. Every rule’s measure.uniform_weight must be True, and (since the result has a single measure field) every rule must share the same measure. A sequence must have exactly len(breakpoints) - 1 entries, one per element.

  • breakpoints (array_like) – Element boundaries, shape (k + 1,) for k elements. Must be strictly increasing and span base.measure.support exactly (first/last entries equal to its endpoints).

Returns:

rule – Composite rule on the same reference domain as base, with sum(len(r) for r in rules) nodes (k * len(base) when base is a single rule). name is the common rule name if every per-element rule shares one, else the generic "composite".

Return type:

QuadratureRule

Raises:

ValueError – If any rule’s measure.uniform_weight is False, if the rules do not all share the same measure, if a sequence of rules does not have one entry per element, if breakpoints has fewer than 2 entries or is not strictly increasing, or if it does not span base.measure.support exactly.