lagSphericTransform.h 3.81 KB
Newer Older
1 2
#ifndef LAGSPHERICTRANSFORM_SEEN
#define LAGSPHERICTRANSFORM_SEEN
3

4 5
// #include <utility>      // std::pair, std::make_pair
// using namespace std;
6

7
//Sharp
8 9 10 11
// #include "sharp_lowlevel.h"
// #include "sharp_geomhelpers.h"
// #include "sharp_almhelpers.h"
// #include "sharp_cxx.h"
12

13
#include "lagsht_spheregeom.h"
14
#include "laguerreTransform.h"
15
//#include "lagsht_geom.h"
16 17 18 19 20 21 22 23 24 25
#include "lagsht_exceptions.h"


namespace LagSHT {


////////////////////////////////////////////////////////////////
//// --------- Class Spherical Harmonic Laguerre Transform -- //
////////////////////////////////////////////////////////////////

26
class LaguerreSphericalTransform {
27 28
 public:

29

30 31
  LaguerreSphericalTransform(string spheregeom, int Lmax, int Mmax, int Nmax, 
			     r_8 R, int Nrings = -1, int Nphi = -1, int alpha=2): 
32
    R_(R) {
33 34 35
    
    //Factory
    if (spheregeom == "ECP" || spheregeom == "Fejer1") {
36
      sphere_ = new ECPGeometry(Lmax, Mmax, Nrings, Nphi);
37
    } else if (spheregeom == "Gauss") {
38
      sphere_ = new GaussGeometry(Lmax, Mmax, Nrings, Nphi);      
39
    } else if (spheregeom == "Healpix") {
40
      sphere_ = new HealpixGeometry(Lmax, Mmax, Nrings); //here Nsides = Nrings
41 42 43 44 45
    } else {
      cout << "FAILURE: LaguerreSphericalTransform::Ctor wrong geometry type" << endl;
      sphere_ = 0;
      throw LagSHTError("LaguerreSphericalTransform::Ctor wrong geometry type");
    }
46 47 48

    lagTrans_ = new LaguerreTransform(Nmax, R, alpha); 

49 50 51 52 53 54
    
    //do the map pixelization
    if(sphere_) {
      //store localy usefull parameters for the algorithms Analysis/Synthesis
      Npix_ = sphere_->Npix();
      Nalm_ = sphere_->Nalm();
55 56
    } else {
      throw LagSHTError("LaguerreSphericalTransform::Ctor sphere_ ptr NULL");
57 58
    }

59 60 61 62 63 64 65 66 67

    if(lagTrans_) {
      N_    = lagTrans_->GetOrder();
      alpha_= lagTrans_->GetAlpha();
    } else {
      throw LagSHTError("LaguerreSphericalTransform::Ctor lagtrans_ ptr NULL");
    }


68 69 70 71
  }//Ctor

    
  //! Destructor
72
  virtual ~LaguerreSphericalTransform() {
73 74
    if(sphere_) delete sphere_;  sphere_ = 0;
    if(lagTrans_) delete lagTrans_; lagTrans_ = 0;
75
  }
76
  
77 78 79
  //! Geometry helper
  BaseGeometry* GetSphericalGeometry() const { return sphere_;}

80 81 82
  //! Laguerre Transform helper
  LaguerreTransform* GetLagTransform() const { return lagTrans_;}

83 84 85 86 87
   //! Getters
  int GetOrder() { return N_; }
  int GetAlpha() { return alpha_;}


88 89
 //! Synthesis 
 /*! \brief Coeffs -> Pixels with Input/Output using T floating representation
90 91
   \input flmn: 3D complex spherical-laguerre coefficients
   \output fijk: 3D real function values
92 93 94 95 96
 */
  void Synthesis(const vector< complex<r_8> >& flmn, vector<r_8>& fijk);

  //! Analysis
  /*! \brief Pixels -> Coeffs with Input/Output using T floating representation
97 98
    \input fijk: 3D real function values
    \output flmn: 3D complex spherical-laguerre coefficients
99
  */
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
  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
  /*! \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
		);
118 119 120 121


protected:
  r_8 R_; //!< Radial maximal value (not yet used)
122 123 124

  BaseGeometry* sphere_; //<! the 2D pixelization of the shells 

125
  LaguerreTransform* lagTrans_; //!< the Laguerre Transform
126
  
127 128 129 130 131 132
  int Npix_; //!< Total number of 2D pixels
  int Nalm_; //!< Total number of Alm coefficients

  int N_; //!< Order of the Generalized Lagurerre polynomial
  int alpha_;  //!< second parameter of the generalized Laguerre polynomial 

133 134 135 136 137 138
}; //class


}//end namespace
#endif