|
SpECTRE
2021.08.02
|
Iterates over spectral coefficients stored in SPHEREPACK format. More...
#include <SpherepackIterator.hpp>
Public Types | |
| enum class | CoefficientArray { a , b } |
| SPHEREPACK has two coefficient variables, 'a' and 'b', that hold the cos(m*phi) and sin(m*phi) parts of the spectral coefficients. | |
Public Member Functions | |
| SpherepackIterator (size_t l_max_input, size_t m_max_input, size_t stride=1) | |
| size_t | l_max () const noexcept |
| size_t | m_max () const noexcept |
| size_t | n_th () const noexcept |
| size_t | n_ph () const noexcept |
| size_t | stride () const noexcept |
| size_t | spherepack_array_size () const noexcept |
| Size of a SPHEREPACK coefficient array (a and b combined), not counting stride. For non-unit stride, the size of the array should be spherepack_array_size()*stride. | |
| SpherepackIterator & | operator++ () noexcept |
| operator bool () const noexcept | |
| size_t | operator() () const noexcept |
| Current index into a SPHEREPACK coefficient array. | |
| size_t | l () const noexcept |
| Current values of l and m. | |
| size_t | m () const noexcept |
| CoefficientArray | coefficient_array () const noexcept |
| Whether the iterator points to an element of 'a' or 'b', i.e. points to the cos(m*phi) or sin(m*phi) part of a spectral coefficient. | |
| SpherepackIterator & | reset () noexcept |
| Reset iterator back to beginning value. Returns *this. | |
| SpherepackIterator & | set (size_t l_input, size_t m_input, CoefficientArray coefficient_array_input) noexcept |
| Set iterator to specific value of l, m, array. Returns *this. | |
| SpherepackIterator & | set (size_t l_input, int m_input) noexcept |
| Same as 'set' above, but assumes CoefficientArray is 'a' for m>=0 and 'b' for m<0. This is useful when converting between true spherical harmonics (which allow negative values of m) and SPHEREPACK coefficients (which have only positive values of m, but two arrays for sin(m*phi) and cos(m*phi) parts). | |
Iterates over spectral coefficients stored in SPHEREPACK format.
The internal SPHEREPACK ordering is not intuitive, so SpherepackIterator exists for the purpose of iterating over an array containing SPHEREPACK coefficients and determining the (l,m) of each entry in the array.
SPHEREPACK expands \(f(\theta,\phi)\) as
\[ f(\theta,\phi) = \frac{1}{2} \sum_{l=0}^{l_{max}} \bar{P}_l^0 a(0,l) + \sum_{m=1}^{m_{max}} \sum_{l=m}^{l_{max}} \bar{P}_l^m \left( a(m,l) \cos(m \phi) - b(m,l) \sin(m \phi)\right) \]
where \(a(m,l)\) and \(b(m,l)\) are the SPHEREPACK spectral coefficients, and \(\bar{P}_l^m\) are unit-orthonormal associated Legendre polynomials:
\[ \bar{P}_l^m = (-1)^m \sqrt{\frac{(2l+1)(l-m)!}{2(l+m)!}} P_l^m, \]
where \(P_l^m\) are the associated Legendre polynomials as defined for example in Jackson "Classical Electrodynamics".