GremlinEq
SWSH.h
1 //---------------------------------------------------------------------------
2 //
3 // $Id: SWSH.h,v 1.15 2019/01/26 17:56:16 sahughes Exp $
4 //
5 //---------------------------------------------------------------------------
6 //
7 // Prototypes and classes I've written for the SWSH code, plus
8 // generically used header files.
9 //
10 // Scott Hughes, 24 July 1998
11 //
12 
13 //
14 // class Clebsch contains all the routines that do things with
15 // Clebsch-Gordan coefficients. See swsh_cgutil.cc for details.
16 //
17 #ifndef _SWSH_H
18 #define _SWSH_H
19 
20 #include "Globals.h"
21 #include <gsl/gsl_sf_gamma.h>
22 #include <gsl/gsl_math.h>
23 #include <gsl/gsl_eigen.h>
24 
25 #define MAXCOFS 1000
26 #define CHEBCOFS 256
27 
29 
30 class Clebsch {
31 public:
32  Real xbrac(const int s, const int q, const int p, const int m);
33  Real xsqrbrac(const int s, const int q, const int p, const int m);
34  //
35  // <s,p,m|sin(theta)|s,q,mp>
36  //
37 
39  Real sinthetabrac(const int s, const int p, const int q, const int m,
40  const int mp);
41 
42 private:
43  Real cgcof(const int j1, const int j2, const int m1, const int m2,
44  const int J, const int M);
45 };
46 
47 //
48 // class SWSH contains all the routines that do things with
49 // spin-weighted spheroidal harmonics. See swsh_spheroid.cc
50 // for details.
51 //
52 
54 
55 class SWSH {
56 public:
58 
61  SWSH(const int ss, const int ll, const int mm, const Real spintimesfreq);
62 
63  void expand(Real *E, Real *b, int *n);
64  Real error(const Real E, const Real b[], const int n);
65 
66  Real spheroid(const Real x);
67  Real l2dagspheroid(const Real x);
68  Real l1dagl2dagspheroid(const Real x);
69  Complex edthbaredthbarspheroid(const Real a, const Real x);
70 
71  Real pos2Y(const int l, const int m, const Real x);
72  Real pos1Y(const int l, const int m, const Real x);
73  Real zeroY(const int l, const int m, const Real x);
74  Real dzeroYdx(const int l, const int m, const Real x);
75  Real neg1Y(const int l, const int m, const Real x);
76  Real neg2Y(const int l, const int m, const Real x);
77 
78  Real E, lambda;
79 
80  Real b[MAXCOFS + 1];
81  int lmin;
82  int N;
83 
84  int Gl;
85 
86 private:
87  Real pref_A_func(const int l, const int m);
88 
89  Real plgndr(const int l, const int m, const Real x);
90  Real plgndr_over_sin(const int l, const int m, const Real x);
91  Real plgndr_over_sinsqr(const int l, const int m, const Real x);
92 
93  Real dplgndr(const int l, const int m, const Real x);
94  Real sin_times_dplgndr(const int l, const int m, const Real x);
95 
96  Real sinsqr_times_ddplgndr(const int l, const int m, const Real x);
97  //
98  // "Raw" spheroidal routines.
99  //
100  Real raw_spheroid(const Real x);
101  Real raw_l2dagspheroid(const Real x);
102  Real raw_l1dagl2dagspheroid(const Real x);
103  //
104  // Routines to compute Chebyshev expansion coefficients.
105  //
106  void cheb_spheroid();
107  void cheb_l2dagspheroid();
108  void cheb_l1dagl2dagspheroid();
109  //
110  // Storage of Chebyshev expansion coefficients.
111  //
112  Real spheroid_cofs[CHEBCOFS];
113  Real l2dagspheroid_cofs[CHEBCOFS];
114  Real l1dagl2dagspheroid_cofs[CHEBCOFS];
115  //
116  // Last nontrivial expansion coefficients.
117  //
118  int N_spheroid;
119  int N_l2dagspheroid;
120  int N_l1dagl2dagspheroid;
121 
122  int findeig(Real *M, const int K, Real *e, Real b[]);
123  void load_M(Real *M, const int K);
124 
125  // Used globally by the functions:
126  //
127  // s = spin weight; Gl,Gm = the spheroidal indices (attributed
128  // globally); aw = a*omega; lmin = min(s,Gm), the minimum allowed l;
129  // *b will be allocated to an array of expansion coefficients;
130  // E = spheroidal eigenvalue; N = number of coefficients in
131  // expansion.
132  int s, Gm;
133  Real aw;
134 };
135 
136 #endif
Spin-Weighted Spheroidal Harmonics Class.
Definition: SWSH.h:55
int N
Maximum index in array.
Definition: SWSH.h:82
Real sinthetabrac(const int s, const int p, const int q, const int m, const int mp)
Definition: SWSHCGUtil.cc:75
Clebsch-Gordan Coefficients Class.
Definition: SWSH.h:30
int lmin
Minimum { harmonic} index in array.
Definition: SWSH.h:81