QPMS
Electromagnetic multiple scattering library and toolkit.
translations_inlines.h
1 #ifndef TRANSLATIONS_INLINES_H
2 #define TRANSLATIONS_INLINES_H
3 #include "translations.h"
4 #include "indexing.h"
5 
7 // TODO DOC
8 static inline void qpms_trans_array_from_AB(
9  complex double *t,
10  const qpms_vswf_set_spec_t *const t_destspec,
11  const size_t t_deststride,
12  const qpms_vswf_set_spec_t *const t_srcspec,
13  const size_t t_srcstride,
14  const complex double *const A, const complex double *const B,
16 
20  const qpms_l_t lMax_AB
21  ) {
22  QPMS_PARANOID_ASSERT(lMax_AB >= t_srcspec->lMax && lMax_AB >= t_destspec->lMax);
23  const qpms_y_t nelem_AB = qpms_lMax2nelem(lMax_AB);
24  for (size_t desti = 0; desti < t_destspec->n; ++desti) {
25  qpms_y_t desty; qpms_vswf_type_t destt;
26  QPMS_ENSURE_SUCCESS_M(qpms_uvswfi2ty(t_destspec->ilist[desti], &destt, &desty),
27  "Invalid u. vswf index %llx.", t_destspec->ilist[desti]);
28  for (size_t srci = 0; srci < t_srcspec->n; ++srci){
29  qpms_y_t srcy; qpms_vswf_type_t srct;
30  QPMS_ENSURE_SUCCESS_M(qpms_uvswfi2ty(t_srcspec->ilist[srci], &srct, &srcy),
31  "Invalid u. vswf index %llx.", t_srcspec->ilist[srci]); t[srci * t_srcstride + desti * t_deststride]
32  = (srct == destt) ? A[desty*nelem_AB + srcy] : B[desty*nelem_AB + srcy];
33  }
34  }
35 }
36 
37 
38 #endif
Various index conversion functions.
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
#define QPMS_ENSURE_SUCCESS_M(x, msg,...)
Raises an error if x is not zero, with custom error message.
Definition: qpms_error.h:207
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
Specifies a finite set of VSWFs.
Definition: qpms_types.h:290
size_t n
Actual number of VSWF indices included in ilist.
Definition: qpms_types.h:291
qpms_uvswfi_t * ilist
Definition: qpms_types.h:292
qpms_l_t lMax
Maximum degree of the waves specified in ilist overall.
Definition: qpms_types.h:295
VSWF translation operator.