[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 |
|
---|
[3077] | 8 | #include "srandgen.h"
|
---|
[729] | 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 |
|
---|
[1756] | 21 | Alm() : TriangularMatrix<complex<T> >() {;};
|
---|
[729] | 22 | /* instanciate the class from the maximum value of the index \f$l\f$ in the sequence of the \f$a_{lm}\f$'s */
|
---|
[2958] | 23 | Alm(sa_size_t nlmax) : TriangularMatrix<complex<T> >(nlmax+1) {;}
|
---|
[729] | 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 */
|
---|
[2958] | 28 | inline void ReSizeToLmax(sa_size_t nlmax) {this->ReSizeRow(nlmax+1);}
|
---|
| 29 | inline sa_size_t Lmax() const {return this->rowNumber()-1;}
|
---|
[729] | 30 | TVector<T> powerSpectrum() const;
|
---|
| 31 |
|
---|
[1683] | 32 | inline Alm<T>& SetComplexT(complex<T> a)
|
---|
| 33 | {
|
---|
| 34 | this->SetT(a);
|
---|
| 35 | return *this;
|
---|
| 36 | }
|
---|
| 37 | inline Alm<T>& operator = (complex<T> a)
|
---|
| 38 | {
|
---|
| 39 | return SetComplexT(a);
|
---|
| 40 | }
|
---|
[729] | 41 |
|
---|
| 42 | };
|
---|
| 43 | /*! 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$ */
|
---|
| 44 | template <class T>
|
---|
| 45 | class Bm
|
---|
| 46 | {
|
---|
| 47 | public :
|
---|
| 48 | Bm(): nmmax_(0) {;};
|
---|
| 49 | /* instanciate from the maximum absolute value of the index */
|
---|
[2958] | 50 | Bm(sa_size_t mmax) : nmmax_(mmax) { bm_.ReSize( (2*mmax+1) );}
|
---|
[729] | 51 | Bm(const Bm<T>& b, bool share=false) : nmmax_(b.nmmax_), bm_(b.bm_, share) {;}
|
---|
| 52 | /*! resize with a new value of mmax */
|
---|
[2958] | 53 | inline void ReSizeToMmax(sa_size_t mmax)
|
---|
[729] | 54 | {
|
---|
[2958] | 55 | nmmax_= mmax;
|
---|
[729] | 56 | bm_.ReSize(2* nmmax_+1);
|
---|
| 57 | }
|
---|
[2958] | 58 | //inline sa_size_t Size() const {return 2*nmmax_+1;};
|
---|
| 59 | inline T& operator()(sa_size_t m) {return bm_( adr_i(m));};
|
---|
| 60 | inline T const& operator()(sa_size_t m) const {return *(bm_.Begin()+ adr_i(m));};
|
---|
[729] | 61 | /*! return the current value of the maximum absolute value of the index */
|
---|
[2958] | 62 | inline sa_size_t Mmax() const
|
---|
[729] | 63 | {
|
---|
[2958] | 64 | return nmmax_;
|
---|
[729] | 65 | }
|
---|
| 66 | inline Bm<T>& operator = (const Bm<T>& b)
|
---|
| 67 | {
|
---|
| 68 | if (this != &b)
|
---|
| 69 | {
|
---|
| 70 | nmmax_= b.nmmax_;
|
---|
| 71 | bm_= b.bm_;
|
---|
| 72 | }
|
---|
| 73 | return *this;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | private:
|
---|
| 77 | /*! return the address in the array representing the vector */
|
---|
[2958] | 78 | inline sa_size_t adr_i(sa_size_t i) const
|
---|
[729] | 79 | {
|
---|
[2958] | 80 | return (i+nmmax_);
|
---|
[729] | 81 | }
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 |
|
---|
[2958] | 85 | sa_size_t nmmax_;
|
---|
[729] | 86 | NDataBlock<T> bm_;
|
---|
| 87 |
|
---|
| 88 | };
|
---|
| 89 |
|
---|
[1371] | 90 | } // namespace SOPHYA
|
---|
[729] | 91 |
|
---|
| 92 | #endif
|
---|