FLAG  1.0b1
Exact Fourier-Laguerre transform in spherical coordinates
flag_sampling.c
Go to the documentation of this file.
1 // FLAG package
2 // Copyright (C) 2012
3 // Boris Leistedt & Jason McEwen
4 
5 #include "flag.h"
6 #include <math.h>
7 #include <stdlib.h>
8 #include <complex.h>
9 #include <fftw3.h>
10 #include <ssht.h>
11 #include <assert.h>
12 
13 void allocate_ssht_sampling(double **thetas, double **phis, int L)
14 {
15  assert(L > 0);
16  int nphi, ntheta;
17 
18  ntheta = ssht_sampling_mw_ntheta(L);
19  nphi = ssht_sampling_mw_nphi(L);
20 
21  /* FOR FUTURE IMPROVEMENTS // multi-scheme support
22  switch (method)
23  {
24  case MW:
25  ntheta = ssht_sampling_mw_ntheta(L);
26  nphi = ssht_sampling_mw_nphi(L);
27  break;
28  case MWSS:
29  ntheta = ssht_sampling_mw_ss_ntheta(L);
30  nphi = ssht_sampling_mw_ss_nphi(L);
31  break;
32  case GL:
33  ntheta = ssht_sampling_gl_ntheta(L);
34  nphi = ssht_sampling_gl_nphi(L);
35  break;
36  case DH:
37  ntheta = ssht_sampling_dh_ntheta(L);
38  nphi = ssht_sampling_dh_nphi(L);
39  break;
40  }
41  */
42 
43  *thetas = (double*)calloc(ntheta, sizeof(double));
44  *phis = (double*)calloc(nphi, sizeof(double));
45 
46 }
47 
48 void flag_sampling_allocate(double **rs, double **thetas, double **phis, double **laguweights, int L, int N)
49 {
50  assert(L > 0);
51  assert(N > 1);
52  allocate_ssht_sampling(thetas, phis, L);
53  flag_spherlaguerre_allocate_sampling(rs, laguweights, N);
54 }
55 
56 void ssht_sampling_mw(double *thetas, double *phis, int L)
57 {
58  assert(L > 0);
59  int t, p, nphi, ntheta;
60 
61  ntheta = ssht_sampling_mw_ntheta(L);
62  nphi = ssht_sampling_mw_nphi(L);
63  for (t=0; t<ntheta; t++)
64  thetas[t] = ssht_sampling_mw_t2theta(t, L);
65  for (p=0; p<nphi; p++)
66  phis[p] = ssht_sampling_mw_p2phi(p, L);
67 }
68 
69 void flag_sampling(double *rs, double *thetas, double *phis, double *laguweights, double tau, int L, int N)
70 {
71  assert(L > 0);
72  assert(N > 1);
73  assert(tau > 0.0);
74  flag_spherlaguerre_sampling(rs, laguweights, tau, N);
75  ssht_sampling_mw(thetas, phis, L);
76 }
void flag_sampling(double *rs, double *thetas, double *phis, double *laguweights, double tau, int L, int N)
Definition: flag_sampling.c:69
void flag_sampling_allocate(double **rs, double **thetas, double **phis, double **laguweights, int L, int N)
Definition: flag_sampling.c:48
void flag_spherlaguerre_allocate_sampling(double **nodes, double **weights, int N)
void allocate_ssht_sampling(double **thetas, double **phis, int L)
Definition: flag_sampling.c:13
void ssht_sampling_mw(double *thetas, double *phis, int L)
Definition: flag_sampling.c:56
void flag_spherlaguerre_sampling(double *nodes, double *weights, double tau, int N)