Commit 5277ea01 authored by COULAUD Olivier's avatar COULAUD Olivier

use real and imag functions

parent 5c3609b2
...@@ -996,8 +996,8 @@ public: ...@@ -996,8 +996,8 @@ public:
int index_l_minus_j = l-m; // get l-j continuously int index_l_minus_j = l-m; // get l-j continuously
for(int j = m ; j <= l ; ++j, --index_l_minus_j, index_jm += j ){ for(int j = m ; j <= l ; ++j, --index_l_minus_j, index_jm += j ){
//const coef = (b^l-j) / (l-j)!; //const coef = (b^l-j) / (l-j)!;
w_lm_real += coef[index_l_minus_j] * source_w[index_jm].getReal(); w_lm_real += coef[index_l_minus_j] * source_w[index_jm].real();
w_lm_imag += coef[index_l_minus_j] * source_w[index_jm].getImag(); w_lm_imag += coef[index_l_minus_j] * source_w[index_jm].imag();
} }
target_w[index_lm].setRealImag(w_lm_real,w_lm_imag); target_w[index_lm].setRealImag(w_lm_real,w_lm_imag);
} }
...@@ -1057,8 +1057,8 @@ public: ...@@ -1057,8 +1057,8 @@ public:
for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){ for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){
// coef = (j+l)!/b^(j+l+1) // coef = (j+l)!/b^(j+l+1)
// because {l,-m} => {l,m} conjugate -1^m with -i // because {l,-m} => {l,m} conjugate -1^m with -i
u_lm_real += minus_1_pow_m * coef[index_jl] * source_w[index_jm].getReal(); u_lm_real += minus_1_pow_m * coef[index_jl] * source_w[index_jm].real();
u_lm_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].getImag(); u_lm_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].imag();
} }
target_u[index_lm].setRealImag(u_lm_real,u_lm_imag); target_u[index_lm].setRealImag(u_lm_real,u_lm_imag);
minus_1_pow_m = -minus_1_pow_m; minus_1_pow_m = -minus_1_pow_m;
...@@ -1112,8 +1112,8 @@ public: ...@@ -1112,8 +1112,8 @@ public:
for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){ for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){
// coef = (j+l)!/b^(j+l+1) // coef = (j+l)!/b^(j+l+1)
// because {l,-m} => {l,m} conjugate -1^m with -i // because {l,-m} => {l,m} conjugate -1^m with -i
u_lm_real += minus_1_pow_m * coef[index_jl] * source_w[index_jm].getReal(); u_lm_real += minus_1_pow_m * coef[index_jl] * source_w[index_jm].real();
u_lm_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].getImag(); u_lm_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].imag();
} }
target_u[index_lm].setRealImag(u_lm_real,u_lm_imag); target_u[index_lm].setRealImag(u_lm_real,u_lm_imag);
minus_1_pow_m = -minus_1_pow_m; minus_1_pow_m = -minus_1_pow_m;
...@@ -1173,8 +1173,8 @@ public: ...@@ -1173,8 +1173,8 @@ public:
int index_j_minus_l = 0; // get l-j continously int index_j_minus_l = 0; // get l-j continously
for(int j = l ; j <= P ; ++j, ++index_j_minus_l, index_jm += j){ for(int j = l ; j <= P ; ++j, ++index_j_minus_l, index_jm += j){
// coef = b^j-l/j-l! // coef = b^j-l/j-l!
u_lm_real += coef[index_j_minus_l] * source_u[index_jm].getReal(); u_lm_real += coef[index_j_minus_l] * source_u[index_jm].real();
u_lm_imag += coef[index_j_minus_l] * source_u[index_jm].getImag(); u_lm_imag += coef[index_j_minus_l] * source_u[index_jm].imag();
} }
target_u[atLm(l,m)].setRealImag(u_lm_real,u_lm_imag); target_u[atLm(l,m)].setRealImag(u_lm_real,u_lm_imag);
} }
...@@ -1279,14 +1279,14 @@ public: ...@@ -1279,14 +1279,14 @@ public:
for(int l = 1 ; l <= P ; ++l, ++fl){ for(int l = 1 ; l <= P ; ++l, ++fl){
// first m == 0 // first m == 0
{ {
Fr += fl * u[index_lm].getReal() * minus_r_pow_l_legendre_div_fact_lm[index_lm]; Fr += fl * u[index_lm].real() * minus_r_pow_l_legendre_div_fact_lm[index_lm];
} }
{ {
const FReal coef = minus_r_pow_l_div_fact_lm[index_lm] * (fl * (sph.getCosTheta()*legendre[index_lm] const FReal coef = minus_r_pow_l_div_fact_lm[index_lm] * (fl * (sph.getCosTheta()*legendre[index_lm]
- legendre[index_lm-l]) / sph.getSinTheta()); - legendre[index_lm-l]) / sph.getSinTheta());
const FReal dI_real = coef; const FReal dI_real = coef;
// F(O) += 2 * Real(L dI/dO) // F(O) += 2 * Real(L dI/dO)
FO += u[index_lm].getReal() * dI_real; FO += u[index_lm].real() * dI_real;
} }
++index_lm; ++index_lm;
// then 0 < m // then 0 < m
...@@ -1296,9 +1296,9 @@ public: ...@@ -1296,9 +1296,9 @@ public:
const FReal I_real = coef * cos_m_phi_i_pow_m[m]; const FReal I_real = coef * cos_m_phi_i_pow_m[m];
const FReal I_imag = coef * sin_m_phi_i_pow_m[m]; const FReal I_imag = coef * sin_m_phi_i_pow_m[m];
// F(r) += 2 x l x Real(LI) // F(r) += 2 x l x Real(LI)
Fr += 2 * fl * (u[index_lm].getReal() * I_real - u[index_lm].getImag() * I_imag); Fr += 2 * fl * (u[index_lm].real() * I_real - u[index_lm].imag() * I_imag);
// F(p) += -2 x m x Imag(LI) // F(p) += -2 x m x Imag(LI)
Fp -= 2 * FReal(m) * (u[index_lm].getReal() * I_imag + u[index_lm].getImag() * I_real); Fp -= 2 * FReal(m) * (u[index_lm].real() * I_imag + u[index_lm].imag() * I_real);
} }
{ {
const FReal legendre_l_minus_1 = (m == l) ? FReal(0.0) : FReal(l+m)*legendre[index_lm-l]; const FReal legendre_l_minus_1 = (m == l) ? FReal(0.0) : FReal(l+m)*legendre[index_lm-l];
...@@ -1307,7 +1307,7 @@ public: ...@@ -1307,7 +1307,7 @@ public:
const FReal dI_real = coef * cos_m_phi_i_pow_m[m]; const FReal dI_real = coef * cos_m_phi_i_pow_m[m];
const FReal dI_imag = coef * sin_m_phi_i_pow_m[m]; const FReal dI_imag = coef * sin_m_phi_i_pow_m[m];
// F(O) += 2 * Real(L dI/dO) // F(O) += 2 * Real(L dI/dO)
FO += FReal(2.0) * (u[index_lm].getReal() * dI_real - u[index_lm].getImag() * dI_imag); FO += FReal(2.0) * (u[index_lm].real() * dI_real - u[index_lm].imag() * dI_imag);
} }
} }
} }
...@@ -1349,14 +1349,14 @@ public: ...@@ -1349,14 +1349,14 @@ public:
for(int l = 0 ; l <= P ; ++l ){ for(int l = 0 ; l <= P ; ++l ){
{//for m == 0 {//for m == 0
// (l-|m|)! * P{l,0} / r^(l+1) // (l-|m|)! * P{l,0} / r^(l+1)
magnitude += u[index_lm].getReal() * minus_r_pow_l_legendre_div_fact_lm[index_lm]; magnitude += u[index_lm].real() * minus_r_pow_l_legendre_div_fact_lm[index_lm];
++index_lm; ++index_lm;
} }
for(int m = 1 ; m <= l ; ++m, ++index_lm ){ for(int m = 1 ; m <= l ; ++m, ++index_lm ){
const FReal coef = minus_r_pow_l_legendre_div_fact_lm[index_lm]; const FReal coef = minus_r_pow_l_legendre_div_fact_lm[index_lm];
const FReal I_real = coef * cos_m_phi_i_pow_m[m]; const FReal I_real = coef * cos_m_phi_i_pow_m[m];
const FReal I_imag = coef * sin_m_phi_i_pow_m[m]; const FReal I_imag = coef * sin_m_phi_i_pow_m[m];
magnitude += FReal(2.0) * ( u[index_lm].getReal() * I_real - u[index_lm].getImag() * I_imag ); magnitude += FReal(2.0) * ( u[index_lm].real() * I_real - u[index_lm].imag() * I_imag );
} }
} }
// inc potential // inc potential
......
...@@ -218,8 +218,8 @@ public: ...@@ -218,8 +218,8 @@ public:
for(int l = 0; l <= devP ; ++l){ for(int l = 0; l <= devP ; ++l){
for(int m = 0 ; m <= l ; ++m){ for(int m = 0 ; m <= l ; ++m){
const FReal magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m]; const FReal magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m];
harmonic[index_l_m].setReal( magnitude * cosSin[m].getReal() ); harmonic[index_l_m].setReal( magnitude * cosSin[m].real() );
harmonic[index_l_m].setImag( magnitude * cosSin[m].getImag() ); harmonic[index_l_m].setImag( magnitude * cosSin[m].imag() );
++index_l_m; ++index_l_m;
} }
...@@ -260,8 +260,8 @@ public: ...@@ -260,8 +260,8 @@ public:
for(int l = 0 ; l <= devP ; ++l){ for(int l = 0 ; l <= devP ; ++l){
for(int m = 0 ; m <= l ; ++m){ for(int m = 0 ; m <= l ; ++m){
const FReal magnitude = sphereHarmoOuterCoef[l-m] * invR_pow_l1 * legendre[index_l_m]; const FReal magnitude = sphereHarmoOuterCoef[l-m] * invR_pow_l1 * legendre[index_l_m];
harmonic[index_l_m].setReal( magnitude * cosSin[m].getReal() ); harmonic[index_l_m].setReal( magnitude * cosSin[m].real() );
harmonic[index_l_m].setImag( magnitude * cosSin[m].getImag() ); harmonic[index_l_m].setImag( magnitude * cosSin[m].imag() );
++index_l_m; ++index_l_m;
} }
...@@ -319,14 +319,14 @@ public: ...@@ -319,14 +319,14 @@ public:
magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m]; magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m];
// Computation of Inner_l^m(r, theta, phi): // Computation of Inner_l^m(r, theta, phi):
harmonic[index_l_m].setReal( magnitude * cosSin[m].getReal()); harmonic[index_l_m].setReal( magnitude * cosSin[m].real());
harmonic[index_l_m].setImag( magnitude * cosSin[m].getImag()); harmonic[index_l_m].setImag( magnitude * cosSin[m].imag());
// Computation of {\partial Inner_l^m(r, theta, phi)}/{\partial theta}: // Computation of {\partial Inner_l^m(r, theta, phi)}/{\partial theta}:
magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * ((FReal(l)*inSphere.getCosTheta()*legendre[index_l_m] magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * ((FReal(l)*inSphere.getCosTheta()*legendre[index_l_m]
- FReal(l+m)*(legendre[getPreExpRedirJ(l-1) + m])) / inSphere.getSinTheta()); - FReal(l+m)*(legendre[getPreExpRedirJ(l-1) + m])) / inSphere.getSinTheta());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].getReal()); thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].real());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].getImag()); thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].imag());
++index_l_m; ++index_l_m;
} }
...@@ -334,13 +334,13 @@ public: ...@@ -334,13 +334,13 @@ public:
// m=l: // m=l:
// Computation of Inner_m^m(r, theta, phi): // Computation of Inner_m^m(r, theta, phi):
magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m]; magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m];
harmonic[index_l_m].setReal(magnitude * cosSin[m].getReal()); harmonic[index_l_m].setReal(magnitude * cosSin[m].real());
harmonic[index_l_m].setImag(magnitude * cosSin[m].getImag()); harmonic[index_l_m].setImag(magnitude * cosSin[m].imag());
// Computation of {\partial Inner_m^m(r, theta, phi)}/{\partial theta}: // Computation of {\partial Inner_m^m(r, theta, phi)}/{\partial theta}:
magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * (FReal(m) * inSphere.getCosTheta() * legendre[index_l_m] / inSphere.getSinTheta()); magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * (FReal(m) * inSphere.getCosTheta() * legendre[index_l_m] / inSphere.getSinTheta());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].getReal()); thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].real());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].getImag()); thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].imag());
r_pow_l *= inSphere.getR(); r_pow_l *= inSphere.getR();
++index_l_m; ++index_l_m;
......
...@@ -65,8 +65,8 @@ protected: ...@@ -65,8 +65,8 @@ protected:
const int k = N-n-m; const int k = N-n-m;
if (k < 0){ if (k < 0){
const FReal pow_of_minus_1 = FReal((k&1) ? -1 : 1); const FReal pow_of_minus_1 = FReal((k&1) ? -1 : 1);
fillTransfer->setReal( pow_of_minus_1 * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getReal()); fillTransfer->setReal( pow_of_minus_1 * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].real());
fillTransfer->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getImag()); fillTransfer->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].imag());
} }
else{ else{
(*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k]; (*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k];
...@@ -205,8 +205,8 @@ public: ...@@ -205,8 +205,8 @@ public:
// Negative orders: // Negative orders:
FReal minus_1_pow_k = FReal( j&1 ? -1 : 1); FReal minus_1_pow_k = FReal( j&1 ? -1 : 1);
for(int k = -j ; k < 0 ; ++k ){ for(int k = -j ; k < 0 ; ++k ){
exp[j_j1 + k].setReal(minus_1_pow_k * exp[j_j1 + (-k)].getReal()); exp[j_j1 + k].setReal(minus_1_pow_k * exp[j_j1 + (-k)].real());
exp[j_j1 + k].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].getImag()); exp[j_j1 + k].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].imag());
minus_1_pow_k = -minus_1_pow_k; minus_1_pow_k = -minus_1_pow_k;
} }
} }
......
...@@ -80,8 +80,8 @@ protected: ...@@ -80,8 +80,8 @@ protected:
const int k = N-n-m; const int k = N-n-m;
if (k < 0){ if (k < 0){
const FReal pow_of_minus_1 = FReal((k&1) ? -1 : 1); const FReal pow_of_minus_1 = FReal((k&1) ? -1 : 1);
fillTransfer->setReal( pow_of_minus_1 * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getReal()); fillTransfer->setReal( pow_of_minus_1 * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].real());
fillTransfer->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getImag()); fillTransfer->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].imag());
} }
else{ else{
(*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k]; (*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k];
...@@ -212,8 +212,8 @@ public: ...@@ -212,8 +212,8 @@ public:
// Negative orders: // Negative orders:
FReal minus_1_pow_k = FReal( j&1 ? -1 : 1); FReal minus_1_pow_k = FReal( j&1 ? -1 : 1);
for(int k = -j ; k < 0 ; ++k ){ for(int k = -j ; k < 0 ; ++k ){
exp[j_j1 + k].setReal(minus_1_pow_k * exp[j_j1 + (-k)].getReal()); exp[j_j1 + k].setReal(minus_1_pow_k * exp[j_j1 + (-k)].real());
exp[j_j1 + k].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].getImag()); exp[j_j1 + k].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].imag());
minus_1_pow_k = -minus_1_pow_k; minus_1_pow_k = -minus_1_pow_k;
} }
} }
......
...@@ -152,11 +152,11 @@ public: ...@@ -152,11 +152,11 @@ public:
const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j + k + l]; const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j + k + l];
L_j_k.incReal( pow_of_minus_1_for_l * pow_of_minus_1_for_k * L_j_k.incReal( pow_of_minus_1_for_l * pow_of_minus_1_for_k *
((M_n_l.getReal() * O_n_j__k_l.getReal()) + ((M_n_l.real() * O_n_j__k_l.real()) +
(M_n_l.getImag() * O_n_j__k_l.getImag()))); (M_n_l.imag() * O_n_j__k_l.imag())));
L_j_k.incImag( pow_of_minus_1_for_l * pow_of_minus_1_for_k * L_j_k.incImag( pow_of_minus_1_for_l * pow_of_minus_1_for_k *
((M_n_l.getImag() * O_n_j__k_l.getReal()) - ((M_n_l.imag() * O_n_j__k_l.real()) -
(M_n_l.getReal() * O_n_j__k_l.getImag()))); (M_n_l.real() * O_n_j__k_l.imag())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l; pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
} }
...@@ -166,11 +166,11 @@ public: ...@@ -166,11 +166,11 @@ public:
const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j + k + l]; const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j + k + l];
L_j_k.incReal( pow_of_minus_1_for_k * L_j_k.incReal( pow_of_minus_1_for_k *
((M_n_l.getReal() * O_n_j__k_l.getReal()) - ((M_n_l.real() * O_n_j__k_l.real()) -
(M_n_l.getImag() * O_n_j__k_l.getImag()))); (M_n_l.imag() * O_n_j__k_l.imag())));
L_j_k.decImag( pow_of_minus_1_for_k * L_j_k.decImag( pow_of_minus_1_for_k *
((M_n_l.getImag() * O_n_j__k_l.getReal()) + ((M_n_l.imag() * O_n_j__k_l.real()) +
(M_n_l.getReal() * O_n_j__k_l.getImag()))); (M_n_l.real() * O_n_j__k_l.imag())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l; pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
} }
...@@ -180,11 +180,11 @@ public: ...@@ -180,11 +180,11 @@ public:
const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j - (k + l)]; const FComplex<FReal> O_n_j__k_l = M2L_Outer_transfer[index_n_j - (k + l)];
L_j_k.incReal( pow_of_minus_1_for_l * L_j_k.incReal( pow_of_minus_1_for_l *
((M_n_l.getReal() * O_n_j__k_l.getReal()) + ((M_n_l.real() * O_n_j__k_l.real()) +
(M_n_l.getImag() * O_n_j__k_l.getImag()))); (M_n_l.imag() * O_n_j__k_l.imag())));
L_j_k.incImag( pow_of_minus_1_for_l * L_j_k.incImag( pow_of_minus_1_for_l *
((M_n_l.getReal() * O_n_j__k_l.getImag()) - ((M_n_l.real() * O_n_j__k_l.imag()) -
(M_n_l.getImag() * O_n_j__k_l.getReal()))); (M_n_l.imag() * O_n_j__k_l.real())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l; pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
} }
......
...@@ -240,16 +240,16 @@ protected: ...@@ -240,16 +240,16 @@ protected:
const FReal H_nu_minus_1 = ( nu-1 <= -n ? const FReal H_nu_minus_1 = ( nu-1 <= -n ?
FReal(0.0) : FReal(0.0) :
(cos_gamma +1) * rotation_info.rotation_b[getRotationB(n, -nu)] (cos_gamma +1) * rotation_info.rotation_b[getRotationB(n, -nu)]
* rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu-1, m-1)].getReal()); * rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu-1, m-1)].real());
const FReal H_nu_plus_1 = ( nu+1 >= n ? const FReal H_nu_plus_1 = ( nu+1 >= n ?
FReal(0.0) : FReal(0.0) :
(cos_gamma -1) * rotation_info.rotation_b[getRotationB(n, nu)] (cos_gamma -1) * rotation_info.rotation_b[getRotationB(n, nu)]
* rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu+1, m-1)].getReal()); * rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu+1, m-1)].real());
const FReal H_nu = ( FMath::Abs(nu) >= n ? const FReal H_nu = ( FMath::Abs(nu) >= n ?
FReal(0.0) : FReal(0.0) :
sin_gamma * rotation_info.rotation_a[getRotationA(n-1, nu)] sin_gamma * rotation_info.rotation_a[getRotationA(n-1, nu)]
* rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu, m-1)].getReal() ); * rcc_tmp_transposed[n-1][getTranspRotationCoefP(n-1, nu, m-1)].real() );
rcc_tmp_transposed[n][getTranspRotationCoefP(n, nu, m)].setReal( (FReal(0.5) * (-H_nu_minus_1 - H_nu_plus_1) - H_nu) rcc_tmp_transposed[n][getTranspRotationCoefP(n, nu, m)].setReal( (FReal(0.5) * (-H_nu_minus_1 - H_nu_plus_1) - H_nu)
...@@ -456,11 +456,11 @@ public: ...@@ -456,11 +456,11 @@ public:
for(int k = -j ; k < 0 ; ++k){ /* k < 0 */ for(int k = -j ; k < 0 ; ++k){ /* k < 0 */
p_rot_multipole_exp->incReal( minus_1_pow_k * p_rot_multipole_exp->incReal( minus_1_pow_k *
((p_multipole_exp->getReal() * p_rcc_outer->getReal()) + ((p_multipole_exp->real() * p_rcc_outer->real()) +
(p_multipole_exp->getImag() * p_rcc_outer->getImag())) ); (p_multipole_exp->imag() * p_rcc_outer->imag())) );
p_rot_multipole_exp->incImag( minus_1_pow_k * p_rot_multipole_exp->incImag( minus_1_pow_k *
((p_multipole_exp->getReal() * p_rcc_outer->getImag()) - ((p_multipole_exp->real() * p_rcc_outer->imag()) -
(p_multipole_exp->getImag() * p_rcc_outer->getReal())) ); (p_multipole_exp->imag() * p_rcc_outer->real())) );
minus_1_pow_k = -minus_1_pow_k; minus_1_pow_k = -minus_1_pow_k;
--p_rcc_outer; --p_rcc_outer;
...@@ -469,11 +469,11 @@ public: ...@@ -469,11 +469,11 @@ public:
for(int k = 0; k <= j ; ++k){ /* k >= 0 */ for(int k = 0; k <= j ; ++k){ /* k >= 0 */
p_rot_multipole_exp->incReal( p_rot_multipole_exp->incReal(
((p_multipole_exp->getReal() * p_rcc_outer->getReal()) - ((p_multipole_exp->real() * p_rcc_outer->real()) -
(p_multipole_exp->getImag() * p_rcc_outer->getImag())) ); (p_multipole_exp->imag() * p_rcc_outer->imag())) );
p_rot_multipole_exp->incImag( p_rot_multipole_exp->incImag(
((p_multipole_exp->getReal() * p_rcc_outer->getImag()) + ((p_multipole_exp->real() * p_rcc_outer->imag()) +
(p_multipole_exp->getImag() * p_rcc_outer->getReal())) ); (p_multipole_exp->imag() * p_rcc_outer->real())) );
--p_rcc_outer; --p_rcc_outer;
++p_multipole_exp; ++p_multipole_exp;
...@@ -497,8 +497,8 @@ public: ...@@ -497,8 +497,8 @@ public:
for(int k = 0 ; k <= min_j ; ++k){ for(int k = 0 ; k <= min_j ; ++k){
const FComplex<FReal>* p_rot_multipole_exp = rot_multipole_exp + k * (Parent::devP + 2 - k); const FComplex<FReal>* p_rot_multipole_exp = rot_multipole_exp + k * (Parent::devP + 2 - k);
for(int n = k ; n <= stop_for_n ; ++n){ for(int n = k ; n <= stop_for_n ; ++n){
p_rot_local_exp->incReal(p_rot_multipole_exp->getReal() * p_outer_array_j[n]); p_rot_local_exp->incReal(p_rot_multipole_exp->real() * p_outer_array_j[n]);
p_rot_local_exp->incImag(p_rot_multipole_exp->getImag() * p_outer_array_j[n]); p_rot_local_exp->incImag(p_rot_multipole_exp->imag() * p_outer_array_j[n]);
++p_rot_multipole_exp; ++p_rot_multipole_exp;
} /* for n */ } /* for n */
++p_rot_local_exp; ++p_rot_local_exp;
...@@ -525,11 +525,11 @@ public: ...@@ -525,11 +525,11 @@ public:
for(int k = -min_j ; k < 0 ; ++k){ /* k < 0 */ for(int k = -min_j ; k < 0 ; ++k){ /* k < 0 */
p_local_exp->incReal( minus_1_pow_k * p_local_exp->incReal( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) + ((p_rot_local_exp->real() * p_rcc_inner->real()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getImag()))); (p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( minus_1_pow_k * p_local_exp->incImag( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) - ((p_rot_local_exp->real() * p_rcc_inner->imag()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getReal()))); (p_rot_local_exp->imag() * p_rcc_inner->real())));
minus_1_pow_k = -minus_1_pow_k; minus_1_pow_k = -minus_1_pow_k;
--p_rot_local_exp; --p_rot_local_exp;
...@@ -538,11 +538,11 @@ public: ...@@ -538,11 +538,11 @@ public:
for(int k = 0; k <= min_j ; ++k){ /* k >= 0 */ for(int k = 0; k <= min_j ; ++k){ /* k >= 0 */
p_local_exp->incReal( p_local_exp->incReal(
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) - ((p_rot_local_exp->real() * p_rcc_inner->real()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getImag()))); (p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( p_local_exp->incImag(
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) + ((p_rot_local_exp->real() * p_rcc_inner->imag()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getReal()))); (p_rot_local_exp->imag() * p_rcc_inner->real())));
++p_rot_local_exp; ++p_rot_local_exp;
++p_rcc_inner; ++p_rcc_inner;
...@@ -566,11 +566,11 @@ public: ...@@ -566,11 +566,11 @@ public:
for(int k = -min_j ; k < 0; ++k){ /* k < 0 */ for(int k = -min_j ; k < 0; ++k){ /* k < 0 */
p_local_exp->incReal( minus_1_pow_k * p_local_exp->incReal( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) + ((p_rot_local_exp->real() * p_rcc_inner->real()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getImag()))); (p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( minus_1_pow_k * p_local_exp->incImag( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) - ((p_rot_local_exp->real() * p_rcc_inner->imag()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getReal()))); (p_rot_local_exp->imag() * p_rcc_inner->real())));
minus_1_pow_k = -minus_1_pow_k; minus_1_pow_k = -minus_1_pow_k;
--p_rot_local_exp; --p_rot_local_exp;
...@@ -578,11 +578,11 @@ public: ...@@ -578,11 +578,11 @@ public:
} /* for k */ } /* for k */
for(int k = 0; k<=min_j; ++k){ /* k >= 0 */ for(int k = 0; k<=min_j; ++k){ /* k >= 0 */
p_local_exp->incReal( p_local_exp->incReal(
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) - ((p_rot_local_exp->real() * p_rcc_inner->real()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getImag()))); (p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( p_local_exp->incImag(
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) + ((p_rot_local_exp->real() * p_rcc_inner->imag()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getReal()))); (p_rot_local_exp->imag() * p_rcc_inner->real())));
++p_rot_local_exp; ++p_rot_local_exp;
++p_rcc_inner; ++p_rcc_inner;
......
...@@ -58,7 +58,11 @@ public: ...@@ -58,7 +58,11 @@ public:
complex[0] = other.complex[0]; complex[0] = other.complex[0];
complex[1] = other.complex[1]; complex[1] = other.complex[1];
} }
/** Move constructor */
FComplex<FReal>(FComplex<FReal> &&c)
{
std::move(std::begin(c.complex), std::end(c.complex), complex);
}
/** Copy operator */ /** Copy operator */
FComplex<FReal>& operator=(const FComplex<FReal>& other){ FComplex<FReal>& operator=(const FComplex<FReal>& other){
this->complex[0] = other.complex[0]; this->complex[0] = other.complex[0];
...@@ -77,23 +81,16 @@ public: ...@@ -77,23 +81,16 @@ public:
return !(*this == other); return !(*this == other);
} }
/** Get imaginary */ /** Get imaginary */
FReal imag() const{ FReal imag() const{
return this->complex[1]; return this->complex[1];
} }
/** Get imaginary */
FReal getImag() const{
return this->complex[1];
}
/** Get complex[0] */ /** Get complex[0] */
FReal real() const{ FReal real() const{
return this->complex[0]; return this->complex[0];
} }
/** Get complex[0] */
FReal getReal() const{
return this->complex[0];
}
/** Set Imaginary */ /** Set Imaginary */
void setImag(const FReal inImag) { void setImag(const FReal inImag) {
...@@ -245,7 +242,7 @@ public: ...@@ -245,7 +242,7 @@ public:
*/ */
template <class StreamClass> template <class StreamClass>
friend StreamClass& operator<<(StreamClass& output, const FComplex<FReal>& inC){ friend StreamClass& operator<<(StreamClass& output, const FComplex<FReal>& inC){
output << "(" << inC.getReal() << ", " << inC.getImag() << ")"; output << "(" << inC.real() << ", " << inC.imag() << ")";
return output; // for multiple << operators. return output; // for multiple << operators.
} }
...@@ -255,8 +252,8 @@ public: ...@@ -255,8 +252,8 @@ public:
template <class FReal> template <class FReal>
inline FComplex<FReal> operator*=(const FComplex<FReal>& first, const FComplex<FReal>& second){ inline FComplex<FReal> operator*=(const FComplex<FReal>& first, const FComplex<FReal>& second){
return FComplex<FReal>( return FComplex<FReal>(
(first.getReal() * second.getImag()) + (first.getImag() * second.getReal()), (first.real() * second.imag()) + (first.imag() * second.real()),
(first.getReal() * second.getReal()) - (first.getImag() * second.getImag()) (first.real() * second.real()) - (first.imag() * second.imag())
); );
} }
......
...@@ -422,7 +422,7 @@ public: ...@@ -422,7 +422,7 @@ public:
/// Get the MPI datatype corresponding to a variable. /// Get the MPI datatype corresponding to a variable.
template <class FReal> template <class FReal>
static MPI_Datatype GetType(const FComplex<FReal>& a){ static MPI_Datatype GetType(const FComplex<FReal>& a){
return GetType(a.getReal()); return GetType(a.real());
} }
template <class FReal> template <class FReal>
......
...@@ -58,8 +58,8 @@ template <class CellClass> ...@@ -58,8 +58,8 @@ template <class CellClass>
bool isEqualPole(const CellClass& me, const CellClass& other, FReal*const cumul){ bool isEqualPole(const CellClass& me, const CellClass& other, FReal*const cumul){
FMath::FAccurater<FReal> accurate; FMath::FAccurater<FReal> accurate;
for(int idx = 0; idx < CellClass::multipole_t::Size; ++idx){ for(int idx = 0; idx < CellClass::multipole_t::Size; ++idx){
accurate.add(me.getMultipoleData().get()[idx].getImag(),other.getMultipoleData().get()[idx].getImag()); accurate.add(me.getMultipoleData().get()[idx].imag(),other.getMultipoleData().get()[idx].imag());
accurate.add(me.getMultipoleData().get()[idx].getReal(),other.getMultipoleData().get()[idx].getReal()); accurate.add(me.getMultipoleData().get()[idx].real(),other.getMultipoleData().get()[idx].real());
} }
*cumul = accurate.getInfNorm()+ accurate.getL2Norm(); *cumul = accurate.getInfNorm()+ accurate.getL2Norm();
return accurate.getInfNorm() < Epsilon && accurate.getL2Norm() < Epsilon;//FMath::LookEqual(cumul,FReal(0.0)); return accurate.getInfNorm() < Epsilon && accurate.getL2Norm() < Epsilon;//FMath::LookEqual(cumul,FReal(0.0));
...@@ -69,8 +69,8 @@ bool isEqualPole(const CellClass& me, const CellClass& other, FReal*const cumul) ...@@ -69,8 +69,8 @@ bool isEqualPole(const CellClass& me, const CellClass& other, FReal*const cumul)
bool isEqualLocal(const FSphericalCell<FReal>& me, const FSphericalCell<FReal>& other,FReal*const cumul){ bool isEqualLocal(const FSphericalCell<FReal>& me, const FSphericalCell<FReal>& other,FReal*const cumul){
FMath::FAccurater<FReal> accurate; FMath::FAccurater<FReal> accurate;
for(int idx = 0; idx < FSphericalCell<FReal>::local_expansion_t::Size; ++idx){ for(int idx = 0; idx < FSphericalCell<FReal>::local_expansion_t::Size; ++idx){
accurate.add(me.getLocalExpansionData().get()[idx].getImag(),other.getLocalExpansionData().get()[idx].getImag()); accurate.add(me.getLocalExpansionData().get()[idx].imag(),other.getLocalExpansionData().get()[idx].imag());
accurate.add(me.getLocalExpansionData().get()[idx].getReal(),other.getLocalExpansionData().get()[idx].getReal()); accurate.add(me.getLocalExpansionData().get()[idx].real(),other.getLocalExpansionData().get()[idx].real());
} }
*cumul = accurate.getInfNorm()+ accurate.getL2Norm();