Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 71a146f1 authored by berenger-bramas's avatar berenger-bramas
Browse files

Clean some part of the file.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@295 2616d619-271b-44dc-8df4-d4a8f33a7222
parent da14a1b2
No related branches found
No related tags found
No related merge requests found
...@@ -93,38 +93,39 @@ class FHarmonic { ...@@ -93,38 +93,39 @@ class FHarmonic {
/** Compute legendre */ /** Compute legendre */
void computeLegendre(const FReal inCosTheta, const FReal inSinTheta){ void computeLegendre(const FReal inCosTheta, const FReal inSinTheta){
int idxCurrent = 0; const FReal invSinTheta = -inSinTheta;
legendre[idxCurrent++] = 1.0; // P_0^0(cosTheta) = 1
legendre[idxCurrent++] = inCosTheta; // P_1^{0} using (3) legendre[0] = 1.0; // P_0,0(cosTheta) = 1
legendre[1] = inCosTheta; // P_1,0(cosTheta) = cosTheta
legendre[2] = invSinTheta;// P_1,1(cosTheta) = -sinTheta
// Compute P_1^1 using (2 bis) and store it into results_array int idxCurrentLM = 3; //current pointer on P_l,m
const FReal invSinTheta = -inSinTheta; // somx2 => -sinTheta int idxCurrentL1M = 1; //pointer on P_{l-1},m => P_1,0
legendre[idxCurrent++] = invSinTheta; int idxCurrentL2M = 0; //pointer on P_{l-2},m => P_0,0
// l>1:
int idxCurrent1m = 1; //pointer on P_{l-1}^m P_1^0
int idxCurrent2m = 0; //pointer on P_{l-2}^m P_0^0
FReal fact = 3.0; FReal fact = 3.0;
// Remark: p_results_array_l_minus_1_m and p_results_array_l_minus_2_m
// just need to be incremented at each iteration.
for(int idxl = 2; idxl <= devP ; ++idxl ){ for(int idxl = 2; idxl <= devP ; ++idxl ){
for( int idxm = 0; idxm <= idxl - 2 ; ++idxm , ++idxCurrent , ++idxCurrent1m , ++idxCurrent2m ){ // m from 0 to l - 2
// Compute P_l^m, l >= m+2, using (1) and store it into results_array: for( int idxm = 0; idxm <= idxl - 2 ; ++idxm ){
legendre[idxCurrent] = (inCosTheta * FReal( 2 * idxl - 1 ) * legendre[idxCurrent1m] - FReal( idxl + idxm - 1 ) // cosTheta x (2 x l - 1) x P_l-1_m - (l + m - 1) x P_l-2_m
* legendre[idxCurrent2m] ) / FReal( idxl - idxm ); // P_l_m = --------------------------------------------------------
// l - m
legendre[idxCurrentLM] = (inCosTheta * FReal( 2 * idxl - 1 ) * legendre[idxCurrentL1M]
- FReal( idxl + idxm - 1 ) * legendre[idxCurrentL2M] )
/ FReal( idxl - idxm );
// progress
++idxCurrentLM;
++idxCurrentL1M;
++idxCurrentL2M;
} }
// p_results_array_l_minus_1_m now points on P_{l-1}^{l-1}
// Compute P_l^{l-1} using (3) and store it into ptrResults:
legendre[idxCurrent++] = inCosTheta * FReal( 2 * idxl - 1 ) * legendre[idxCurrent1m];
// Compute P_l^l using (2 bis) and store it into results_array: // Compute P_l,{l-1}
legendre[idxCurrent++] = fact * invSinTheta * legendre[idxCurrent1m]; legendre[idxCurrentLM++] = inCosTheta * FReal( 2 * idxl - 1 ) * legendre[idxCurrentL1M];
// Compute P_l,l
legendre[idxCurrentLM++] = fact * invSinTheta * legendre[idxCurrentL1M];
fact += FReal(2.0); fact += FReal(2.0);
++idxCurrent1m; ++idxCurrentL1M;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment