SHTns 3.7
shtns.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2021 Centre National de la Recherche Scientifique.
3 * written by Nathanael Schaeffer (CNRS, ISTerre, Grenoble, France).
4 *
5 * nathanael.schaeffer@univ-grenoble-alpes.fr
6 *
7 * This software is governed by the CeCILL license under French law and
8 * abiding by the rules of distribution of free software. You can use,
9 * modify and/or redistribute the software under the terms of the CeCILL
10 * license as circulated by CEA, CNRS and INRIA at the following URL
11 * "http://www.cecill.info".
12 *
13 * The fact that you are presently reading this means that you have had
14 * knowledge of the CeCILL license and that you accept its terms.
15 *
16 */
17
22#ifdef __cplusplus
23 #include <complex>
24 typedef std::complex<double> cplx;
25 typedef std::complex<float> cplx_f;
26#else
27 #include <complex.h>
28 typedef _Complex double cplx;
29 typedef _Complex float cplx_f;
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif /* __cplusplus */
35
38#define SHTNS_INTERFACE 0x307A0
39
41typedef struct shtns_info* shtns_cfg;
42
44typedef struct shtns_rot_* shtns_rot;
45
51 sht_for_rotations
52};
53#define SHT_NO_CS_PHASE (256*4)
54#define SHT_REAL_NORM (256*8)
55
66#define SHT_NATIVE_LAYOUT 0
67#define SHT_THETA_CONTIGUOUS 256
68#define SHT_PHI_CONTIGUOUS (256*2)
69#define SHT_SOUTH_POLE_FIRST (256*32)
70
71#define SHT_SCALAR_ONLY (256*16)
72#define SHT_LOAD_SAVE_CFG (256*64)
73#define SHT_ALLOW_GPU (256*128)
74#define SHT_ALLOW_PADDING (256*256)
75#define SHT_ROBERT_FORM (256*512)
76#define SHT_FP32 (256*1024)
77
78
79#ifndef SHTNS_PRIVATE
80struct shtns_info { // allow read-only access to some data (useful for optimization and helper macros)
81 const unsigned int nlm;
82 const unsigned short lmax;
83 const unsigned short mmax;
84 const unsigned short mres;
85 const unsigned short nlat_2;
86 const unsigned int nlat;
87 const unsigned int nphi;
88 const unsigned int nspat;
89 const unsigned short *const li;
90 const unsigned short *const mi;
91 const double *const ct;
92 const double *const st;
93 const unsigned int nlat_padded;
94 const unsigned int nlm_cplx;
95};
96#endif
97
98// MACROS //
99
104
106#define LiM(shtns, l,im) ( (((im)*(2*shtns->lmax + 2 - ((im)+1)*shtns->mres))>>1) + (l) )
108#define LM(shtns, l,m) ( (((((unsigned short)(m))/shtns->mres)*(2*shtns->lmax + 2 - ((m)+shtns->mres)))>>1) + (l) )
111#define LM_LOOP( shtns, action ) { int lm=0; do { action } while(++lm < shtns->nlm); }
114#define LM_L_LOOP( shtns, action ) { int lm=0; do { int l=shtns->li[lm]; action } while(++lm < shtns->nlm); }
116#define LM_cplx(shtns, l, m) ( ((l) <= shtns->mmax) ? (l)*((l)+1)+(m) : shtns->mmax*(2*(l) - shtns->mmax) + (l)+(m) )
118
119
122#define NSPAT_ALLOC(shtns) (shtns->nspat)
123
124// HELPER MACROS //
125
127#define PHI_DEG(shtns, ip) (360./(shtns->nphi*shtns->mres))*(ip)
129#define PHI_RAD(shtns, ip) (2.*M_PI/(shtns->nphi*shtns->mres))*(ip)
130
131
132// FUNCTIONS //
133
135long nlm_calc(long lmax, long mmax, long mres);
136
138long nlm_cplx_calc(long lmax, long mmax, long mres);
139
141int im_from_lm(long lm, int lmax, int mres);
142
143void shtns_verbose(int);
144void shtns_print_version(void);
145const char* shtns_get_build_info(void);
146
147#ifndef SWIG
148
150
153
155shtns_cfg shtns_init(enum shtns_type flags, int lmax, int mmax, int mres, int nlat, int nphi);
157shtns_cfg shtns_create(int lmax, int mmax, int mres, enum shtns_norm norm);
159int shtns_set_grid(shtns_cfg, enum shtns_type flags, double eps, int nlat, int nphi);
161int shtns_set_grid_auto(shtns_cfg, enum shtns_type flags, double eps, int nl_order, int *nlat, int *nphi);
163shtns_cfg shtns_create_with_grid(shtns_cfg, int mmax, int nofft);
165int shtns_use_threads(int num_threads);
167int shtns_set_many(shtns_cfg shtns, int howmany, long spec_dist);
168
169void shtns_reset(void);
172
174void shtns_robert_form(shtns_cfg, int robert);
175
176void* shtns_malloc(size_t bytes);
177void shtns_free(void* p);
178
179
181
184double sh00_1(shtns_cfg);
185double sh10_ct(shtns_cfg);
186double sh11_st(shtns_cfg);
187double shlm_e1(shtns_cfg, int l, int m);
189int shtns_gauss_wts(shtns_cfg, double *wts);
190
192
195
199void SH_Zrotate(shtns_cfg, cplx *Qlm, double alpha, cplx *Rlm);
201void SH_Yrotate(shtns_cfg, cplx *Qlm, double alpha, cplx *Rlm);
203void SH_Yrotate90(shtns_cfg, cplx *Qlm, cplx *Rlm);
205void SH_Xrotate90(shtns_cfg, cplx *Qlm, cplx *Rlm);
206
207
209shtns_rot shtns_rotation_create(const int lmax, const int mmax, int norm);
213void shtns_rotation_set_angles_ZYZ(shtns_rot r, double alpha, double beta, double gamma);
215void shtns_rotation_set_angles_ZXZ(shtns_rot r, double alpha, double beta, double gamma);
217void shtns_rotation_set_angle_axis(shtns_rot r, double theta, double Vx, double Vy, double Vz);
221int shtns_rotation_wigner_d_matrix(shtns_rot r, const int l, double* mx);
223void shtns_rotation_apply_cplx(shtns_rot r, cplx* Zlm, cplx* Rlm);
225void shtns_rotation_apply_real(shtns_rot r, cplx* Qlm, cplx* Rlm);
226
228
231
240int legendre_sphPlm_array(shtns_cfg shtns, const int lmax, const int im, const double x, double *yl);
241int legendre_sphPlm_deriv_array(shtns_cfg shtns, const int lmax, const int im, const double x, const double sint, double *yl, double *dyl);
243
246
249void mul_ct_matrix(shtns_cfg, double* mx);
252void st_dt_matrix(shtns_cfg, double* mx);
254void SH_mul_mx(shtns_cfg, double* mx, cplx *Qlm, cplx *Rlm);
256
264
267
272void spat_to_SH(shtns_cfg shtns, double *Vr, cplx *Qlm);
277void SH_to_spat(shtns_cfg shtns, cplx *Qlm, double *Vr);
282void SH_to_spat_cplx(shtns_cfg shtns, cplx *alm, cplx *z);
287void spat_cplx_to_SH(shtns_cfg shtns, cplx *z, cplx *alm);
289
292
294void spat_to_SHsphtor(shtns_cfg, double *Vt, double *Vp, cplx *Slm, cplx *Tlm);
296void SHsphtor_to_spat(shtns_cfg, cplx *Slm, cplx *Tlm, double *Vt, double *Vp);
298void SHsph_to_spat(shtns_cfg, cplx *Slm, double *Vt, double *Vp);
300void SHtor_to_spat(shtns_cfg, cplx *Tlm, double *Vt, double *Vp);
301
303void spat_cplx_to_SHsphtor(shtns_cfg, cplx *Vt, cplx *Vp, cplx *Slm, cplx *Tlm);
305void SHsphtor_to_spat_cplx(shtns_cfg, cplx *Slm, cplx *Tlm, cplx *Vt, cplx *Vp);
308#define SH_to_grad_spat(shtns, S,Gt,Gp) SHsph_to_spat(shtns, S, Gt, Gp)
309
312
315void spat_to_SHqst(shtns_cfg, double *Vr, double *Vt, double *Vp, cplx *Qlm, cplx *Slm, cplx *Tlm);
318void SHqst_to_spat(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double *Vr, double *Vt, double *Vp);
319
320void spat_cplx_to_SHqst(shtns_cfg, cplx *Vr, cplx *Vt, cplx *Vp, cplx *Qlm, cplx *Slm, cplx *Tlm);
321void SHqst_to_spat_cplx(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, cplx *Vr, cplx *Vt, cplx *Vp);
323
327void spat_to_SH_l(shtns_cfg, double *Vr, cplx *Qlm, int ltr);
328void SH_to_spat_l(shtns_cfg, cplx *Qlm, double *Vr, int ltr);
329
330void SHsphtor_to_spat_l(shtns_cfg, cplx *Slm, cplx *Tlm, double *Vt, double *Vp, int ltr);
331void SHsph_to_spat_l(shtns_cfg, cplx *Slm, double *Vt, double *Vp, int ltr);
332void SHtor_to_spat_l(shtns_cfg, cplx *Tlm, double *Vt, double *Vp, int ltr);
333void spat_to_SHsphtor_l(shtns_cfg, double *Vt, double *Vp, cplx *Slm, cplx *Tlm, int ltr);
334
335void spat_to_SHqst_l(shtns_cfg, double *Vr, double *Vt, double *Vp, cplx *Qlm, cplx *Slm, cplx *Tlm, int ltr);
336void SHqst_to_spat_l(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double *Vr, double *Vt, double *Vp, int ltr);
339#define SH_to_grad_spat_l(shtns, S,Gt,Gp,ltr) SHsph_to_spat_l(shtns, S, Gt, Gp, ltr)
340
345void spat_to_SH_ml(shtns_cfg, int im, cplx *Vr, cplx *Ql, int ltr);
346void SH_to_spat_ml(shtns_cfg, int im, cplx *Ql, cplx *Vr, int ltr);
347
348void spat_to_SHsphtor_ml(shtns_cfg, int im, cplx *Vt, cplx *Vp, cplx *Sl, cplx *Tl, int ltr);
349void SHsphtor_to_spat_ml(shtns_cfg, int im, cplx *Sl, cplx *Tl, cplx *Vt, cplx *Vp, int ltr);
350void SHsph_to_spat_ml(shtns_cfg, int im, cplx *Sl, cplx *Vt, cplx *Vp, int ltr);
351void SHtor_to_spat_ml(shtns_cfg, int im, cplx *Tl, cplx *Vt, cplx *Vp, int ltr);
352
353void spat_to_SHqst_ml(shtns_cfg, int im, cplx *Vr, cplx *Vt, cplx *Vp, cplx *Ql, cplx *Sl, cplx *Tl, int ltr);
354void SHqst_to_spat_ml(shtns_cfg, int im, cplx *Ql, cplx *Sl, cplx *Tl, cplx *Vr, cplx *Vt, cplx *Vp, int ltr);
357#define SH_to_grad_spat_ml(shtns, im, S,Gt,Gp,ltr) SHsph_to_spat_ml(shtns, im, S, Gt, Gp, ltr)
358
360
364double SH_to_point(shtns_cfg, cplx *Qlm, double cost, double phi);
365void SH_to_point_cplx(shtns_cfg, cplx *alm, double cost, double phi, cplx* z_out);
366void SH_to_grad_point(shtns_cfg, cplx *DrSlm, cplx *Slm,
367 double cost, double phi, double *vr, double *vt, double *vp);
368void SHqst_to_point(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm,
369 double cost, double phi, double *vr, double *vt, double *vp);
370
371void SH_to_lat(shtns_cfg shtns, cplx *Qlm, double cost,
372 double *vr, int nphi, int ltr, int mtr);
373void SHqst_to_lat(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double cost,
374 double *vr, double *vt, double *vp, int nphi, int ltr, int mtr);
376
377void shtns_profiling(shtns_cfg shtns, int on);
378double shtns_profiling_read_time(shtns_cfg shtns, double* t1, double* t2);
379double SH_to_spat_time(shtns_cfg shtns, cplx *Qlm, double *Vr);
380double spat_to_SH_time(shtns_cfg shtns, double *Vr, cplx *Qlm);
381
382#endif
383
384#ifdef __cplusplus
385}
386#endif /* __cplusplus */
void shtns_rotation_set_angle_axis(shtns_rot r, double theta, double Vx, double Vy, double Vz)
Defines a rotation of angle theta around axis of cartesian coordinates (Vx,Vy,Vz).
Definition sht_func.c:1511
void SH_Xrotate90(shtns_cfg, cplx *Qlm, cplx *Rlm)
rotate Qlm by 90 degrees around X axis and store the result in Rlm.
Definition sht_func.c:367
void SH_Yrotate(shtns_cfg, cplx *Qlm, double alpha, cplx *Rlm)
rotate Qlm around Y axis by arbitrary angle, using composition of rotations. Store the result in Rlm.
Definition sht_func.c:404
void shtns_rotation_apply_cplx(shtns_rot r, cplx *Zlm, cplx *Rlm)
apply rotation to the orthonormal spherical harmonic expansion Zlm of a complex-valued field,...
Definition sht_func.c:1977
void SH_Zrotate(shtns_cfg, 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 ro...
Definition sht_func.c:38
void shtns_rotation_destroy(shtns_rot r)
Release memory allocated for the rotation object.
Definition sht_func.c:1436
void shtns_rotation_set_angles_ZXZ(shtns_rot r, double alpha, double beta, double gamma)
Defines a rotation parameterized by the 3 intrinsic Euler angles with ZXZ convention.
Definition sht_func.c:1505
void SH_Yrotate90(shtns_cfg, cplx *Qlm, cplx *Rlm)
rotate Qlm by 90 degrees around Y axis and store the result in Rlm.
Definition sht_func.c:386
shtns_rot shtns_rotation_create(const int lmax, const int mmax, int norm)
Creation of a spherical harmonic rotation object for degrees and orders up to lmax and mmax respectiv...
Definition sht_func.c:1419
void shtns_rotation_set_angles_ZYZ(shtns_rot r, double alpha, double beta, double gamma)
Defines a rotation parameterized by the 3 intrinsic Euler angles with ZYZ convention.
Definition sht_func.c:1468
void shtns_rotation_apply_real(shtns_rot r, cplx *Qlm, cplx *Rlm)
apply rotation to the orthonormal spherical harmonic expansion Qlm of a real field,...
Definition sht_func.c:1695
int shtns_rotation_wigner_d_matrix(shtns_rot r, const int l, double *mx)
Generate spherical-harmonic rotation matrix for given degree l and orthonormal convention (Wigner-d m...
Definition sht_func.c:1612
int shtns_set_many(shtns_cfg shtns, int howmany, long spec_dist)
Sets the number of transforms to be performed together (batch). Must be called before shtns_set_grid ...
Definition sht_init.c:1561
void shtns_destroy(shtns_cfg)
free memory of given config, which cannot be used afterwards.
Definition sht_init.c:1268
int shtns_use_threads(int num_threads)
Enables multi-thread transform using OpenMP with num_threads (if available). Returns number of thread...
Definition sht_init.c:1605
int shtns_set_grid(shtns_cfg, enum shtns_type flags, double eps, int nlat, int nphi)
Precompute everything for a given spatial grid. Use for advanced initialization, after shtns_create.
Definition sht_init.c:1544
void * shtns_malloc(size_t bytes)
allocate appropriate CPU memory (pinned for gpu, aligned for avx, ...). Use shtns_free to free it.
Definition sht_init.c:1316
shtns_cfg shtns_create(int lmax, int mmax, int mres, enum shtns_norm norm)
Defines the sizes of the spectral description. Use for advanced initialization.
Definition sht_init.c:1100
void shtns_unset_grid(shtns_cfg)
unset the grid.
Definition sht_init.c:1258
void shtns_reset(void)
destroy all configs, free memory, and go back to initial state.
Definition sht_init.c:1310
shtns_cfg shtns_init(enum shtns_type flags, int lmax, int mmax, int mres, int nlat, int nphi)
Simple initialization of the spherical harmonic transforms of given size. Calls shtns_create and shtn...
Definition sht_init.c:1583
shtns_cfg shtns_create_with_grid(shtns_cfg, int mmax, int nofft)
Copy a given config but allow a different (smaller) mmax and the possibility to enable/disable fft.
Definition sht_init.c:1225
long nlm_cplx_calc(long lmax, long mmax, long mres)
compute number of spherical harmonics modes (l,m) to represent a complex-valued spatial field,...
Definition sht_init.c:106
int shtns_gauss_wts(shtns_cfg, double *wts)
fill the given array with Gauss weights. returns the number of weights written (0 if not a Gauss grid...
Definition sht_init.c:1621
long nlm_calc(long lmax, long mmax, long mres)
compute number of spherical harmonics modes (l,m) to represent a real-valued spatial field for given ...
Definition sht_init.c:98
void shtns_free(void *p)
free memory allocated with shtns_malloc
Definition sht_init.c:1320
void shtns_robert_form(shtns_cfg, int robert)
set the use of Robert form. If robert != 0, the vector synthesis returns a field multiplied by sin(th...
Definition sht_init.c:1592
int shtns_set_grid_auto(shtns_cfg, enum shtns_type flags, double eps, int nl_order, int *nlat, int *nphi)
Precompute everything and choose the optimal nlat and nphi for a given non-linear order.
Definition sht_init.c:1353
void SHqst_to_point(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double cost, double phi, double *vr, double *vt, double *vp)
Evaluate vector SH representation Qlm at physical point defined by cost = cos(theta) and phi.
Definition sht_func.c:694
void SH_to_point_cplx(shtns_cfg, cplx *alm, double cost, double phi, cplx *z_out)
writes value to z_out.
Definition sht_func.c:541
void SH_to_lat(shtns_cfg shtns, cplx *Qlm, double cost, double *vr, int nphi, int ltr, int mtr)
synthesis at a given latitude, on nphi equispaced longitude points.
Definition sht_func.c:840
void SHqst_to_lat(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double cost, double *vr, double *vt, double *vp, int nphi, int ltr, int mtr)
synthesis at a given latitude, on nphi equispaced longitude points.
Definition sht_func.c:757
double SH_to_point(shtns_cfg, cplx *Qlm, double cost, double phi)
Evaluate scalar SH representation Qlm at physical point defined by cost = cos(theta) and phi.
Definition sht_func.c:610
void SH_mul_mx(shtns_cfg, double *mx, cplx *Qlm, cplx *Rlm)
Apply a matrix involving l+1 and l-1 to an SH representation Qlm. Result stored in Rlm (must be diffe...
Definition sht_func.c:509
void st_dt_matrix(shtns_cfg, double *mx)
compute the matrix (stored in mx, a double array of size 2*NLM) required to apply sin(theta)*d/dtheta...
Definition sht_func.c:496
void mul_ct_matrix(shtns_cfg, double *mx)
compute the matrix (stored in mx, a double array of size 2*NLM) required to multiply an SH representa...
Definition sht_func.c:478
void SHqst_to_spat(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, double *Vr, double *Vt, double *Vp)
3D vector transform from radial-spheroidal-toroidal spectral components (see Radial - Spheroidal - To...
Definition sht_com.c:65
void SHtor_to_spat(shtns_cfg, cplx *Tlm, double *Vt, double *Vp)
transform toroidal spherical harmonic coefficients Tlm to the spatial theta and phi components (Vt,...
Definition sht_com.c:73
void SHqst_to_spat_cplx(shtns_cfg, cplx *Qlm, cplx *Slm, cplx *Tlm, cplx *Vr, cplx *Vt, cplx *Vp)
complex vector transform (3D).
Definition sht_func.c:1231
void SHsph_to_spat(shtns_cfg, cplx *Slm, double *Vt, double *Vp)
transform spheroidal spherical harmonic coefficients Slm to the spatial theta and phi components (Vt,...
Definition sht_com.c:77
void SHsphtor_to_spat(shtns_cfg, cplx *Slm, cplx *Tlm, double *Vt, double *Vp)
transform spheroidal-toroidal spherical harmonic coefficients (Slm,Tlm) to the spatial theta and phi ...
Definition sht_com.c:57
void spat_to_SHqst(shtns_cfg, double *Vr, double *Vt, double *Vp, cplx *Qlm, cplx *Slm, cplx *Tlm)
3D vector transform from spherical coordinates to radial-spheroidal-toroidal spectral components (see...
Definition sht_com.c:69
void SHsphtor_to_spat_cplx(shtns_cfg, cplx *Slm, cplx *Tlm, cplx *Vt, cplx *Vp)
transform spheroidal-toroidal spherical harmonic coefficients (Slm,Tlm) to the spatial theta and phi ...
Definition sht_func.c:1085
void spat_cplx_to_SHsphtor(shtns_cfg, cplx *Vt, cplx *Vp, cplx *Slm, cplx *Tlm)
transform the theta and phi components (Vt,Vp) of a complex valued vector into its spheroidal-toroida...
Definition sht_func.c:1160
void spat_to_SH(shtns_cfg shtns, double *Vr, cplx *Qlm)
transform the scalar field Vr into its spherical harmonic representation Qlm.
Definition sht_com.c:53
void SH_to_spat(shtns_cfg shtns, cplx *Qlm, double *Vr)
transform the spherical harmonic coefficients Qlm into its spatial representation Vr.
Definition sht_com.c:49
void spat_cplx_to_SHqst(shtns_cfg, cplx *Vr, cplx *Vt, cplx *Vp, cplx *Qlm, cplx *Slm, cplx *Tlm)
complex vector transform (3D).
Definition sht_func.c:1222
void SH_to_spat_cplx(shtns_cfg shtns, cplx *alm, cplx *z)
complex scalar synthesis.
Definition sht_func.c:1023
void spat_cplx_to_SH(shtns_cfg shtns, cplx *z, cplx *alm)
complex scalar analysis.
Definition sht_func.c:968
void spat_to_SHsphtor(shtns_cfg, double *Vt, double *Vp, cplx *Slm, cplx *Tlm)
transform the theta and phi components (Vt,Vp) of a vector into its spheroidal-toroidal spherical har...
Definition sht_com.c:61
struct shtns_rot_ * shtns_rot
pointer to data structure describing a rotation, returned by shtns_rotation_create().
Definition shtns.h:44
int im_from_lm(long lm, int lmax, int mres)
returns index im = m/mres where m is order of index lm into spherical harmonic array.
Definition sht_init.c:116
_Complex double cplx
double precision complex number data type
Definition shtns.h:28
const char * shtns_get_build_info(void)
get version and build information as a string (the same as the one printed by shtns_print_version())
Definition sht_init.c:920
double sh10_ct(shtns_cfg)
return the spherical harmonic representation of cos(theta) (l=1,m=0)
Definition sht_init.c:81
void shtns_verbose(int)
controls output during initialization: 0=no output (default), 1=some output, 2=degug (if compiled in)
Definition sht_init.c:51
void shtns_profiling(shtns_cfg shtns, int on)
on!=0: turn profiling on, on==0: turn off
Definition sht_init.c:173
void shtns_print_version(void)
print version information to stdout.
Definition sht_init.c:944
double spat_to_SH_time(shtns_cfg shtns, double *Vr, cplx *Qlm)
same as spat_to_SH() but with time recording; returns time in seconds
Definition sht_com.c:39
int legendre_sphPlm_array(shtns_cfg shtns, const int lmax, const int im, const double x, double *yl)
Compute values of legendre polynomials noramalized for spherical harmonics, for a range of l=m....
double shtns_profiling_read_time(shtns_cfg shtns, double *t1, double *t2)
read timers of last transform. total time is returned, time for legendre and fourier are put in t1 an...
Definition sht_init.c:180
void shtns_print_cfg(shtns_cfg)
print information about given config to stdout.
Definition sht_init.c:965
double shlm_e1(shtns_cfg, int l, int m)
return the l,m SH coefficient corresponding to unit energy.
Definition sht_init.c:89
double sh00_1(shtns_cfg)
return the spherical harmonic representation of 1 (l=0,m=0)
Definition sht_init.c:77
struct shtns_info * shtns_cfg
pointer to data structure describing an SHT, returned by shtns_init() or shtns_create().
Definition shtns.h:41
_Complex float cplx_f
single precision (float) complex number data type
Definition shtns.h:29
shtns_type
different SHT types and algorithms
Definition shtns.h:57
@ sht_quick_init
gauss grid, with minimum initialization time (useful for pre/post-processing)
Definition shtns.h:62
@ sht_reg_poles
quick initialization of a regular grid including poles (Clenshaw-Curtis quadrature)....
Definition shtns.h:63
@ sht_reg_dct
slow initialization of a regular grid (self-tuning). The grid is equispaced and avoids the poles (Féj...
Definition shtns.h:61
@ sht_auto
use fastest algorithm and grid. This currently implies using the Gauss grid and is thus the same as s...
Definition shtns.h:59
@ sht_reg_fast
quick initialization of a regular grid. The grid is the same as with sht_reg_dct
Definition shtns.h:60
@ sht_gauss_fly
legendre polynomials are recomputed on-the-fly for each transform (may be faster on some machines,...
Definition shtns.h:64
@ sht_gauss
use gaussian grid and quadrature. Allows on-the-fly or matrix-based algorithms.
Definition shtns.h:58
double sh11_st(shtns_cfg)
return the spherical harmonic representation of sin(theta)*cos(phi) (l=1,m=1)
Definition sht_init.c:85
shtns_norm
Different Spherical Harmonic normalizations. See also section Normalization for details.
Definition shtns.h:47
@ sht_fourpi
Geodesy and spectral analysis : 4.pi normalization.
Definition shtns.h:49
@ sht_orthonormal
orthonormalized spherical harmonics (default).
Definition shtns.h:48
@ sht_schmidt
Schmidt semi-normalized : 4.pi/(2l+1)
Definition shtns.h:50
double SH_to_spat_time(shtns_cfg shtns, cplx *Qlm, double *Vr)
same as SH_to_spat() but with time recording; returns time in seconds
Definition sht_com.c:32
Definition shtns.h:80
const unsigned int nphi
number of spatial points in Phi direction (longitude)
Definition shtns.h:87
const double *const ct
cos(theta) array (size nlat)
Definition shtns.h:91
const unsigned short lmax
maximum degree (lmax) of spherical harmonics.
Definition shtns.h:82
const double *const st
sin(theta) array (size nlat)
Definition shtns.h:92
const unsigned short *const li
degree l for given mode index (size nlm) : li[lm]
Definition shtns.h:89
const unsigned short mmax
maximum order (mmax*mres) of spherical harmonics.
Definition shtns.h:83
const unsigned int nlm
total number of (l,m) spherical harmonics components.
Definition shtns.h:81
const unsigned int nlat_padded
number of spatial points in Theta direction, including padding.
Definition shtns.h:93
const unsigned int nlm_cplx
number of complex coefficients to represent a complex-valued spatial field.
Definition shtns.h:94
const unsigned short *const mi
order m for given mode index (size nlm) : mi[lm]
Definition shtns.h:90
const unsigned int nspat
number of real numbers that must be allocated in a spatial field.
Definition shtns.h:88
const unsigned short mres
the periodicity along the phi axis.
Definition shtns.h:84
const unsigned short nlat_2
half of spatial points in Theta direction (using (shtns.nlat+1)/2 allows odd shtns....
Definition shtns.h:85
const unsigned int nlat
number of spatial points in Theta direction (latitude) ...
Definition shtns.h:86