Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "NumericalAlgorithms/TensorYlm/TensorYlm.hpp"
7 :
8 : #include <array>
9 : #include <complex>
10 : #include <cstddef>
11 : #include <cstdint>
12 :
13 : #include "Utilities/Array.hpp"
14 :
15 0 : namespace ylm::TensorYlm::helpers {
16 :
17 : /// Defines the three Cartesian and three spherical basis vectors.
18 0 : enum class BasisVector : uint8_t { x, y, z, l, m, mbar };
19 :
20 : /// Returns a Cartesian BasisVector for every index.
21 : template <size_t Rank>
22 1 : std::array<BasisVector, Rank> to_cart_basis_vector(
23 : const cpp20::array<size_t, Rank>& indices);
24 :
25 : /// Returns the m value associated with a Cartesian basis vector.
26 1 : int bv_to_m(BasisVector basis_vector, int i);
27 :
28 : /// Returns the prefactor k associated with a Cartesian basis vector.
29 1 : std::complex<double> bv_to_k(BasisVector basis_vector, int i);
30 :
31 : /// Returns a spherical BasisVector for every index.
32 : template <size_t Rank>
33 1 : std::array<BasisVector, Rank> to_sphere_basis_vector(
34 : const cpp20::array<size_t, Rank>& indices);
35 :
36 : /// Returns minus the spinweight of a tetrad basis vector
37 1 : int bv_to_s(BasisVector basis_vector);
38 :
39 : /// Returns the spin weight of a tensor structure component in the spherical
40 : /// basis.
41 : template <typename TensorStructure>
42 1 : int component_spin_weight(size_t component);
43 :
44 : /// Computes the symmetry factor S that appears in various equations.
45 : template <typename Symm>
46 1 : double get_symm_factor(size_t src_multiplicity, size_t lbar);
47 :
48 : /// Computes the (-1)^m factor that is used depending on whether the
49 : /// coefficient normalization is Spherepack.
50 : template <typename T>
51 1 : constexpr T sign_m(const int m,
52 : const CoefficientNormalization coefficient_normalization) {
53 : return coefficient_normalization == CoefficientNormalization::Spherepack and
54 : m % 2 != 0
55 : ? static_cast<T>(-1)
56 : : static_cast<T>(1);
57 : }
58 :
59 : } // namespace ylm::TensorYlm::helpers
|