morphogen.iga.basis

B-spline basis functions: values and derivatives, knot vectors and the operators of their refinement.

A knot vector U = (u_0 <= ... <= u_m) and a degree p define n = m - p functions N_(i,p) by the recurrence of Cox and de Boor:

N_(i,0)(u) = 1 on [u_i, u_(i+1)), 0 elsewhere,
N_(i,p)(u) = (u - u_i) / (u_(i+p) - u_i) N_(i,p-1)(u)
           + (u_(i+p+1) - u) / (u_(i+p+1) - u_(i+1)) N_(i+1,p-1)(u),

piecewise polynomials of degree p, non-negative, summing to one, each supported by p + 1 spans, and p - k times differentiable at a knot repeated k times (Piegl & Tiller 1997, ch. 2). The knot vectors here are open: their first and last knots are repeated p + 1 times, so that the functions interpolate at the two ends. In a span [u_s, u_(s+1)) only the functions s - p ... s are non-zero: they are computed there together (basis()), with their derivatives by:

N'_(i,p) = p (N_(i,p-1) / (u_(i+p) - u_i) - N_(i+1,p-1) / (u_(i+p+1) - u_(i+1))).

Refinement. A space of splines contains that of a coarser knot vector (knots inserted: h-refinement) or of a lower degree with the same continuity (the multiplicity of every knot raised with the degree: p-refinement; both: k-refinement). A function keeps its shape and gets new coefficients, linear in the old ones: embedding() gives the matrix T of that map (c_new = T c_old), found by matching the two expansions at the Gauss points of the new elements — exact since the spaces are nested, whatever the continuity. Rational curves and surfaces (NURBS) refine through their homogeneous control points.

morphogen.iga.basis.open_knots(n: int, degree: int, lower: float = 0.0, upper: float = 1.0) → ndarray[source]

The open uniform knot vector of n functions of degree degree on [lower, upper]: n - degree elements of equal length.

morphogen.iga.basis.check_knots(knots, degree: int) → ndarray[source]

The knot vector as an array, checked: non-decreasing, open, no knot repeated more than degree times inside (continuous functions).

morphogen.iga.basis.n_functions(knots, degree: int) → int[source]

The number of functions of a knot vector.

morphogen.iga.basis.breakpoints(knots) → ndarray[source]

The distinct knots: the ends of the elements.

morphogen.iga.basis.greville(knots, degree: int) → ndarray[source]

The Greville abscissae (u_(i+1) + ... + u_(i+p)) / p of the functions: where each one is largest, and the parameters of the control points of the identity.

morphogen.iga.basis.spans(knots, degree: int, u) → ndarray[source]

The span s of each parameter (u_s <= u < u_(s+1); the last span for the last knot). Parameters outside the knots are an error.

morphogen.iga.basis.basis(knots, degree: int, u, derivatives: int = 0) → tuple[ndarray, ndarray][source]

The spans of the parameters u and the functions that are non-zero there with their derivatives: values[k, j, a] is the derivative of order k of the function span[j] - degree + a at u[j] (k = 0 ... derivatives, a = 0 ... degree).

morphogen.iga.basis.collocation(knots, degree: int, u, derivative: int = 0) → ndarray[source]

The matrix of the functions (or of their derivatives of an order) at parameters: points x functions.

morphogen.iga.basis.gauss(n: int) → tuple[ndarray, ndarray][source]

The Gauss-Legendre rule of n points on [0, 1]: points and weights.

morphogen.iga.basis.refined_knots(knots, degree: int, subdivisions: int = 1, elevate: int = 0) → ndarray[source]

The knot vector of a refinement: every element cut into subdivisions equal parts (new knots, once each), and the degree raised by elevate with the continuity of the knots kept (their multiplicities raised as much).

morphogen.iga.basis.embedding(knots, degree: int, new_knots, new_degree: int) → ndarray[source]

The matrix T (new functions x old functions) of the coefficients of the old functions in a refined space that contains them: sum_i c_i N_i = sum_j (T c)_j N'_j. Found by least squares at the Gauss points of the new elements, where the two expansions agree exactly; an error if the new space does not contain the old one.