Nz contiguous
elements, arranged is row-order (C-style) format. That is, the offset
of the (ix,iy,iz) element is (ix*(Ny+iy)*Nz+iz). Complex numbers are
stored in the standard format of (real,imaginary) pairs, which the
real element first.
Function prototypes:
Single-precision real:
UBspline_1d_s * create_UBspline_1d_s (Ugrid x_grid, BCtype_s xBC, float *data);
UBspline_2d_s * create_UBspline_2d_s (Ugrid x_grid, Ugrid y_grid,
BCtype_s xBC, BCtype_s yBC, float *data);
UBspline_3d_s * create_UBspline_3d_s (Ugrid x_grid, Ugrid y_grid, Ugrid z_grid,
BCtype_s xBC, BCtype_s yBC, BCtype_s zBC, float *data);
Single-precision complex:
UBspline_1d_c * create_UBspline_1d_c (Ugrid x_grid, BCtype_c xBC, complex_float *data);
UBspline_2d_c * create_UBspline_2d_c (Ugrid x_grid, Ugrid y_grid,
BCtype_c xBC, BCtype_c yBC, complex_float *data);
UBspline_3d_c * create_UBspline_3d_c (Ugrid x_grid, Ugrid y_grid, Ugrid z_grid,
BCtype_c xBC, BCtype_c yBC, BCtype_c zBC,
complex_float *data);
Double-precision real:
UBspline_1d_d * create_UBspline_1d_d (Ugrid x_grid, BCtype_d xBC, double *data);
UBspline_2d_d * create_UBspline_2d_d (Ugrid x_grid, Ugrid y_grid,
BCtype_d xBC, BCtype_d yBC, double *data);
UBspline_3d_d * create_UBspline_3d_d (Ugrid x_grid, Ugrid y_grid, Ugrid z_grid,
BCtype_d xBC, BCtype_d yBC, BCtype_d zBC, double *data);
Double-precision complex:
UBspline_1d_z * create_UBspline_1d_z (Ugrid x_grid, BCtype_z xBC, complex_double *data);
UBspline_2d_z * create_UBspline_2d_z (Ugrid x_grid, Ugrid y_grid,
BCtype_z xBC, BCtype_z yBC, complex_double *data);
UBspline_3d_z * create_UBspline_3d_z (Ugrid x_grid, Ugrid y_grid, Ugrid z_grid,
BCtype_z xBC, BCtype_z yBC, BCtype_z zBC,
complex_double *data);
Spline destruction
The memory used for spline storage can be freed simply by a call to
void
destroy_Bspline (void *spline);
The spline parameter can be a spline of any type and dimension,
uniform or nonuniform.
Spline evaluation
For each of the four datatypes, there are four evaluation routines, depending on
which quantities need to be computed:
- Value only
- Value and gradient
- Value, gradient, and Laplacian
- Value, gradient, and Hessian (matrix of 2nd derivatives)
For consistency, all results are returned through pointers passed to the evaluation
routines. Currently, no bounds checking is done for the sake of speed. The user is
responsible for ensuring that the points passed to the evaluation functions fall within
the grids specified at the time of spline creation.
Function prototypes:
Single-precision real:
1D
inline void
eval_UBspline_1d_s (UBspline_1d_s * restrict spline,
double x, float* restrict val);
inline void
eval_UBspline_1d_s_vg (UBspline_1d_s * restrict spline, double x,
float* restrict val, float* restrict grad);
inline void
eval_UBspline_1d_s_vgl (UBspline_1d_s * restrict spline, double x,
float* restrict val, float* restrict grad, float* restrict lapl);
inline void /* identical to above routine in 1D */
eval_UBspline_1d_s_vgh (UBspline_1d_s * restrict spline, double x,
float* restrict val, float* restrict grad, float* restrict hess);
2D
inline void
eval_UBspline_2d_s (UBspline_2d_s * restrict spline, double x, double y,
float* restrict val);
inline void
eval_UBspline_2d_s_vg (UBspline_2d_s * restrict spline, double x, double y,
float* restrict val, float* restrict grad);
inline void
eval_UBspline_2d_s_vgl (UBspline_2d_s * restrict spline, double x, double y,
float* restrict val, float* restrict grad, float* restrict lapl);
inline void
eval_UBspline_2d_s_vgh (UBspline_2d_s * restrict spline, double x, double y,
float* restrict val, float* restrict grad, float* restrict hess);
3D
inline void
eval_UBspline_3d_s (UBspline_3d_s * restrict spline, double x, double y, double z,
float* restrict val);
inline void
eval_UBspline_3d_s_vg (UBspline_3d_s * restrict spline, double x, double y, double z,
float* restrict val, float* restrict grad);
inline void
eval_UBspline_3d_s_vgl (UBspline_3d_s * restrict spline, double x, double y, double z,
float* restrict val, float* restrict grad, float* restrict lapl);
inline void
eval_UBspline_3d_s_vgh (UBspline_3d_s * restrict spline, double x, double y,
float* restrict val, float* restrict grad, float* restrict hess);
Single-precision complex:
1D
inline void
eval_UBspline_1d_c (UBspline_1d_c * restrict spline,
double x, complex_float* restrict val);
inline void
eval_UBspline_1d_c_vg (UBspline_1d_c * restrict spline, double x,
complex_float* restrict val, complex_float* restrict grad);
inline void
eval_UBspline_1d_c_vgl (UBspline_1d_c * restrict spline, double x,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict lapl);
inline void /* identical to above routine in 1D */
eval_UBspline_1d_c_vgh (UBspline_1d_c * restrict spline, double x,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict hess);
2D
inline void
eval_UBspline_2d_c (UBspline_2d_c * restrict spline, double x, double y,
complex_float* restrict val);
inline void
eval_UBspline_2d_c_vg (UBspline_2d_c * restrict spline, double x, double y,
complex_float* restrict val, complex_float* restrict grad);
inline void
eval_UBspline_2d_c_vgl (UBspline_2d_c * restrict spline, double x, double y,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict lapl);
inline void
eval_UBspline_2d_c_vgh (UBspline_2d_c * restrict spline, double x, double y,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict hess);
3D
inline void
eval_UBspline_3d_c (UBspline_3d_c * restrict spline, double x, double y, double z,
complex_float* restrict val);
inline void
eval_UBspline_3d_c_vg (UBspline_3d_c * restrict spline, double x, double y, double z,
complex_float* restrict val, complex_float* restrict grad);
inline void
eval_UBspline_3d_c_vgl (UBspline_3d_c * restrict spline, double x, double y, double z,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict lapl);
inline void
eval_UBspline_3d_c_vgh (UBspline_3d_c * restrict spline, double x, double y,
complex_float* restrict val, complex_float* restrict grad, complex_float* restrict hess);
Double-precision real:
1D
inline void
eval_UBspline_1d_d (UBspline_1d_d * restrict spline,
double x, double* restrict val);
inline void
eval_UBspline_1d_d_vg (UBspline_1d_d * restrict spline, double x,
double* restrict val, double* restrict grad);
inline void
eval_UBspline_1d_d_vgl (UBspline_1d_d * restrict spline, double x,
double* restrict val, double* restrict grad, double* restrict lapl);
inline void /* identical to above routine in 1D */
eval_UBspline_1d_d_vgh (UBspline_1d_d * restrict spline, double x,
double* restrict val, double* restrict grad, double* restrict hess);
2D
inline void
eval_UBspline_2d_d (UBspline_2d_d * restrict spline, double x, double y,
double* restrict val);
inline void
eval_UBspline_2d_d_vg (UBspline_2d_d * restrict spline, double x, double y,
double* restrict val, double* restrict grad);
inline void
eval_UBspline_2d_d_vgl (UBspline_2d_d * restrict spline, double x, double y,
double* restrict val, double* restrict grad, double* restrict lapl);
inline void
eval_UBspline_2d_d_vgh (UBspline_2d_d * restrict spline, double x, double y,
double* restrict val, double* restrict grad, double* restrict hess);
3D
inline void
eval_UBspline_3d_d (UBspline_3d_d * restrict spline, double x, double y, double z,
double* restrict val);
inline void
eval_UBspline_3d_d_vg (UBspline_3d_d * restrict spline, double x, double y, double z,
double* restrict val, double* restrict grad);
inline void
eval_UBspline_3d_d_vgl (UBspline_3d_d * restrict spline, double x, double y, double z,
double* restrict val, double* restrict grad, double* restrict lapl);
inline void
eval_UBspline_3d_d_vgh (UBspline_3d_d * restrict spline, double x, double y,
double* restrict val, double* restrict grad, double* restrict hess);
Double-precision complex:
1D
inline void
eval_UBspline_1d_z (UBspline_1d_z * restrict spline,
double x, complex_double* restrict val);
inline void
eval_UBspline_1d_z_vg (UBspline_1d_z * restrict spline, double x,
complex_double* restrict val, complex_double* restrict grad);
inline void
eval_UBspline_1d_z_vgl (UBspline_1d_z * restrict spline, double x,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict lapl);
inline void /* identical to above routine in 1D */
eval_UBspline_1d_z_vgh (UBspline_1d_z * restrict spline, double x,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict hess);
2D
inline void
eval_UBspline_2d_z (UBspline_2d_z * restrict spline, double x, double y,
complex_double* restrict val);
inline void
eval_UBspline_2d_z_vg (UBspline_2d_z * restrict spline, double x, double y,
complex_double* restrict val, complex_double* restrict grad);
inline void
eval_UBspline_2d_z_vgl (UBspline_2d_z * restrict spline, double x, double y,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict lapl);
inline void
eval_UBspline_2d_z_vgh (UBspline_2d_z * restrict spline, double x, double y,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict hess);
3D
inline void
eval_UBspline_3d_z (UBspline_3d_z * restrict spline, double x, double y, double z,
complex_double* restrict val);
inline void
eval_UBspline_3d_z_vg (UBspline_3d_z * restrict spline, double x, double y, double z,
complex_double* restrict val, complex_double* restrict grad);
inline void
eval_UBspline_3d_z_vgl (UBspline_3d_z * restrict spline, double x, double y, double z,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict lapl);
inline void
eval_UBspline_3d_z_vgh (UBspline_3d_z * restrict spline, double x, double y,
complex_double* restrict val, complex_double* restrict grad, complex_double* restrict hess);