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

(JEC) 19/1/16 testsuite update with spin =/= 0 and alpha =/= 2

parent 96297123
......@@ -181,6 +181,12 @@ fullcheck :
$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -nphi 2048 -g ECP
$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -nphi 2048 -g Gauss
$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -ntheta 512 -g Healpix
$(EXE)lagsht_testsuite -t 4 -a 0 -l 1024 -n 128 -nphi 2048 -g Gauss
$(EXE)lagsht_testsuite -t 6 -spin 2 -l 512 -n 128 -nphi 1024 -g Gauss
$(EXE)lagsht_testsuite -t 6 -spin 2 -l 512 -n 128 -nphi 1024 -g ECP
$(EXE)lagsht_testsuite -t 6 -spin 2 -l 512 -n 128 -ntheta 256 -g Healpix
$(EXE)lagsht_testsuite -t 6 -a 0 -spin 2 -l 512 -n 128 -nphi 1024 -g Gauss
......
......@@ -73,8 +73,10 @@ void LaguerreSphericalTransform::Analysis(const vector<r_8>& fijk,
) {
int Ntot3DPix = Npix_*N_;
int NtotCoeff = Nalm_*N_;
if(fijk.size() != (size_t)Ntot3DPix) throw LagSHTError("SphLagTransform::Analysis size error");
flmn.resize(NtotCoeff);
if(fijk.size() != (size_t)Ntot3DPix) throw LagSHTError("SphLagTransform::Analysis size error: fijk");
if(almk.size() != (size_t)NtotCoeff) throw LagSHTError("SphLagTransform::Analysis size error: almk");
//done in Laguerre routine flmn.resize(NtotCoeff);
#if DEBUG >= 1
cout << "SphLagTransform::Analysis.... Go..." << endl;
......@@ -203,8 +205,8 @@ void LaguerreSphericalTransform::Analysis(const vector<r_8>& fijk_re, const vect
int Ntot3DPix = Npix_*N_;
int NtotCoeff = Nalm_*N_;
if(fijk_re.size() != (size_t)Ntot3DPix || fijk_im.size() != (size_t)Ntot3DPix) throw LagSHTError("SphLagTransform::Analysis size error");
Elmn.resize(NtotCoeff);
Blmn.resize(NtotCoeff);
//done in Laguerre routine Elmn.resize(NtotCoeff);
// Blmn.resize(NtotCoeff);
//Perform the Inverse Laguerre Transform first
......
......@@ -131,7 +131,7 @@ class LaguerreSphericalTransform {
//! Synthesis
//! Synthesis (spin = 0)
/*! \brief Coeffs -> Pixels with Input/Output using T floating representation
\input flmn: 3D complex spherical-laguerre coefficients
\output fijk: 3D real function values
......@@ -141,7 +141,11 @@ class LaguerreSphericalTransform {
vector<r_8>& fijk,
vector< complex<r_8> >& almk);
//backward compatibility
//!Synthesis (spin = 0)
/*! \brief Coeffs -> Pixels with Input/Output using T floating representation
\input flmn: 3D complex spherical-laguerre coefficients
\output fijk: 3D real function values
*/
void Synthesis(const vector< complex<r_8> >& flmn, vector<r_8>& fijk) {
int NtotCoeff = Nalm_*N_;
vector< complex<r_8> > almk(NtotCoeff);
......@@ -149,34 +153,38 @@ class LaguerreSphericalTransform {
}
//! Analysis
/*! \brief Pixels -> Coeffs with Input/Output using T floating representation
\input fijk: 3D real function values
\output flmn: 3D complex spherical-laguerre coefficients
*/
void Analysis(const vector<r_8>& fijk, vector< complex<r_8> >& flmn){
int NtotCoeff = Nalm_*N_;
vector< complex<r_8> > almk(NtotCoeff);
Analysis(fijk,flmn,almk);
}
//! Analysis
//! Analysis (spin = 0)
/*! \brief Pixels -> Coeffs with Input/Output using T floating representation
\input fijk: 3D real function values
\output flmn: 3D complex spherical-laguerre coefficients
\output almk: 2D alm complex spherical coefficients for each subshell k
*/
void Analysis(const vector<r_8>& fijk,
vector< complex<r_8> >& flmn,
vector< complex<r_8> >& almk
);
//! Analysis (spin = 0)
/*! \brief Pixels -> Coeffs with Input/Output using T floating representation
\input fijk: 3D real function values
\output flmn: 3D complex spherical-laguerre coefficients
*/
void Analysis(const vector<r_8>& fijk, vector< complex<r_8> >& flmn){
int NtotCoeff = Nalm_*N_;
vector< complex<r_8> > almk(NtotCoeff);
Analysis(fijk,flmn,almk);
}
/*!
Test of spin-weighted decomposition
*/
//! Synthesis (spn>0)
/*! \brief Coeffs -> Pixels with Input/Output using T floating representation
\input Elmn: 3D complex spherical-laguerre coefficients of the gradiant E
\input Blmn: 3D complex spherical-laguerre coefficients of the curl B
\output fijk_re: 3D real part of the complex function values
\output fijk_im: 3D imaginary part of the complex function values
\output Elmk: 2D alm complex spherical coefficients for each subshell k of the gradient E
\output Blmk: 2D alm complex spherical coefficients for each subshell k of the curl B
*/
void Synthesis(const vector< complex<r_8> >& Elmn, const vector<complex<r_8> >& Blmn,
int spin,
vector<r_8>& fijk_re, vector<r_8>& fijk_im,
......@@ -184,12 +192,41 @@ class LaguerreSphericalTransform {
);
void Synthesis(const vector< complex<r_8> >& Elmn, const vector<complex<r_8> >& Blmn,
int spin,
vector<r_8>& fijk_re, vector<r_8>& fijk_im
){
int NtotCoeff = Nalm_*N_;
vector< complex<r_8> > Elmk(NtotCoeff);
vector< complex<r_8> > Blmk(NtotCoeff);
Synthesis(Elmn,Blmn,spin,fijk_re,fijk_im,Elmk,Blmk);
}
//! Analysis (spn>0)
/*! \brief Pixels -> Coeffs with Input/Output using T floating representation
\input fijk_re: 3D real part of the complex function values
\input fijk_im: 3D imaginary part of the complex function values
\output Elmn: 3D complex spherical-laguerre coefficients of the gradiant E
\output Blmn: 3D complex spherical-laguerre coefficients of the curl B
\output Elmk: 2D alm complex spherical coefficients for each subshell k of the gradient E
\output Blmk: 2D alm complex spherical coefficients for each subshell k of the curl B
*/
void Analysis(const vector<r_8>& fijk_re, const vector<r_8>& fijk_im,
int spin,
vector< complex<r_8> >& Elmn, vector<complex<r_8> >& Blmn,
vector< complex<r_8> >& Elmk, vector<complex<r_8> >& Blmk
);
void Analysis(const vector<r_8>& fijk_re, const vector<r_8>& fijk_im,
int spin,
vector< complex<r_8> >& Elmn, vector<complex<r_8> >& Blmn
){
int NtotCoeff = Nalm_*N_;
vector< complex<r_8> > Elmk(NtotCoeff);
vector< complex<r_8> > Blmk(NtotCoeff);
Analysis(fijk_re, fijk_im, spin, Elmn, Blmn, Elmk, Blmk);
}
protected:
......
......@@ -101,6 +101,10 @@ void ECPGeometry::SetMap(int nrings, int nphi) {
//nrings = 2Lmax+1
//npixper ring = 2Mmax+1
//Here: by default the minimal Nrings and Nphi according to Lmax (highest Lmax-1) and Mmax
//but one can tune Nphi to get a number as power of 2, 3 and 5.
Nrings_ = (nrings == -1) ? 2*L_-1 : nrings;
Nphi_ = (nphi == -1) ? 2*M_-1 : nphi;
......@@ -154,6 +158,10 @@ void GaussGeometry::SetMap(int nrings, int nphi) {
//dans sharp_testsuite.c Gauss
//nrings = Lmax+1
//npixper ring = 2Mmax+1
//Here: by default the minimal Nrings and Nphi according to Lmax (highest Lmax-1) and Mmax
//but one can tune Nphi to get a number as power of 2, 3 and 5.
Nrings_ = (nrings == -1) ? L_ : nrings;
Nphi_ = (nphi == -1) ? 2*M_-1 : nphi;
......
......@@ -209,13 +209,22 @@ void MultiSphericalLaguerreTransform() {
int Npix = sphlagtrans.GetSphericalGeometry()->Npix();
int NpTot= Nshell * Npix; //totoal number of 3D-pixels
cout << "Verif: Npix, Nptot, Nalm, Nshell, Ntot: "
cout << "Verif: Ntheta, Nphi, Npix, Nptot, Nalm, Nshell, Ntot: "
<< sphlagtrans.GetSphericalGeometry()->NTheta() << " "
<< sphlagtrans.GetSphericalGeometry()->NPhi() << " "
<< Npix << " "
<< NpTot << " "
<< Nalm << " "
<< Nshell << " "
<< Ntot << endl;
unsigned int maxmemsize = getMemorySize()/1e6;
unsigned int estimateMem = 8*((uint_8)(NpTot+2*Ntot))/1e6;
cout << "Estimate usage memory: " << estimateMem << " MBytes" << endl;
if ( estimateMem > (0.9*maxmemsize) ) {
cout << ">>>>> Warning: estimate Mem " << estimateMem <<" MB > 90\% "<< maxmemsize << " MB" << endl;
}//test memory
vector< complex<r_8> > flmnOrig(Ntot);
int id=-1;
for(int n=0;n<Nmax;n++){ //on each shell
......@@ -303,6 +312,9 @@ void SpinMultiSphericalLaguerreTransform() {
int nphi = param.nphi;
int spin = param.spin; //JEC 18/1/16
if(spin == 0)
throw LagSHTError("WARNING: spin =0 : use test MultiSphericalLaguerreTransform");
cout << " ___________ SpinMultiSphericalLaguerreTransform TEST _____________ " << endl;
tstack_push("data input");
......@@ -326,13 +338,25 @@ void SpinMultiSphericalLaguerreTransform() {
int Npix = sphlagtrans.GetSphericalGeometry()->Npix();
int NpTot= Nshell * Npix; //totoal number of 3D-pixels
cout << "Verif: Npix, Nptot, Nalm, Nshell, Ntot: "
cout << "Verif: Ntheta, Nphi, Npix, Nptot, Nalm, Nshell, Ntot: "
<< sphlagtrans.GetSphericalGeometry()->NTheta() << " "
<< sphlagtrans.GetSphericalGeometry()->NPhi() << " "
<< Npix << " "
<< NpTot << " "
<< Nalm << " "
<< Nshell << " "
<< Ntot << endl;
unsigned int maxmemsize = getMemorySize()/1e6;
unsigned int estimateMem = 2*8*((uint_8)(NpTot+2*Ntot))/1e6;
cout << "Estimate usage memory: " << estimateMem << " MBytes" << endl;
if ( estimateMem > (0.9*maxmemsize) ) {
cout << ">>>>> Warning: estimate Mem " << estimateMem <<" MB > 90\% "<< maxmemsize << " MB" << endl;
}//test memory
vector< complex<r_8> > ElmnOrig(Ntot);
vector< complex<r_8> > BlmnOrig(Ntot);
int id
......@@ -367,10 +391,11 @@ void SpinMultiSphericalLaguerreTransform() {
#endif
vector<r_8> fijk_re; //NpTot
vector<r_8> fijk_im;
vector< complex<r_8> > Elmk; //calcul intermediaire
vector< complex<r_8> > Blmk;
// vector< complex<r_8> > Elmk; //calcul intermediaire
// vector< complex<r_8> > Blmk;
sphlagtrans.Synthesis(ElmnOrig, BlmnOrig, spin, fijk_re, fijk_im, Elmk, Blmk);
// sphlagtrans.Synthesis(ElmnOrig, BlmnOrig, spin, fijk_re, fijk_im, Elmk, Blmk);
sphlagtrans.Synthesis(ElmnOrig, BlmnOrig, spin, fijk_re, fijk_im);
#if DEBUG >= 2
for (int i=0; i<NpTot; i++){
cout << "fijk("<<i<<"): " << fijk_re[i] << ", " << fijk_im[i] << endl;
......@@ -383,13 +408,14 @@ void SpinMultiSphericalLaguerreTransform() {
#if DEBUG >= 1
cout << "Main:Analysis complex function..." << endl;
#endif
vector< complex<r_8> > Elmn;
vector< complex<r_8> > Blmn;
vector< complex<r_8> > Elmn(Ntot);
vector< complex<r_8> > Blmn(Ntot);
vector< complex<r_8> > Elmk_ana;
vector< complex<r_8> > Blmk_ana;
// vector< complex<r_8> > Elmk_ana;
// vector< complex<r_8> > Blmk_ana;
sphlagtrans.Analysis(fijk_re, fijk_im, spin, Elmn, Blmn, Elmk_ana, Blmk_ana);
// sphlagtrans.Analysis(fijk_re, fijk_im, spin, Elmn, Blmn, Elmk_ana, Blmk_ana);
sphlagtrans.Analysis(fijk_re, fijk_im, spin, Elmn, Blmn);
tstack_pop("processing part Analysis");
tstack_pop("processing");
......@@ -892,13 +918,13 @@ int main(int narg, char *arg[]) {
if(N>5500) throw LagSHTError("WARNING: N>5500 the algorithm may fail due to weight estimates");
unsigned int estimateMem = 8*N*(uint_8)((2*Lmax+1)*(2*Lmax+1))/1e6; //Npix * 8Bytes and then in MBytes
if ( estimateMem > (0.9*maxmemsize) ) {
char buff[80];
cout << "estimate Mem usage " << estimateMem << " MB" << endl;
sprintf(buff,"Main FATAL: estimate Mem %u MB > (90%%) Max Mem %u MB ",estimateMem,maxmemsize);
throw LagSHTError(buff);
}//test memory
// unsigned int estimateMem = 8*N*(uint_8)((2*Lmax+1)*(2*Lmax+1))/1e6; //Npix * 8Bytes and then in MBytes
// if ( estimateMem > (0.9*maxmemsize) ) {
// char buff[80];
// cout << "estimate Mem usage " << estimateMem << " MB" << endl;
// sprintf(buff,"Main FATAL: estimate Mem %u MB > (90%%) Max Mem %u MB ",estimateMem,maxmemsize);
// throw LagSHTError(buff);
// }//test memory
tstack_push("MultiSphericalLaguerreTransform");
MultiSphericalLaguerreTransform();
......@@ -927,6 +953,16 @@ int main(int narg, char *arg[]) {
case 6:
{
unsigned int estimateMem = 8*2*N*(uint_8)((2*Lmax+1)*(2*Lmax+1))/1e6; //Npix * 8Bytes and then in MBytes
if ( estimateMem > (0.9*maxmemsize) ) {
char buff[80];
cout << "estimate Mem usage " << estimateMem << " MB" << endl;
sprintf(buff,"Main FATAL: estimate Mem %u MB > (90%%) Max Mem %u MB ",estimateMem,maxmemsize);
throw LagSHTError(buff);
}//test memory
tstack_push("SpinMultiSphericalLaguerreTransform");
SpinMultiSphericalLaguerreTransform();
tstack_pop("SpinMultiSphericalLaguerreTransform");
......
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