2017-12-17 17:02:58 +02:00
|
|
|
#ifndef QPMS_TYPES_H
|
|
|
|
#define QPMS_TYPES_H
|
|
|
|
#include <complex.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#define M_PI_2 (1.570796326794896619231321691639751442098584699687552910487)
|
|
|
|
|
|
|
|
// integer index types
|
|
|
|
typedef int qpms_lm_t;
|
2018-01-28 11:18:06 +02:00
|
|
|
typedef int qpms_l_t; // can't be unsigned because of the behaviour under - operator
|
2017-12-17 17:42:18 +02:00
|
|
|
typedef qpms_lm_t qpms_m_t;
|
2017-12-17 17:02:58 +02:00
|
|
|
typedef size_t qpms_y_t;
|
|
|
|
|
2017-12-18 03:04:12 +02:00
|
|
|
typedef enum {
|
2018-01-28 11:18:06 +02:00
|
|
|
QPMS_SUCCESS = 0,
|
|
|
|
QPMS_ERROR = 1
|
2017-12-18 03:04:12 +02:00
|
|
|
} qpms_errno_t;
|
|
|
|
|
2017-12-17 17:02:58 +02:00
|
|
|
// Normalisations
|
2018-01-29 17:33:59 +02:00
|
|
|
//const int QPMS_NORMALISATION_T_CSBIT = 128;
|
|
|
|
#define QPMS_NORMALISATION_T_CSBIT 128
|
2017-12-17 17:02:58 +02:00
|
|
|
typedef enum {
|
2018-01-26 15:07:29 +02:00
|
|
|
// As in TODO
|
2018-01-29 17:33:59 +02:00
|
|
|
QPMS_NORMALISATION_XU = 3,
|
|
|
|
QPMS_NORMALISATION_NONE = QPMS_NORMALISATION_XU,
|
2018-01-26 15:07:29 +02:00
|
|
|
// As in http://www.eit.lth.se/fileadmin/eit/courses/eit080f/Literature/book.pdf, power-normalised
|
2018-01-29 17:33:59 +02:00
|
|
|
QPMS_NORMALISATION_KRISTENSSON = 2,
|
|
|
|
QPMS_NORMALISATION_POWER = QPMS_NORMALISATION_KRISTENSSON,
|
|
|
|
// as in TODO
|
2018-01-28 11:18:06 +02:00
|
|
|
QPMS_NORMALISATION_TAYLOR = 1,
|
2018-01-29 17:33:59 +02:00
|
|
|
QPMS_NORMALISATION_SPHARM = QPMS_NORMALISATION_TAYLOR,
|
|
|
|
// Variants with Condon-Shortley phase
|
|
|
|
QPMS_NORMALISATION_XU_CS = QPMS_NORMALISATION_XU | QPMS_NORMALISATION_T_CSBIT,
|
|
|
|
QPMS_NORMALISATION_NONE_CS = QPMS_NORMALISATION_XU_CS,
|
|
|
|
QPMS_NORMALISATION_KRISTENSSON_CS = QPMS_NORMALISATION_KRISTENSSON | QPMS_NORMALISATION_T_CSBIT,
|
|
|
|
QPMS_NORMALISATION_POWER_CS = QPMS_NORMALISATION_KRISTENSSON_CS,
|
|
|
|
QPMS_NORMALISATION_TAYLOR_CS = QPMS_NORMALISATION_TAYLOR | QPMS_NORMALISATION_T_CSBIT,
|
|
|
|
QPMS_NORMALISATION_SPHARM_CS = QPMS_NORMALISATION_TAYLOR_CS,
|
2018-01-28 11:18:06 +02:00
|
|
|
QPMS_NORMALISATION_UNDEF = 0
|
|
|
|
} qpms_normalisation_t;
|
2017-12-17 17:02:58 +02:00
|
|
|
|
2018-01-29 17:33:59 +02:00
|
|
|
static inline int qpms_normalisation_t_csphase(qpms_normalisation_t norm) {
|
|
|
|
return (norm & QPMS_NORMALISATION_T_CSBIT)? -1 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qpms_normalisation_t_normonly(qpms_normalisation_t norm) {
|
|
|
|
return norm & (~QPMS_NORMALISATION_T_CSBIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-17 17:02:58 +02:00
|
|
|
typedef enum {
|
|
|
|
QPMS_BESSEL_REGULAR = 1, // regular function j
|
|
|
|
QPMS_BESSEL_SINGULAR = 2, // singular function y
|
|
|
|
QPMS_HANKEL_PLUS = 3, // hankel function h1 = j + I*y
|
|
|
|
QPMS_HANKEL_MINUS = 4, // hankel function h2 = j - I*y
|
|
|
|
QPMS_BESSEL_UNDEF = 0
|
|
|
|
} qpms_bessel_t;
|
|
|
|
|
|
|
|
// coordinate system types
|
|
|
|
typedef struct {
|
|
|
|
double x, y, z;
|
|
|
|
} cart3_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
double x, y;
|
|
|
|
} cart2_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
double r, theta, phi;
|
|
|
|
} sph_t;
|
|
|
|
|
2017-12-17 19:07:19 +02:00
|
|
|
// complex vector components in local spherical basis
|
|
|
|
typedef struct {
|
|
|
|
complex double rc, thetac, phic;
|
|
|
|
} csphvec_t;
|
|
|
|
|
2017-12-17 17:02:58 +02:00
|
|
|
typedef struct {
|
|
|
|
double r, phi;
|
|
|
|
} pol_t;
|
|
|
|
|
|
|
|
#endif // QPMS_TYPES
|