Classes | Typedefs | Enumerations | Functions | Variables
Spectral::Swsh Namespace Reference

Namespace for spin-weighted spherical harmonic utilities. More...

Classes

class  Collocation
 A wrapper class for the spherical harmonic library collocation data. More...
 
struct  LibsharpCollocationPoint
 A container for reporting a single collocation point for libsharp compatible data structures. More...
 
class  TransformJob
 A class which gathers all necessary shared structure among several spin-weighted spherical harmonic transforms and dispatches to libsharp. Each TransformJob represents exactly one spin-weighted transform libsharp execution call, and one inverse transform libsharp execution call. More...
 

Typedefs

template<int Spin, typename TagList >
using get_tags_with_spin = tmpl::remove_duplicates< tmpl::filter< TagList, detail::has_spin< tmpl::_1, std::integral_constant< int, Spin > >> >
 Extract from TagList the subset of those tags that have a static int member spin equal to the template parameter Spin. More...
 
template<int Spin, typename TagList >
using get_prefix_tags_that_wrap_tags_with_spin = tmpl::filter< TagList, tmpl::bind< detail::wrapped_has_spin, tmpl::_1, std::integral_constant< int, Spin > >>
 Extract from TagList the subset of those tags that wrap a tag that has a static int member spin equal to the template parameter Spin. More...
 
template<ComplexRepresentation Representation, typename TagList >
using make_swsh_transform_job_list = typename detail::make_swsh_transform_job_list_impl< -2, Representation, TagList, decltype(std::make_integer_sequence< int, 5 >{})>::type
 Assemble a tmpl::list of TransformJob given a list of tags TagList that need to be transformed. The Representation is the ComplexRepresentation to use for the transformations. More...
 
template<ComplexRepresentation Representation, typename DerivativeTagList >
using make_swsh_transform_job_list_from_derivative_tags = typename detail::make_swsh_transform_job_list_impl< -2, Representation, tmpl::transform< DerivativeTagList, tmpl::bind< db::remove_tag_prefix, tmpl::_1 > >, decltype(std::make_integer_sequence< int, 5 >{})>::type
 Assemble a tmpl::list of TransformJobs given a list of Derivative<Tag, Derivative> that need to be computed. The TransformJobs constructed by this type alias correspond to the Tags in the list. More...
 

Enumerations

enum  ComplexRepresentation { Interleaved, RealsThenImags }
 A set of labels for the possible representations of complex numbers for the ComplexDataView and the computations performed in the spin-weighted spherical harmonic transform library. More...
 

Functions

constexpr size_t number_of_swsh_coefficients (const size_t l_max) noexcept
 Convenience function for determining the number of spin-weighted spherical harmonics coefficients that are stored for a given l_max
 
constexpr double sharp_swsh_sign_change (const int from_spin_weight, const int to_spin_weight, const bool real) noexcept
 Compute the relative sign change necessary to convert between the libsharp basis for spin weight from_spin_weight to the basis for spin weight to_spin_weight, for the real component coefficients if real is true, otherwise for the imaginary component coefficients. The sign change for a given coefficient is equivalent to the product of sharp_swsh_sign(from_spin, m, real) * sharp_swsh_sign(to_spin, m, real). Due to the form of the signs, it does not end up depending on m (the m's in the power of \(-1\)'s cancel). For full details of the libsharp sign conventions, see the documentation for TransformJob. More...
 
constexpr double sharp_swsh_sign (const int spin_weight, const int m, const bool real) noexcept
 Compute the sign change between the libsharp convention and the set of spin-weighted spherical harmonics given by the relation to the Wigner rotation matrices. More...
 
template<ComplexRepresentation Representation>
const Collocation< Representation > & precomputed_collocation (size_t l_max) noexcept
 precomputation function for those collocation grids that are requested More...
 
constexpr size_t number_of_swsh_collocation_points (const size_t l_max) noexcept
 Convenience function for determining the number of spin-weighted spherical harmonic collocation values that are stored for a given l_max for a libsharp-compatible set of collocation points.
 

Variables

constexpr size_t collocation_maximum_l_max = 200
 

Detailed Description

Namespace for spin-weighted spherical harmonic utilities.

Enumeration Type Documentation

◆ ComplexRepresentation

A set of labels for the possible representations of complex numbers for the ComplexDataView and the computations performed in the spin-weighted spherical harmonic transform library.

Details

The representation describes one of two behaviors:

  • Interleaved: The vectors of complex numbers will be represented by alternating doubles in memory. This causes both the real and imaginary part at a given gridpoint to be near one another, but successive real values farther. This is the native representation of complex data in the C++ standard, and is the representation needed for Blaze math operations. Therefore, using this representation type in libsharp computations will cause operations which access only the real or imaginary parts individually to trace over larger memory regions. However, this representation will give rise to fewer copying operations to perform the libsharp operations.
  • RealsThenImags: The vectors of complex numbers will primarily be represented by a pair of vectors of doubles, one for the real values and one for the imaginary values (the full computation cannot be performed exclusively in this representation, as it must return to a vector of std::complex<double> for Blaze math operations). This causes the successive real values for different gridpoints to be closer in memory, but the real and imaginary parts for a given gridpoint to be farther in memory. This is not the native representation for complex data in C++, so the data must be transformed between operations which use Blaze and the transform operations which use RealsThenImags. Therefore, using this representation in libsharp computations will cause operations which act on real or imaginary parts individually to have better memory locality (so likely improved cache performance, but such statements are highly hardware-dependent). However, this representation will give rise to more copying operations to perform the libsharp operations.
Note
The pair of representations is provided as a means to 'turn a dial' in optimizations. It is unclear which of these representations will be preferable, and it may well be the case that different representations are better for different calculation types or different hardware. Therefore, when optimizing code which uses libsharp, it is encouraged to profile the cost of each representation for a computation and choose the one which performs best.

Function Documentation

◆ precomputed_collocation()

template<ComplexRepresentation Representation>
const Collocation< Representation > & Spectral::Swsh::precomputed_collocation ( size_t  l_max)
noexcept

precomputation function for those collocation grids that are requested

Details

keeps a compile-time structure which acts as a thread-safe lookup table for all l_max values that have been requested so far during execution, so that the libsharp generation need not be re-run. If it has been generated, it's returned by reference. Otherwise, the new grid is generated and put in the lookup table before it is returned by reference.