SHTns  3.4.6
Functions
Rotation of SH fields.

Rotation around axis other than Z should be considered of beta quality (they have been tested but may still contain bugs). More...

Functions

void SH_Zrotate (shtns_cfg shtns, cplx *Qlm, double alpha, cplx *Rlm)
 Rotate a SH representation Qlm around the z-axis by angle alpha (in radians), which is the same as rotating the reference frame by angle -alpha. More...
 
void SH_Xrotate90 (shtns_cfg shtns, cplx *Qlm, cplx *Rlm)
 rotate Qlm by 90 degrees around X axis and store the result in Rlm. More...
 
void SH_Yrotate90 (shtns_cfg shtns, cplx *Qlm, cplx *Rlm)
 rotate Qlm by 90 degrees around Y axis and store the result in Rlm. More...
 
void SH_Yrotate (shtns_cfg shtns, cplx *Qlm, double alpha, cplx *Rlm)
 rotate Qlm around Y axis by arbitrary angle, using composition of rotations. Store the result in Rlm. More...
 

Rotation functions

Rotate a SH representation Qlm around the z-axis by angle alpha (in radians), which is the same as rotating the reference frame by angle -alpha.

Result is stored in Rlm (which can be the same array as Qlm).

shtns_rot shtns_rotation_create (const int lmax, const int mmax)
 Allocate memory and precompute some recurrence coefficients for rotation (independent of angle). More...
 
void shtns_rotation_destroy (shtns_rot r)
 
void shtns_rotation_set_angles_ZYZ (shtns_rot r, double alpha, double beta, double gamma)
 Set the rotation angle, and compute associated Legendre functions.
 
void shtns_rotation_set_angles_ZXZ (shtns_rot r, double alpha, double beta, double gamma)
 
void shtns_rotation_set_angle_axis (shtns_rot r, double theta, double Vx, double Vy, double Vz)
 
void shtns_rotation_wigner_d_matrix (shtns_rot r, const int l, double *mx)
 Generate spherical-harmonic rotation matrix for given degree l (Wigner-d matrix), using GUMEROV's algorithm see https://arxiv.org/abs/1403.7698 or https://doi.org/10.1007/978-3-319-13230-3_5 Thanks to Alex J. More...
 
void shtns_rotation_apply_cplx (shtns_rot r, cplx *Zlm, cplx *Rlm)
 rotate Zlm, store the result in Rlm, without ever storing the wigner-d matrices (on-the-fly operation)
 
void shtns_rotation_apply_real (shtns_rot r, cplx *Qlm, cplx *Rlm)
 

Detailed Description

Rotation around axis other than Z should be considered of beta quality (they have been tested but may still contain bugs).

They also require mmax = lmax. They use an Algorithm inspired by the pseudospectral rotation described in Gimbutas Z. and Greengard L. 2009 "A fast and stable method for rotating spherical harmonic expansions" Journal of Computational Physics. doi:10.1016/j.jcp.2009.05.014

These functions do only require a call to shtns_create, but not to shtns_set_grid.

Function Documentation

◆ SH_Xrotate90()

void SH_Xrotate90 ( shtns_cfg  shtns,
cplx Qlm,
cplx Rlm 
)

rotate Qlm by 90 degrees around X axis and store the result in Rlm.

Rotate SH representation around X axis by 90 degrees.

shtns->mres MUST be 1, and lmax=mmax.

◆ SH_Yrotate()

void SH_Yrotate ( shtns_cfg  shtns,
cplx Qlm,
double  alpha,
cplx Rlm 
)

rotate Qlm around Y axis by arbitrary angle, using composition of rotations. Store the result in Rlm.

Rotate SH representation around Y axis by alpha (in radians).

◆ SH_Yrotate90()

void SH_Yrotate90 ( shtns_cfg  shtns,
cplx Qlm,
cplx Rlm 
)

rotate Qlm by 90 degrees around Y axis and store the result in Rlm.

Rotate SH representation around Y axis by 90 degrees.

shtns->mres MUST be 1, and lmax=mmax.

◆ SH_Zrotate()

void SH_Zrotate ( shtns_cfg  shtns,
cplx Qlm,
double  alpha,
cplx Rlm 
)

Rotate a SH representation Qlm around the z-axis by angle alpha (in radians), which is the same as rotating the reference frame by angle -alpha.

Result is stored in Rlm (which can be the same array as Qlm).

◆ shtns_rotation_create()

shtns_rot shtns_rotation_create ( const int  lmax,
const int  mmax 
)

Allocate memory and precompute some recurrence coefficients for rotation (independent of angle).

Setting mmax < lmax will result in approximate rotations if not aligned with the z-axis, while mmax=lmax leads to exact rotations.

◆ shtns_rotation_wigner_d_matrix()

void shtns_rotation_wigner_d_matrix ( shtns_rot  r,
const int  l,
double *  mx 
)

Generate spherical-harmonic rotation matrix for given degree l (Wigner-d matrix), using GUMEROV's algorithm see https://arxiv.org/abs/1403.7698 or https://doi.org/10.1007/978-3-319-13230-3_5 Thanks to Alex J.

Yuffa, ayuff.nosp@m.a@gm.nosp@m.ail.c.nosp@m.om for his suggestions and help.

Parameters
[out]mxis an (2*l+1)*(2*l+1) array that will be filled with the Wigner-d matrix elements.