4 #ifndef QPMS_INDEXING_H
5 #define QPMS_INDEXING_H
14 return n * (n + 1) + m - 1;
17 static inline qpms_lm_t qpms_y2n(
qpms_y_t y) {
23 return y-qpms_mn2y(0,n);
27 *m=qpms_yn2m(y,*n=qpms_y2n(y));
37 return n * (n + 1) + m;
40 static inline qpms_lm_t qpms_y2n_sc(
qpms_y_t y) {
46 return y-qpms_mn2y_sc(0,n);
50 *m=qpms_yn2m_sc(y,*n=qpms_y2n_sc(y));
54 return lmax * ((
qpms_y_t)lmax + 2) + 1;
62 return t + 4 * qpms_mn2y_sc(m, n);
74 qpms_y2mn_sc_p(y_sc, m, n);
77 if (QPMS_UNLIKELY(*t && !y_sc))
return QPMS_ERROR;
87 if (QPMS_UNLIKELY(*t == 0 || *t == 3))
return QPMS_ERROR;
100 if (QPMS_UNLIKELY(*t == 3))
return QPMS_ERROR;
static qpms_errno_t qpms_uvswfi2ty(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_y_t *y)
Conversion from universal VSWF index u to type and the traditional layout index (l > 0).
Definition: indexing.h:83
static qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_m_t *m, qpms_l_t *n)
Conversion from universal VSWF index u to type, order and degree.
Definition: indexing.h:70
static qpms_errno_t qpms_uvswfi2ty_l(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_y_t *y)
Conversion from universal VSWF index u to type and the traditional (vector) layout index.
Definition: indexing.h:96
static const qpms_uvswfi_t QPMS_UI_L00
Constant denoting the l=0, m=0 longitudinal spherical vector wave.
Definition: indexing.h:66
static qpms_m_t qpms_uvswfi2m(qpms_uvswfi_t u)
Extract degree m from an universal VSWF index u.
Definition: indexing.h:106
static qpms_uvswfi_t qpms_tmn2uvswfi(qpms_vswf_type_t t, qpms_m_t m, qpms_l_t n)
Conversion from VSWF type, order and degree to universal index.
Definition: indexing.h:60
Macros for compiler optimisation.
size_t qpms_y_t
Type for the (l, m) multiindex of transversal (M or N -type) VSWFs.
Definition: qpms_types.h:44
int qpms_l_t
Type for spherical harmonic degree l.
Definition: qpms_types.h:27
qpms_vswf_type_t
Codes of the VSWF types (electric/N, magnetic/M, longitudinal/L).
Definition: qpms_types.h:62
unsigned long long qpms_uvswfi_t
Exhaustive index type for VSWF basis functions.
Definition: qpms_types.h:81
size_t qpms_y_sc_t
Type for the (l, m) multiindex of spherical harmonics, including (0, 0).
Definition: qpms_types.h:59
qpms_errno_t
Error codes / return values for certain numerical functions.
Definition: qpms_types.h:85
@ QPMS_ERROR
Unspecified error.
Definition: qpms_types.h:87
@ QPMS_SUCCESS
Success.
Definition: qpms_types.h:86
qpms_lm_t qpms_m_t
Type for spherical harmonic order m.
Definition: qpms_types.h:31