-
Notifications
You must be signed in to change notification settings - Fork 7
/
sh.h
158 lines (127 loc) · 3.06 KB
/
sh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#ifndef __SH_HEADER_READ__
#ifdef HC_USE_HEALPIX
/*
load definitions for complex variable structures, Healpix structure
and declarations of Healpix related functions
*/
#include "myhealpix.h"
#endif
/*
same for Rick's spherical harmonic routines
*/
#define SH_RICK_PRECISION HC_PRECISION
#include "sh_rick.h"
/*
shana
*/
#include "sh_shana.h"
/*
spherical harmonics types
*/
#define SH_RICK 0 /* Rick's Gauss quadrature/FFT routines */
#define SH_HEALPIX 1 /* Healpix package */
#define SH_SHANA 2 /* grid based spherical harmonics, similar to SH_RICK
but no FFT/Gauss points
*/
/*
my spherical harmonics structures
*/
/*
individual expansion
*/
struct sh_lms{
int type; /* this is the type of expansion
HEALPIX: ab will be in imaginary convention
*/
/* have the spatial or the spherical versions been initialized? */
my_boolean spectral_init;
/* l_max */
int lmax;
/* bounds from above + 1 */
int lmaxp1;
/*
two ways of storing the (l,m) arrays
*/
int lmbig; /* (lmax+1)**2 */
int lmsmall2; /* (exp->lmax+1)*(exp->lmax+2)for A and B */
/*
number of A,B entries, and total number of entries for a
spherical harmonics expansion set (depends on ivec)
*/
int n_lm;
/*
number of entries for the Legendre function array
*/
int n_plm,tn_plm,tn_plm_irr;
/*
number of points in each layer the spatial domain
*/
int npoints;
/*
*/
hc_boolean plm_computed,plm_computed_irr;
int old_lmax,old_ivec,old_tnplm,old_tnplm_irr,
old_lmax_irr,old_ivec_irr;
/*
holds the coefficients:
*/
#ifdef HC_USE_HEALPIX
/*
for Healpix
*/
struct scmplx *alm_c; /* single prec complex */
/*
for HEALPIX
*/
struct healpix_parameters heal;
#endif
/*
for Rick type
*/
SH_RICK_PREC *alm;
struct rick_module rick;
};
/*
spherical harmonics model structure, this holds several spherical
harmonic expansions
*/
struct sh_lms_model{
/*
number of sets
*/
int nset;
/*
Legendre polynomial flags
*/
my_boolean save_plm;
/* layer indicators if nset != 1 */
HC_PREC *z;
/* scalar only? ivec=0 or velocities? ivec=1 */
int ivec;
/* number of expansions per set */
int shps;
/* expansions */
struct sh_lms *exp;
int nexp; /* number of expansions */
SH_RICK_PREC *plm; /* precomputed Legendre
functions */
/*
spatial data points
*/
int tnpoints; /* number of the total datapoints */
/* data structure */
HC_PREC *data;
my_boolean spatial_init, initialized;
};
/*
compute the (l,m) index of a tighly packed array of lmsize2
size. arrays are C style (0...lmsize2-1).
lmsize2 = (lmax+1)*(lmax+2), which holds all A and B coefficients
of an expansion of maximum order lmax
this assumes that A and B coefficients are stored next to each
other. pass a_or_b as 0 or 1 for A or B coefficients, respectively
0 <= l <= lmax, 0 <= m <= l, 0 <= a_or_b <= 1
*/
#define LM_INDEX(l,m,a_or_b) ((((l)+1)*(l)/2+(m))*2+(a_or_b))
#define __SH_HEADER_READ__
#endif