Template Class BSpline

Class Documentation

template<typename Real>
class BSpline

A class to compute cardinal B-splines. This code can compute arbitrary-order B-splines of arbitrary derivative level, subject to the usual constraint that an order m spline is differentiable m-2 times.

Template Parameters:

Real – the floating point type to use for arithmetic.

Public Functions

inline BSpline(short start, Real value, short order, short derivativeLevel)

The B-splines and their derivatives. See update() for argument details.

inline void update(short start, Real value, short order, short derivativeLevel)

update computes information for BSpline, without reallocating memory unless needed.

Parameters:
  • start – the grid point at which to start interpolation.

  • value – the distance (in fractional coordinates) from the starting grid point.

  • order – the order of the BSpline.

  • derivativeLevel – the maximum level of derivative needed for this BSpline.

inline BSpline()
inline helpme::vector<Real> invSplineModuli(short gridDim, std::vector<int> mValues = {})

The modulus of the B-Spline in Fourier space.

Parameters:
  • gridDim – the dimension of the grid in the dimension this spline is to be used.

  • mValues – if provided, provides the ordering of the m values, if not they are ordered as 0, 1, 2, …, Kmax, -Kmax+1, -Kmax+2, …, -2, -1.

Returns:

a gridDim long vector containing the inverse of the Fourier space spline moduli.

inline short startingGridPoint() const

Gets the grid point to start interpolating from.

Returns:

the index of the first grid point this spline supports.

inline const Real *operator[](const int &deriv) const

Returns the B-Spline, or derivative thereof.

Parameters:

deriv – the derivative level of the spline to be returned.

inline const Matrix<Real> &splineData() const

Get read-only access to the full spline data.

Returns:

a const reference to the full spline data: row index is derivative, col index is spline component.

Protected Functions

inline void makeSplineInPlace(Real *array, const Real &val, const short &n) const

Makes B-Spline array.

inline void differentiateSpline(const Real *array, Real *dArray, const short &n) const

Takes BSpline derivative.

inline void assertSplineIsSufficient(int splineOrder, int derivativeLevel) const

assertSplineIsSufficient ensures that the spline is large enough to be differentiable. An mth order B-Spline is differentiable m-2 times.

Protected Attributes

short order_

The order of this B-spline.

short derivativeLevel_

The maximum derivative level for this B-spline.

Matrix<Real> splines_

B-Splines with rows corresponding to derivative level, and columns to spline component.

short startingGridPoint_

The grid point at which to start interpolation.