5
5
Multipole::Multipole (std::string fileName, int lmax, int isym, double ekin): Data(fileName),LMAX(lmax), ISYM(isym), k(2 *M_PI*sqrt (ekin/150 ))
6
6
{
7
7
assert (LMAX<Multipole::MAX_COEFF);
8
- alm1.resize ( LMAX/2 +1 , std::vector<double >());
9
- alm2.resize ( LMAX/2 +1 , std::vector<double >());
8
+ alm.resize ( LMAX/2 +1 , std::vector<std::complex<double > >());
10
9
}
11
10
Multipole::~Multipole ()
12
11
{
13
- delete alm1;
14
- delete alm2;
12
+ // TODO enentiuelle leichen löschen
13
+ // delete alm1;
14
+ // delete alm2;
15
15
}
16
16
17
17
const int Multipole::getLMAX ()
@@ -21,9 +21,8 @@ const int Multipole::getLMAX()
21
21
22
22
void Multipole::multpl ()
23
23
{
24
- std::cout<<" \n in multipl function" <<std::endl;
25
- double dtheta=2 *M_PI/180.0 ;
26
- double bnorm=1 ;
24
+ std::cout<<" \n --------------------------------------------------------------- \n expanding multipole coefficients" <<std::endl;
25
+ double bnorm = 1 ;
27
26
for (int l=0 ;l<=LMAX;l+=2 )
28
27
{
29
28
int il=l/2 ;
@@ -34,32 +33,31 @@ void Multipole::multpl()
34
33
// alm2[il].push_back(std::vector<double>(il));
35
34
for (int m=0 ;m<=l;m+=ISYM)
36
35
{
37
- double rint1=0 ;
38
- double rint2=0 ;
36
+ std::complex<double > int_res=0 ;
39
37
38
+ // go through all angles alm=int(g(theta,phi)*conj(Y_lm(thea,phi)) dOmega
40
39
for (int i=0 ;i<MAXANGLES;i++)
41
40
{
42
41
double phi=messg[i][2 ];
43
42
double theta=messg[i][1 ];
44
43
double gmessg=messg[i][0 ];
44
+ double dOmega=messg[i][3 ];
45
+
46
+ // std::cout<<"i, phi, theta, g "<<i<<" "<<phi<<","<<theta<<", "<<gmessg<<std::endl;
47
+ int_res+=gmessg*std::conj (boost::math::spherical_harmonic<double >(l, m, theta, phi))*dOmega;
45
48
46
- std::cout<<" i, phi, theta, g " <<i<<" " <<phi<<" ," <<theta<<" , " <<gmessg<<std::endl;
47
- // norm=sqrt(4.0*M_PI/(2.0*l+1.0))
48
- rint1+=vorz (m)*gmessg*boost::math::spherical_harmonic_r<double >(l, (-1 )*m, theta, phi)*sin (theta)*messg[i][3 ];
49
49
50
- rint2+=vorz (m)*gmessg*boost::math::spherical_harmonic_i<double >(l, (-1 )*m, theta, phi)*sin (theta)*messg[i][3 ];
51
50
// std::cout<<"real, imag "<<rint1<<", "<<rint2<<"\n";
52
51
53
52
54
53
}
55
- if (l==0 && m==0 && rint1 >0.001 )
54
+ if (l==0 && m==0 && std::real (int_res) >0.001 )
56
55
{
57
- bnorm=rint1*dtheta ;
56
+ bnorm=std::real (int_res) ;
58
57
std::cout<<" bnorm=" <<bnorm<<std::endl;
59
58
}
60
- alm1[il].push_back (rint1*dtheta/bnorm);
61
- alm2[il].push_back (rint2*dtheta/bnorm);
62
- std::cout<<l<<" " <<m<<" " <<alm1[il][m]<<std::endl;// <<" "<<alm2[il][m]<<std::endl;
59
+ alm[il].push_back (int_res/ bnorm);
60
+ std::cout<<l<<" " <<m<<" " <<alm[il][m]<<std::endl;// <<" "<<alm2[il][m]<<std::endl;
63
61
}
64
62
// std::cout<<std::endl;
65
63
}
@@ -69,42 +67,27 @@ std::cout<<"alm: (l,m,real,imag)\n";
69
67
70
68
void Multipole::expans ()
71
69
{
72
- std::cout<<" in expans function\n " ;
70
+ std::cout<<" \n --------------------------------------------------------------- \n expanding function according to calculated coefficients \n " ;
71
+ calc.clear ();
73
72
for (int i=0 ;i<MAXANGLES;i++)
74
73
{
75
- // std::cout<<"i "<<i<<std::endl;
74
+ std::cout<<" i " <<i<<std::endl;
76
75
double theta=messg[i][1 ];
77
76
double phi=messg[i][2 ];
78
- double suml=0 ;
79
- // std::cout<<"(theta, phi)=("<<theta<<", "<<phi<<")\n";
80
- for (int l=0 ;l<LMAX;l+=2 )
81
- {
82
- // std::cout<<"l is "<<l<<std::endl;
83
- int il=l/2 ;
84
- suml+=alm1[il][0 ]*boost::math::spherical_harmonic_r <double > (l,0 ,theta,phi); // m=0
85
- // std::cout<<"sum"<<sum<<std::endl;
86
- for (int m=1 ;m<=l;m++)
87
- {
88
- // std::cout<<"in seccond for loop!";
89
- // calculate RE(sum_m A_lm*Y_lm)=sum_m RE(A_lm)*RE(Y_lm)-IM(A_lm)*IM(Y_lm)
90
- double real=alm1[il][m]*boost::math::spherical_harmonic_r <double > (l,m,theta, phi); // imaginary part
91
- double imag=alm2[il][m]*boost::math::spherical_harmonic_i <double > (l,m,theta, phi); // real part
92
- suml+=2 *(real-imag); //
93
- // std::cout<<"sum, i"<<sum<<", "<<l<<std::endl;
94
- }
95
- }
77
+ double g_theta_phi=intencity (theta,phi);
96
78
std::vector<double > temp;
97
- std::cout<<suml <<" " <<180 /M_PI*theta<<" " <<180 /M_PI*phi<<std::endl;
98
- temp.push_back (suml );
79
+ std::cout<<g_theta_phi <<" " <<180 /M_PI*theta<<" " <<180 /M_PI*phi<<std::endl;
80
+ temp.push_back (g_theta_phi );
99
81
temp.push_back (theta);
100
82
temp.push_back (phi);// TODO if time: make this call better -> works for a start
83
+
101
84
calc.push_back (temp);
102
85
}
103
- std::cout<<" calc:(suml ,theta,phi)\n " ;
86
+ std::cout<<" calc:(g(theat,phi) ,theta,phi)\n " ;
104
87
}
105
88
106
89
107
- void Multipole::holorad (double alpha, double beta)
90
+ /* void Multipole::holorad(double alpha, double beta)
108
91
{
109
92
double r=0;
110
93
double kr=0;
@@ -243,25 +226,31 @@ void Multipole::smooth(double grid)
243
226
}
244
227
}
245
228
}
246
- }*/
229
+ }*---> /
247
230
}
248
231
249
232
250
233
/*-------------------Private--------------------------------------*/
251
- double Multipole::innerSumm ( int l, double alpha , double beta )
234
+ double Multipole::intencity ( double theta , double phi )
252
235
{
253
- double summ=0 ;
254
- int il=l/2 ;
255
- for (int m=ISYM;m<=l;m+=ISYM)
236
+ double summ0=0 ;
237
+ std::complex<double > summ (0 ,0 );
238
+ for (int l=0 ; l<=LMAX; l+=2 )
239
+ {
240
+ int m=0 ;
241
+ summ0+=std::real (alm[l/2 ][m]*boost::math::spherical_harmonic<double > (l,m,theta,phi));
242
+ m+=ISYM;
243
+ for (;m<=l;m+=ISYM)
256
244
{
257
- double real=alm1[il][m]*boost::math::spherical_harmonic_r <double > (l,m,alpha, beta); // imaginary part
258
- double imag=alm2[il][m]*boost::math::spherical_harmonic_i <double > (l,m,alpha, beta);
259
- summ+=2 *(real-imag);
245
+ summ+=alm[l/2 ][m]*boost::math::spherical_harmonic<double > (l,m,theta,phi);
260
246
}
261
- return summ;
247
+ }
248
+
249
+
250
+ return summ0+2 *std::real (summ);
262
251
}
263
252
264
- void Multipole::printAlm ()
253
+ /* void Multipole::printAlm()
265
254
{
266
255
for(unsigned int i=0;i<alm1.max_size();i++)
267
256
{
@@ -343,4 +332,4 @@ double Multipole::calcphi(double x, double y)
343
332
}
344
333
}
345
334
return -1;
346
- }
335
+ }*/
0 commit comments