[1371] | 1 | // Class for representing spherical harmonic coefficients
|
---|
| 2 | // G. Le Meur 2000
|
---|
| 3 | // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay)
|
---|
| 4 |
|
---|
[729] | 5 | #ifndef ALM_SEEN
|
---|
| 6 | #define ALM_SEEN
|
---|
[758] | 7 |
|
---|
[729] | 8 | #include "nbrandom.h"
|
---|
| 9 | #include "nbmath.h"
|
---|
[758] | 10 | #include "triangmtx.h"
|
---|
[729] | 11 | #include "tvector.h"
|
---|
| 12 |
|
---|
[1371] | 13 | namespace SOPHYA {
|
---|
[729] | 14 |
|
---|
| 15 | /*! class for the coefficients \f$a_{lm}\f$ of the development of a function defined on a sphere, in spherical harmonics */
|
---|
| 16 | template <class T>
|
---|
| 17 | class Alm : public TriangularMatrix<complex<T> >
|
---|
| 18 | {
|
---|
| 19 | public :
|
---|
| 20 |
|
---|
| 21 | Alm() : TriangularMatrix<complex<T> >() {};
|
---|
| 22 | /* instanciate the class from the maximum value of the index \f$l\f$ in the sequence of the \f$a_{lm}\f$'s */
|
---|
| 23 | Alm(int nlmax) : TriangularMatrix<complex<T> >(nlmax+1) {;}
|
---|
| 24 | Alm(const Alm<T>& a, bool share=false) : TriangularMatrix<complex<T> >(a, share) {;}
|
---|
| 25 |
|
---|
| 26 | Alm(const TVector<T>& clin, const r_8 fwhm) ;
|
---|
| 27 | /*! resize with a new lmax */
|
---|
| 28 | inline void ReSizeToLmax(int_4 nlmax) {ReSizeRow(nlmax+1);}
|
---|
| 29 | inline int_4 Lmax() const {return rowNumber()-1;}
|
---|
| 30 | TVector<T> powerSpectrum() const;
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | };
|
---|
| 34 | /*! class for a vector with an index running from \f$-m_{max}\f$ to \f$+m_{max}\f$ (then the size of the vector will be actually \f$2m_{max}+1)\f$ */
|
---|
| 35 | template <class T>
|
---|
| 36 | class Bm
|
---|
| 37 | {
|
---|
| 38 | public :
|
---|
| 39 | Bm(): nmmax_(0) {;};
|
---|
| 40 | /* instanciate from the maximum absolute value of the index */
|
---|
| 41 | Bm(int mmax) : nmmax_((uint_4)mmax) { bm_.ReSize( (uint_4)(2*mmax+1) );}
|
---|
| 42 | Bm(const Bm<T>& b, bool share=false) : nmmax_(b.nmmax_), bm_(b.bm_, share) {;}
|
---|
| 43 | /*! resize with a new value of mmax */
|
---|
| 44 | inline void ReSizeToMmax(int_4 mmax)
|
---|
| 45 | {
|
---|
| 46 | nmmax_=(uint_4)l;
|
---|
| 47 | bm_.ReSize(2* nmmax_+1);
|
---|
| 48 | }
|
---|
| 49 | //inline int_4 Size() const {return 2*nmmax_+1;};
|
---|
| 50 | inline T& operator()(int m) {return bm_( adr_i(m));};
|
---|
| 51 | inline T const& operator()(int m) const {return *(bm_.Begin()+ adr_i(m));};
|
---|
| 52 | /*! return the current value of the maximum absolute value of the index */
|
---|
| 53 | inline int_4 Mmax() const
|
---|
| 54 | {
|
---|
| 55 | return (int_4)nmmax_;
|
---|
| 56 | }
|
---|
| 57 | inline Bm<T>& operator = (const Bm<T>& b)
|
---|
| 58 | {
|
---|
| 59 | if (this != &b)
|
---|
| 60 | {
|
---|
| 61 | nmmax_= b.nmmax_;
|
---|
| 62 | bm_= b.bm_;
|
---|
| 63 | }
|
---|
| 64 | return *this;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | private:
|
---|
| 68 | /*! return the address in the array representing the vector */
|
---|
| 69 | inline uint_4 adr_i(int i) const
|
---|
| 70 | {
|
---|
| 71 | return(uint_4)(i+nmmax_);
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | uint_4 nmmax_;
|
---|
| 77 | NDataBlock<T> bm_;
|
---|
| 78 |
|
---|
| 79 | };
|
---|
| 80 |
|
---|
[1371] | 81 | } // namespace SOPHYA
|
---|
[729] | 82 |
|
---|
| 83 | #endif
|
---|