Fix missing import in finiterectlat-scatter.py
[qpms.git] / qpms / tests / vswf_arr_and_single.c
blob8a14b31536e0aecbc58be5f9f4e86d987322b0aa
1 // c99 -I .. vswf_single.c -lqpms -lgsl -lblas
2 #include "indexing.h"
3 #include "vswf.h"
4 #include <stdio.h>
6 int main(int argc, char **argv) {
7 const qpms_l_t lMax = 2;
8 csph_t point = {1.4554, 1.2424, 4.2545};
10 qpms_vswf_set_spec_t *bspec = qpms_vswf_set_spec_from_lMax(lMax, QPMS_NORMALISATION_CONVENTION_KRISTENSSON);
12 csphvec_t arr[bspec->n];
13 qpms_uvswf_fill(arr, bspec, point, QPMS_BESSEL_REGULAR);
15 for(size_t i = 0; i < bspec->n; i++) {
16 csphvec_t v = arr[i];
17 qpms_vswf_type_t t; qpms_m_t m; qpms_l_t l;
18 qpms_uvswfi2tmn(bspec->ilist[i], &t, &m, &l);
19 printf("arr; l=%d,m=%+d,t=%d, @(%g,%g,%g): (%g%+gj, %g%+gj, %g%+gj)\n",
20 l, m, t, creal(point.r), point.theta, point.phi, creal(v.rc), cimag(v.rc),
21 creal(v.thetac), cimag(v.thetac), creal(v.phic), cimag(v.phic));
22 if (t == QPMS_VSWF_ELECTRIC)
23 v = qpms_vswf_single_el_csph(m, l, point,QPMS_BESSEL_REGULAR,bspec->norm);
24 else
25 v = qpms_vswf_single_mg_csph(m, l, point,QPMS_BESSEL_REGULAR,bspec->norm);
26 printf("sgl; l=%d,m=%+d,t=%d, @(%g,%g,%g): (%g%+gj, %g%+gj, %g%+gj)\n",
27 l, m, t, creal(point.r), point.theta, point.phi, creal(v.rc), cimag(v.rc),
28 creal(v.thetac), cimag(v.thetac), creal(v.phic), cimag(v.phic));
30 qpms_vswf_set_spec_free(bspec);
31 return 0;