SpECTRE
v2025.03.17
|
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 |
size_t | m_max () const |
size_t | n_th () const |
size_t | n_ph () const |
size_t | stride () const |
size_t | spherepack_array_size () const |
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++ () |
operator bool () const | |
size_t | operator() () const |
Current index into a SPHEREPACK coefficient array. | |
std::optional< size_t > | compact_index (const size_t offset) const |
Given an offset into a SPHEREPACK coefficient array, return the compact index corresponding to that offset. More... | |
size_t | current_compact_index () const |
Returns the current compact index that SpherepackIterator uses internally. This does not index a SPHEREPACK coefficient array. More... | |
size_t | l () const |
Current values of l and m. | |
size_t | m () const |
CoefficientArray | coefficient_array () const |
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 () |
Reset iterator back to beginning value. Returns *this. | |
SpherepackIterator & | set (size_t l_input, size_t m_input, CoefficientArray coefficient_array_input) |
Set iterator to specific value of l, m, array. Returns *this. | |
SpherepackIterator & | set (size_t l_input, int m_input) |
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). | |
SpherepackIterator & | set (size_t compact_index) |
Set iterator to a specific compact index. Returns *this. | |
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
where
where
|
inline |
Given an offset into a SPHEREPACK coefficient array, return the compact index corresponding to that offset.
Essentially the inverse of operator(). If the offset points to an element that SPHEREPACK doesn't actually use (i.e. no compact index can reach the given offset), then a std::nullopt is returned.
|
inline |
Returns the current compact index that SpherepackIterator uses internally. This does not index a SPHEREPACK coefficient array.