C99 standard compliance for static const initialisers.

This commit is contained in:
Marek Nečada 2020-07-23 14:18:07 +03:00
parent 5246229b2d
commit ae62cf903d
1 changed files with 4 additions and 6 deletions

View File

@ -2044,15 +2044,14 @@ ccart3_t qpms_scatsysw_scattered_E(const qpms_scatsys_at_omega_t *ssw,
} }
static const int DIPSPECN = 3; #define DIPSPECN 3 // We have three basis vectors
// Evaluates the regular electric dipole waves in the origin. The returned // Evaluates the regular electric dipole waves in the origin. The returned
// value is not to be freed as in the usual case. // value is not to be freed as in the usual case.
static inline const qpms_vswf_set_spec_t qpms_fill_regdipoles_0( static inline const qpms_vswf_set_spec_t qpms_fill_regdipoles_0(
ccart3_t regdipoles_0[DIPSPECN], qpms_normalisation_t normalisation) { ccart3_t regdipoles_0[DIPSPECN], qpms_normalisation_t normalisation) {
static const int dipspecn = DIPSPECN; // We have three basis vectors
// bspec containing only electric dipoles // bspec containing only electric dipoles
const qpms_vswf_set_spec_t dipspec = { const qpms_vswf_set_spec_t dipspec = {
.n = dipspecn, .n = DIPSPECN,
.ilist = (qpms_uvswfi_t[]){ .ilist = (qpms_uvswfi_t[]){
qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, -1, 1), qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, -1, 1),
qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, 0, 1), qpms_tmn2uvswfi(QPMS_VSWF_ELECTRIC, 0, 1),
@ -2064,17 +2063,16 @@ static inline const qpms_vswf_set_spec_t qpms_fill_regdipoles_0(
}; };
const sph_t origin_sph = {.r = 0, .theta = M_PI_2, .phi=0}; // Should work with any theta/phi (TESTWORTHY) const sph_t origin_sph = {.r = 0, .theta = M_PI_2, .phi=0}; // Should work with any theta/phi (TESTWORTHY)
csphvec_t regdipoles_0_sph[dipspecn]; csphvec_t regdipoles_0_sph[DIPSPECN];
QPMS_ENSURE_SUCCESS(qpms_uvswf_fill(regdipoles_0_sph, &dipspec, QPMS_ENSURE_SUCCESS(qpms_uvswf_fill(regdipoles_0_sph, &dipspec,
sph2csph(origin_sph), QPMS_BESSEL_REGULAR)); sph2csph(origin_sph), QPMS_BESSEL_REGULAR));
for(int i = 0; i < dipspecn; ++i) for(int i = 0; i < DIPSPECN; ++i)
regdipoles_0[i] = csphvec2ccart(regdipoles_0_sph[i], origin_sph); regdipoles_0[i] = csphvec2ccart(regdipoles_0_sph[i], origin_sph);
return dipspec; return dipspec;
} }
// Alternative implementation, using translation operator and regular dipole waves at zero // Alternative implementation, using translation operator and regular dipole waves at zero
ccart3_t qpms_scatsys_scattered_E__alt(const qpms_scatsys_t *ss, ccart3_t qpms_scatsys_scattered_E__alt(const qpms_scatsys_t *ss,
qpms_bessel_t btyp, qpms_bessel_t btyp,