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

use real and imag functions

parent 5c3609b2
......@@ -996,8 +996,8 @@ public:
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 ){
//const coef = (b^l-j) / (l-j)!;
w_lm_real += coef[index_l_minus_j] * source_w[index_jm].getReal();
w_lm_imag += coef[index_l_minus_j] * source_w[index_jm].getImag();
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].imag();
}
target_w[index_lm].setRealImag(w_lm_real,w_lm_imag);
}
......@@ -1057,8 +1057,8 @@ public:
for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){
// coef = (j+l)!/b^(j+l+1)
// 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_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].getImag();
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].imag();
}
target_u[index_lm].setRealImag(u_lm_real,u_lm_imag);
minus_1_pow_m = -minus_1_pow_m;
......@@ -1112,8 +1112,8 @@ public:
for(int j = m ; j <= P-l ; ++j, ++index_jl, index_jm += j ){
// coef = (j+l)!/b^(j+l+1)
// 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_imag -= minus_1_pow_m * coef[index_jl] * source_w[index_jm].getImag();
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].imag();
}
target_u[index_lm].setRealImag(u_lm_real,u_lm_imag);
minus_1_pow_m = -minus_1_pow_m;
......@@ -1173,8 +1173,8 @@ public:
int index_j_minus_l = 0; // get l-j continously
for(int j = l ; j <= P ; ++j, ++index_j_minus_l, index_jm += j){
// coef = b^j-l/j-l!
u_lm_real += coef[index_j_minus_l] * source_u[index_jm].getReal();
u_lm_imag += coef[index_j_minus_l] * source_u[index_jm].getImag();
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].imag();
}
target_u[atLm(l,m)].setRealImag(u_lm_real,u_lm_imag);
}
......@@ -1279,14 +1279,14 @@ public:
for(int l = 1 ; l <= P ; ++l, ++fl){
// 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]
- legendre[index_lm-l]) / sph.getSinTheta());
const FReal dI_real = coef;
// F(O) += 2 * Real(L dI/dO)
FO += u[index_lm].getReal() * dI_real;
FO += u[index_lm].real() * dI_real;
}
++index_lm;
// then 0 < m
......@@ -1296,9 +1296,9 @@ public:
const FReal I_real = coef * cos_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)
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)
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];
......@@ -1307,7 +1307,7 @@ public:
const FReal dI_real = coef * cos_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)
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:
for(int l = 0 ; l <= P ; ++l ){
{//for m == 0
// (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;
}
for(int m = 1 ; m <= l ; ++m, ++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_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
......
......@@ -218,8 +218,8 @@ public:
for(int l = 0; l <= devP ; ++l){
for(int m = 0 ; m <= 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].setImag( magnitude * cosSin[m].getImag() );
harmonic[index_l_m].setReal( magnitude * cosSin[m].real() );
harmonic[index_l_m].setImag( magnitude * cosSin[m].imag() );
++index_l_m;
}
......@@ -260,8 +260,8 @@ public:
for(int l = 0 ; l <= devP ; ++l){
for(int m = 0 ; m <= 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].setImag( magnitude * cosSin[m].getImag() );
harmonic[index_l_m].setReal( magnitude * cosSin[m].real() );
harmonic[index_l_m].setImag( magnitude * cosSin[m].imag() );
++index_l_m;
}
......@@ -319,14 +319,14 @@ public:
magnitude = sphereHarmoInnerCoef[index_l_m] * r_pow_l * legendre[index_l_m];
// Computation of Inner_l^m(r, theta, phi):
harmonic[index_l_m].setReal( magnitude * cosSin[m].getReal());
harmonic[index_l_m].setImag( magnitude * cosSin[m].getImag());
harmonic[index_l_m].setReal( magnitude * cosSin[m].real());
harmonic[index_l_m].setImag( magnitude * cosSin[m].imag());
// 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]
- FReal(l+m)*(legendre[getPreExpRedirJ(l-1) + m])) / inSphere.getSinTheta());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].getReal());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].getImag());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].real());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].imag());
++index_l_m;
}
......@@ -334,13 +334,13 @@ public:
// m=l:
// Computation of Inner_m^m(r, theta, phi):
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].setImag(magnitude * cosSin[m].getImag());
harmonic[index_l_m].setReal(magnitude * cosSin[m].real());
harmonic[index_l_m].setImag(magnitude * cosSin[m].imag());
// 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());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].getReal());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].getImag());
thetaDerivatedResult[index_l_m].setReal(magnitude * cosSin[m].real());
thetaDerivatedResult[index_l_m].setImag(magnitude * cosSin[m].imag());
r_pow_l *= inSphere.getR();
++index_l_m;
......
......@@ -65,8 +65,8 @@ protected:
const int k = N-n-m;
if (k < 0){
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->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getImag());
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].imag());
}
else{
(*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k];
......@@ -205,8 +205,8 @@ public:
// Negative orders:
FReal minus_1_pow_k = FReal( j&1 ? -1 : 1);
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].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].getImag());
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)].imag());
minus_1_pow_k = -minus_1_pow_k;
}
}
......
......@@ -80,8 +80,8 @@ protected:
const int k = N-n-m;
if (k < 0){
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->setImag((-pow_of_minus_1) * blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)-k].getImag());
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].imag());
}
else{
(*fillTransfer) = blasHarmonic.result()[blasHarmonic.getPreExpRedirJ(M+N)+k];
......@@ -212,8 +212,8 @@ public:
// Negative orders:
FReal minus_1_pow_k = FReal( j&1 ? -1 : 1);
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].setImag((-minus_1_pow_k) * exp[j_j1 + (-k)].getImag());
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)].imag());
minus_1_pow_k = -minus_1_pow_k;
}
}
......
......@@ -152,11 +152,11 @@ public:
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 *
((M_n_l.getReal() * O_n_j__k_l.getReal()) +
(M_n_l.getImag() * O_n_j__k_l.getImag())));
((M_n_l.real() * O_n_j__k_l.real()) +
(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 *
((M_n_l.getImag() * O_n_j__k_l.getReal()) -
(M_n_l.getReal() * O_n_j__k_l.getImag())));
((M_n_l.imag() * O_n_j__k_l.real()) -
(M_n_l.real() * O_n_j__k_l.imag())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
}
......@@ -166,11 +166,11 @@ public:
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 *
((M_n_l.getReal() * O_n_j__k_l.getReal()) -
(M_n_l.getImag() * O_n_j__k_l.getImag())));
((M_n_l.real() * O_n_j__k_l.real()) -
(M_n_l.imag() * O_n_j__k_l.imag())));
L_j_k.decImag( pow_of_minus_1_for_k *
((M_n_l.getImag() * O_n_j__k_l.getReal()) +
(M_n_l.getReal() * O_n_j__k_l.getImag())));
((M_n_l.imag() * O_n_j__k_l.real()) +
(M_n_l.real() * O_n_j__k_l.imag())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
}
......@@ -180,11 +180,11 @@ public:
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 *
((M_n_l.getReal() * O_n_j__k_l.getReal()) +
(M_n_l.getImag() * O_n_j__k_l.getImag())));
((M_n_l.real() * O_n_j__k_l.real()) +
(M_n_l.imag() * O_n_j__k_l.imag())));
L_j_k.incImag( pow_of_minus_1_for_l *
((M_n_l.getReal() * O_n_j__k_l.getImag()) -
(M_n_l.getImag() * O_n_j__k_l.getReal())));
((M_n_l.real() * O_n_j__k_l.imag()) -
(M_n_l.imag() * O_n_j__k_l.real())));
pow_of_minus_1_for_l = -pow_of_minus_1_for_l;
}
......
......@@ -240,16 +240,16 @@ protected:
const FReal H_nu_minus_1 = ( nu-1 <= -n ?
FReal(0.0) :
(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 ?
FReal(0.0) :
(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 ?
FReal(0.0) :
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)
......@@ -456,11 +456,11 @@ public:
for(int k = -j ; k < 0 ; ++k){ /* k < 0 */
p_rot_multipole_exp->incReal( minus_1_pow_k *
((p_multipole_exp->getReal() * p_rcc_outer->getReal()) +
(p_multipole_exp->getImag() * p_rcc_outer->getImag())) );
((p_multipole_exp->real() * p_rcc_outer->real()) +
(p_multipole_exp->imag() * p_rcc_outer->imag())) );
p_rot_multipole_exp->incImag( minus_1_pow_k *
((p_multipole_exp->getReal() * p_rcc_outer->getImag()) -
(p_multipole_exp->getImag() * p_rcc_outer->getReal())) );
((p_multipole_exp->real() * p_rcc_outer->imag()) -
(p_multipole_exp->imag() * p_rcc_outer->real())) );
minus_1_pow_k = -minus_1_pow_k;
--p_rcc_outer;
......@@ -469,11 +469,11 @@ public:
for(int k = 0; k <= j ; ++k){ /* k >= 0 */
p_rot_multipole_exp->incReal(
((p_multipole_exp->getReal() * p_rcc_outer->getReal()) -
(p_multipole_exp->getImag() * p_rcc_outer->getImag())) );
((p_multipole_exp->real() * p_rcc_outer->real()) -
(p_multipole_exp->imag() * p_rcc_outer->imag())) );
p_rot_multipole_exp->incImag(
((p_multipole_exp->getReal() * p_rcc_outer->getImag()) +
(p_multipole_exp->getImag() * p_rcc_outer->getReal())) );
((p_multipole_exp->real() * p_rcc_outer->imag()) +
(p_multipole_exp->imag() * p_rcc_outer->real())) );
--p_rcc_outer;
++p_multipole_exp;
......@@ -497,8 +497,8 @@ public:
for(int k = 0 ; k <= min_j ; ++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){
p_rot_local_exp->incReal(p_rot_multipole_exp->getReal() * p_outer_array_j[n]);
p_rot_local_exp->incImag(p_rot_multipole_exp->getImag() * 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->imag() * p_outer_array_j[n]);
++p_rot_multipole_exp;
} /* for n */
++p_rot_local_exp;
......@@ -525,11 +525,11 @@ public:
for(int k = -min_j ; k < 0 ; ++k){ /* k < 0 */
p_local_exp->incReal( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getImag())));
((p_rot_local_exp->real() * p_rcc_inner->real()) +
(p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getReal())));
((p_rot_local_exp->real() * p_rcc_inner->imag()) -
(p_rot_local_exp->imag() * p_rcc_inner->real())));
minus_1_pow_k = -minus_1_pow_k;
--p_rot_local_exp;
......@@ -538,11 +538,11 @@ public:
for(int k = 0; k <= min_j ; ++k){ /* k >= 0 */
p_local_exp->incReal(
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getImag())));
((p_rot_local_exp->real() * p_rcc_inner->real()) -
(p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag(
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getReal())));
((p_rot_local_exp->real() * p_rcc_inner->imag()) +
(p_rot_local_exp->imag() * p_rcc_inner->real())));
++p_rot_local_exp;
++p_rcc_inner;
......@@ -566,11 +566,11 @@ public:
for(int k = -min_j ; k < 0; ++k){ /* k < 0 */
p_local_exp->incReal( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getImag())));
((p_rot_local_exp->real() * p_rcc_inner->real()) +
(p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag( minus_1_pow_k *
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getReal())));
((p_rot_local_exp->real() * p_rcc_inner->imag()) -
(p_rot_local_exp->imag() * p_rcc_inner->real())));
minus_1_pow_k = -minus_1_pow_k;
--p_rot_local_exp;
......@@ -578,11 +578,11 @@ public:
} /* for k */
for(int k = 0; k<=min_j; ++k){ /* k >= 0 */
p_local_exp->incReal(
((p_rot_local_exp->getReal() * p_rcc_inner->getReal()) -
(p_rot_local_exp->getImag() * p_rcc_inner->getImag())));
((p_rot_local_exp->real() * p_rcc_inner->real()) -
(p_rot_local_exp->imag() * p_rcc_inner->imag())));
p_local_exp->incImag(
((p_rot_local_exp->getReal() * p_rcc_inner->getImag()) +
(p_rot_local_exp->getImag() * p_rcc_inner->getReal())));
((p_rot_local_exp->real() * p_rcc_inner->imag()) +
(p_rot_local_exp->imag() * p_rcc_inner->real())));
++p_rot_local_exp;
++p_rcc_inner;
......
......@@ -58,7 +58,11 @@ public:
complex[0] = other.complex[0];
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 */
FComplex<FReal>& operator=(const FComplex<FReal>& other){
this->complex[0] = other.complex[0];
......@@ -77,23 +81,16 @@ public:
return !(*this == other);
}
/** Get imaginary */
FReal imag() const{
return this->complex[1];
}
/** Get imaginary */
FReal getImag() const{
return this->complex[1];
}
/** Get complex[0] */
FReal real() const{
return this->complex[0];
}
/** Get complex[0] */
FReal getReal() const{
return this->complex[0];
}
/** Set Imaginary */
void setImag(const FReal inImag) {
......@@ -245,7 +242,7 @@ public:
*/
template <class StreamClass>
friend StreamClass& operator<<(StreamClass& output, const FComplex<FReal>& inC){
output << "(" << inC.getReal() << ", " << inC.getImag() << ")";
output << "(" << inC.real() << ", " << inC.imag() << ")";
return output; // for multiple << operators.
}
......@@ -255,8 +252,8 @@ public:
template <class FReal>
inline FComplex<FReal> operator*=(const FComplex<FReal>& first, const FComplex<FReal>& second){
return FComplex<FReal>(
(first.getReal() * second.getImag()) + (first.getImag() * second.getReal()),
(first.getReal() * second.getReal()) - (first.getImag() * second.getImag())
(first.real() * second.imag()) + (first.imag() * second.real()),
(first.real() * second.real()) - (first.imag() * second.imag())
);
}
......
......@@ -422,7 +422,7 @@ public:
/// Get the MPI datatype corresponding to a variable.
template <class FReal>
static MPI_Datatype GetType(const FComplex<FReal>& a){
return GetType(a.getReal());
return GetType(a.real());
}
template <class FReal>
......
......@@ -58,8 +58,8 @@ template <class CellClass>
bool isEqualPole(const CellClass& me, const CellClass& other, FReal*const cumul){
FMath::FAccurater<FReal> accurate;
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].getReal(),other.getMultipoleData().get()[idx].getReal());
accurate.add(me.getMultipoleData().get()[idx].imag(),other.getMultipoleData().get()[idx].imag());
accurate.add(me.getMultipoleData().get()[idx].real(),other.getMultipoleData().get()[idx].real());
}
*cumul = accurate.getInfNorm()+ accurate.getL2Norm();
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)
bool isEqualLocal(const FSphericalCell<FReal>& me, const FSphericalCell<FReal>& other,FReal*const cumul){
FMath::FAccurater<FReal> accurate;
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].getReal(),other.getLocalExpansionData().get()[idx].getReal());
accurate.add(me.getLocalExpansionData().get()[idx].imag(),other.getLocalExpansionData().get()[idx].imag());
accurate.add(me.getLocalExpansionData().get()[idx].real(),other.getLocalExpansionData().get()[idx].real());
}
*cumul = accurate.getInfNorm()+ accurate.getL2Norm();
return accurate.getInfNorm() < Epsilon && accurate.getL2Norm() < Epsilon;//FMath::LookEqual(cumul,FReal(0.0));
......
......@@ -5,21 +5,21 @@
#include <cstdio>
#include <cstdlib>
#include "../../Src/Utils/FTic.hpp"
#include "../../Src/Utils/FParameters.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FParameters.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FVector.hpp"
#include "../../Src/Files/FTreeIO.hpp"
#include "Files/FTreeIO.hpp"
#include "../../Src/Kernels/Spherical/FSphericalCell.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "Kernels/Spherical/FSphericalCell.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Utils/FParameterNames.hpp"
#include "Utils/FParameterNames.hpp"
// Simply create particles and try the kernels
int main(int argc, char ** argv){
......@@ -117,8 +117,8 @@ int main(int argc, char ** argv){
FReal cumul = 0;
for(int idx = 0; idx < FSphericalCell<FReal>::multipole_t::getSize(); ++idx){
cumul += FMath::Abs( cell1->getMultipoleData().get()[idx].getImag() - cell2->getMultipoleData().get()[idx].getImag() );
cumul += FMath::Abs( cell1->getMultipoleData().get()[idx].getReal() - cell2->getMultipoleData().get()[idx].getReal() );
cumul += FMath::Abs( cell1->getMultipoleData().get()[idx].imag() - cell2->getMultipoleData().get()[idx].imag() );
cumul += FMath::Abs( cell1->getMultipoleData().get()[idx].real() - cell2->getMultipoleData().get()[idx].real() );
}
if( cumul > 0.00001 || FMath::IsNan(cumul)){
std::cout << "Pole Data are different. Cumul " << cumul << " at level " << idxLevel
......@@ -126,8 +126,8 @@ int main(int argc, char ** argv){
}
cumul = 0;
for(int idx = 0; idx < FSphericalCell<FReal>::local_expansion_t::getSize(); ++idx){
cumul += FMath::Abs( cell1->getLocalExpansionData().get()[idx].getImag() - cell2->getLocalExpansionData().get()[idx].getImag() );
cumul += FMath::Abs( cell1->getLocalExpansionData().get()[idx].getReal() - cell2->getLocalExpansionData().get()[idx].getReal() );
cumul += FMath::Abs( cell1->getLocalExpansionData().get()[idx].imag() - cell2->getLocalExpansionData().get()[idx].imag() );
cumul += FMath::Abs( cell1->getLocalExpansionData().get()[idx].real() - cell2->getLocalExpansionData().get()[idx].real() );
}
if( cumul > 0.00001 || FMath::IsNan(cumul)){
std::cout << "Local Data are different. Cumul " << cumul << " at level " << idxLevel
......
......@@ -162,17 +162,17 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> {
}
for(int idxLocal = 0 ; idxLocal < CellClass::local_expansion_t::getSize() ; ++idxLocal){
IsSimilar(testOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].getReal(),
goodOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].getReal());
IsSimilar(testOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].getImag(),
goodOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].getImag());
IsSimilar(testOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].real(),
goodOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].real());
IsSimilar(testOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].imag(),
goodOctreeIterator.getCurrentCell()->getLocalExpansionData().get()[idxLocal].imag());
}
for(int idxPole = 0 ; idxPole < CellClass::multipole_t::getSize() ; ++idxPole){
IsSimilar(testOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].getReal(),
goodOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].getReal());
IsSimilar(testOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].getImag(),
goodOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].getImag());
IsSimilar(testOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].real(),
goodOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].real());
IsSimilar(testOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].imag(),
goodOctreeIterator.getCurrentCell()->getMultipoleData().get()[idxPole].imag());
}
if(!testOctreeIterator.moveRight()){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment