![]() |
Hex
2.2
Hydrogen-electron collision solver
|
B-spline environment. More...
#include <bspline.h>
Public Member Functions | |
| Bspline (int order, Real th, rArrayView cknots1, rArrayView rknots, rArrayView cknots2) | |
| Constructor. More... | |
| Complex | bspline (int i, int iknot, int k, Complex r) const |
| Evaluate B-spline. More... | |
| Complex | dspline (int i, int iknot, int k, Complex r) const |
| Evaluate derivative of a B-spline. More... | |
| void | B (int i, int iknot, int n, const Complex *x, Complex *y) const |
| B-spline. More... | |
| void | dB (int i, int iknot, int n, const Complex *x, Complex *y) const |
| Derivative of a B-spline. More... | |
| Complex | rotate (Real r) const |
| Apply the ECS transformation. More... | |
| Real | unrotate (Complex z) const |
| Apply the inverse ECS transformation. More... | |
| Complex | clamp (Complex z, Real a, Real b) const |
| Restrict value into a given range. More... | |
| cArray | zip (const cArrayView coeff, const rArrayView grid) const |
| Zip 1D expansion. More... | |
| cArray | zip (const cArrayView coeff, const rArrayView xgrid, const rArrayView ygrid) const |
| Zip 2D expansion. More... | |
| int | knot (Complex x) const |
| Get knot index for coordinate. More... | |
| Complex | eval (const cArrayView coeff, Real x) const |
| Evaluate 1D B-spline expansion. More... | |
| Complex | eval (const cArrayView coeff, Real x, Real y) const |
| Evaluate 2D B-spline expansion. More... | |
| cArrayView | t () const |
| B-spline knot sequence. More... | |
| Complex const & | t (int i) const |
| B-spline knot sequence. More... | |
| int | Nspline () const |
| Number of B-splines. More... | |
| int | Nknot () const |
| Number of knots. More... | |
| int | Nreknot () const |
| Number of real knots. More... | |
| int | order () const |
| B-spline order. More... | |
| int | iR1 () const |
| Index of knot between leading complex grid and real grid. More... | |
| int | iR2 () const |
| Index of knot between real grid and trailing complex grid. More... | |
| Real | R1 () const |
| Beginning of the real grid. More... | |
| Real | R2 () const |
| End of the real grid. More... | |
| Real | Rmin () const |
| Beginning of the grid (unrotated). More... | |
| Real | Rmax () const |
| End of the grid (unrotated). More... | |
| Real | ECStheta () const |
| ECS rotation angle. More... | |
| rArray const & | rknots () const |
| real knots More... | |
| rArray const & | cknots1 () const |
| complex knots More... | |
| rArray const & | cknots2 () const |
| std::size_t | hash () const |
| Return (almost) unique identification for this B-spline object. More... | |
Static Public Member Functions | |
| static cArray | zip (Bspline const &bx, Bspline const &by, const cArrayView coeff, const rArrayView xgrid, const rArrayView ygrid, Complex(Bspline::*evalXBSpline)(int, int, int, Complex) const =&Bspline::bspline, Complex(Bspline::*evalYBSpline)(int, int, int, Complex) const =&Bspline::bspline) |
This class is used to manage B-spline computations within the context of the exterior complex scaling. That is, it allows (upon construction) specification of the real and complex knot sequences
\[ t_1^{R}, t_2^{R}, ..., t_{\mathrm{Nreknot}}^{R} \ , \]
\[ t_{\mathrm{Nreknot}+1}^{C}, ..., t_{\mathrm{Nknot}}^{C} \ , \]
which then serve as the knot data of the B-spline set. See bspline and dspline on the definition formulae.
| Bspline::Bspline | ( | int | order, |
| Real | th, | ||
| rArrayView | cknots1, | ||
| rArrayView | rknots, | ||
| rArrayView | cknots2 | ||
| ) |
Setup the knot sequence, which will consist of two parts.
| order | B-spline order. |
| th | ECS angle in radians. |
| cknots1 | Leading complex-rotated knots. |
| rknots | Real knot array. |
| cknots2 | Trailing complex-rotated knots. |
| void Bspline::B | ( | int | i, |
| int | iknot, | ||
| int | n, | ||
| const Complex * | x, | ||
| Complex * | y | ||
| ) | const |
Evaluates single B-spline at several points at once. This results in increased speed, because some data need to be computed only once. Also, some operation have been reorganized to a form that allows SIMD auto-vectorization.
Note that all evaluation points must be in the interval bounded by 'iknot'-th and 'iknot+1'-th knot.
For parameters description see bspline.
| Complex Bspline::bspline | ( | int | i, |
| int | iknot, | ||
| int | k, | ||
| Complex | r | ||
| ) | const |
Function evaluates a B-spline in one point. The recursive Cox de Boor formula is used:
\[ B_i^{(0)}(x) = \cases { 1 & t_i \le x \le t_{i+1} \cr 0 & \mbox{otherwise} }\ , \]
\[ B_i^{(k)}(x) = \frac{x - t_i}{t_{i+k-1} - t_i} B_i^{(k-1)}(x) + \frac{t_{i+k} - x}{t_{i+k} - t_{i+1}} B_{i+1}^{(k-1)}(x) \ . \]
| i | Index of the B-spline. |
| iknot | Index of the left knot. |
| k | B-spline order. |
| r | Coordinate (independent variable). |
|
inline |
|
inline |
| Complex Bspline::clamp | ( | Complex | z, |
| Real | a, | ||
| Real | b | ||
| ) | const |
Returns the value unchanged if it fits into the given range, or one of the bounds (the nearer one) if it doesn't. The bounds a and b are (unrotated) coordinates along the contour.
| void Bspline::dB | ( | int | i, |
| int | iknot, | ||
| int | n, | ||
| const Complex * | x, | ||
| Complex * | y | ||
| ) | const |
| Complex Bspline::dspline | ( | int | i, |
| int | iknot, | ||
| int | k, | ||
| Complex | r | ||
| ) | const |
This function evaluated the derivative of a B-spline, using the formula
| i | Index of the B-spline. |
| iknot | Index of the left knot. |
| k | B-spline order. |
| r | Coordinate (independent variable). |
|
inline |
| Complex Bspline::eval | ( | const cArrayView | coeff, |
| Real | x | ||
| ) | const |
Evaluates a B-spline expansion in a single point x. This function is faster than calling
though the results are the same.
| Complex Bspline::eval | ( | const cArrayView | coeff, |
| Real | x, | ||
| Real | y | ||
| ) | const |
Evaluates a double B-spline expansion in a single point (x,y). This function is faster than calling
though the results are the same.
| std::size_t Bspline::hash | ( | ) | const |
The identifier is calculated as a simple hash of the data contained in the object.
|
inline |
This is also the index of the first possibly purely real B-spline.
|
inline |
This is the index of the trailing knot of the last possibly purely real B-spline. The index of that B-spline is iR2 - order - 1.
| int Bspline::knot | ( | Complex | x | ) | const |
Finds knot (interval \( \langle t_i,t_{i+1} \rangle \)) for 'x'.
| x | Complex coordinate. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| r | Real coordinate. |
|
inline |
|
inline |
|
inline |
| z | Complex coordinate. |
| cArray Bspline::zip | ( | const cArrayView | coeff, |
| const rArrayView | grid | ||
| ) | const |
Evaluate 1D function given as a B-spline expansion over a grid.
| coeff | Expansion coefficients. |
| grid | Evaluation points (unrotated). They are assumed to be sorted. The length of coeff must be at least equal to the spline count and it is these first Nspline coefficients that are used in evaluation. |
| cArray Bspline::zip | ( | const cArrayView | coeff, |
| const rArrayView | xgrid, | ||
| const rArrayView | ygrid | ||
| ) | const |
Evaluate 2D function given as a B-spline expansion over a carthesian product of two 1D grids.
| coeff | Expansion coefficients. |
| xgrid | Evaluation points at x-axis (unrotated). They are assumed to be sorted. |
| ygrid | Evaluation points at y-axis (unrotated). They are assumed to be sorted. The length of coeff must be at least equal to the spline count squared and it is these first Nspline**2 coefficients that are used in evaluation. |
|
static |
Zip 2D expansion.
Evaluate 2D function given as a B-spline expansion over a carthesian product of two 1D grids. The user may supply the B-spline evaluation functions for the individual axes, thus allowing evaluation of partial derivatives besides the plain B-spline expansion.
1.8.13