Commit 4b2ef3c7 authored by Jean-Eric Campagne's avatar Jean-Eric Campagne
Browse files

(JEC) 23/2/16 Laguerre->Bessel using CC quadrature only

parent 321da181
......@@ -19,7 +19,7 @@ using namespace std;
using namespace LagSHT;
#define DEBUG 0
#define DEBUG 10
//JEC 12/1/16: alpha becomes double instead of int
......@@ -463,9 +463,9 @@ void TestJlnpComputation() {
string geometry = param.geometry;
int ntheta = param.ntheta;
int nphi = param.nphi;
string clenshawDir = param.clenshawDir; //JEC 23/11/15
string jlnpDir = param.jlnpDir; // "
bool recomputeJlnp = param.recomputeJlnp; // "
string clenshawDir = param.clenshawDir;
string jlnpDir = param.jlnpDir;
bool recomputeJlnp = param.recomputeJlnp;
cout << " ______________ TestJlnpComputation START ___________ " << endl;
LaguerreSphericalTransform sphlagtrans(geometry,
......@@ -483,11 +483,14 @@ void TestJlnpComputation() {
tstack_push("Ctor lag2bess");
recomputeJlnp = true;
Laguerre2Bessel lag2bess(sphere,lagTrans,Nmax,Pmax,Rmax,
clenshawDir,jlnpDir,recomputeJlnp);
tstack_pop("Ctor lag2bess");
cout << " ______________ TestJlnpComputation End ___________ " << endl;
}
......@@ -669,49 +672,48 @@ void TestLaguerre2Bessel() {
{//Check 1
cout << "Dump FL or FB reconstructed Alm(r_k)" <<endl;
{//Check 1b
cout << "Dump FL or FB reconstructed Cl(r_k)" <<endl;
#if DEBUG >=2
std::ofstream ofs;
ofs.open ("Almi.txt", std::ofstream::out);
ofs.open ("Cli.txt", std::ofstream::out);
#endif
for(int n=0;n<Nmax;n++){
r_8 err_abs(0.);
r_8 err_rel(0.);
for(int l=0;l<Lmax;l++){
r_8 ClFL = 0;
r_8 ClFB = 0;
for (int m=0;m<=l;m++) {
int id= n*Nalm + l+m*Lmax-m*(m+1)/2; // LagSHT numbering
r_8 almkFL2 = FLalmk[id].real()*FLalmk[id].real() + FLalmk[id].imag()*FLalmk[id].imag();
r_8 almkFB2 = FBalmk[id].real()*FBalmk[id].real() + FBalmk[id].imag()*FBalmk[id].imag();
ClFL += (m==0) ? almkFL2 : 2*almkFL2;
ClFB += (m==0) ? almkFB2 : 2*almkFB2;
}//m
ClFL /= (r_8)(2*l+1);
ClFB /= (r_8)(2*l+1);
#if DEBUG >=2
ofs <<l<<" "
<<m<<" "
<<n<< " " << setprecision(12) << FLalmk[id].real() << " " << FLalmk[id].imag()
<< " " << FBalmk[id].real() << " " << FBalmk[id].imag() << endl;
ofs <<l<<" " << n << " " << setprecision(12) << ClFL << " " << ClFB << endl;
#endif
complex<r_8> cdiff = (FLalmk[id] - FBalmk[id])*conj(FLalmk[id] - FBalmk[id]);
r_8 diff = sqrt(cdiff.real());
if(diff>err_abs){
err_abs = diff;
}
complex<r_8> cref= FLalmk[id]*conj(FLalmk[id]);
r_8 ref = sqrt(cref.real());
r_8 relatdiff = diff/ref;
if(relatdiff>err_rel) err_rel = relatdiff;
}
}
cout << " >>>>>>>>>>>>>>>>>>>>> Shell["<<n<<"] <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
cout << "Err. Max. " << err_abs << ", Err. Rel. " << err_rel << endl;
cout << " >>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
}
}//l
}//n
#if DEBUG >=2
ofs.close();
#endif
}//check 1
}//check 1b
{//check 2
#if DEBUG >=2
......
This diff is collapsed.
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