Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/DataVector.hpp"
9 : #include "Utilities/Gsl.hpp"
10 :
11 : namespace ylm {
12 : /// @{
13 : /*!
14 : * \ingroup SpectralGroup
15 : *
16 : * \brief Evaluates a real spherical harmonic of order l at the requested
17 : * angles \f$\theta\f$ and \f$\phi\f$.
18 : *
19 : * The real spherical harmonics are defined as:
20 : * \begin{equation}
21 : * Y_{lm}(\theta, \phi) =
22 : * \begin{cases}
23 : * \sqrt{2} (-1)^m \mathcal{I}[Y_l^{|m|}] & \text{if } m < 0 \\
24 : * Y_l^{0} & \text{if } m = 0 \\
25 : * \sqrt{2} (-1)^m \mathcal{R}[Y_l^{m}] & \text{if } m > 0
26 : * \end{cases}
27 : * \end{equation}
28 : *
29 : * where \f$Y_l^m\f$ are the complex spherical harmonics and \f$\mathcal{R}\f$
30 : * denotes the real part and \f$\mathcal{I}\f$ denotes the imaginary part.
31 : *
32 : * \note This implementation uses the boost implementation of spherical
33 : * harmonics. The calculation is not vectorized and may be slow.
34 : * Stability has not been tested for large l.
35 : */
36 1 : void real_spherical_harmonic(gsl::not_null<DataVector*> spherical_harmonic,
37 : const DataVector& theta, const DataVector& phi,
38 : size_t l, int m);
39 :
40 1 : DataVector real_spherical_harmonic(const DataVector& theta,
41 : const DataVector& phi, size_t l, int m);
42 : /// @}
43 : } // namespace ylm
|