SphericalHamonics
-
class SphericalHarmonics : public SphericalBase
Public Functions
-
SphericalHarmonics(unsigned L_degree)
Sets up class for spherical harmonics basis based on legendre polynoms and associated legendre polynoms up to degree L. The basis then consists of N = L² +2L basis functions.
- Parameters:
L_degree – - maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound due to numerical stability)
-
SphericalHarmonics(unsigned L_degree, unsigned short spatialDim)
Sets up class for monomial basis on sphere up to degree L. The basis then consists of N = L.
- Parameters:
L_degree – maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound due to numerical stability)
spatialDim – spatial dimensioniality of the simulation
-
virtual Vector ComputeSphericalBasis(double my, double phi, double r = 1.0) override
Computes all N = L² +2L basis functions at point (my, phi)
- Parameters:
my – = cos(theta) - spherical coordinate, -1 <= x <= 1
phi – - spherical coordinate, 0 <= phi <= 2*pi
- Returns:
vector of basis functions at point (my, phi) with size N = L² +2L
-
virtual Vector ComputeSphericalBasisKarthesian(double x, double y, double z) override
Computes all N = L² +2L basis functions at point (x, y, z) on the unit sphere.
- Parameters:
x – coordinates on unit sphere
y – coordinates on unit sphere
z – coordinates on unit sphere
- Returns:
vector of basis functions at point (x,y,z) with size N = L² +2L
-
std::vector<double> GetAssLegendrePoly(const double my)
Computes an entire set of (komplex congjugate) P_l^k and stores it in the vector _assLegendreP.
- Parameters:
my – = cos(theta) - spherical coordinate, -1 <= my <= 1
- Returns:
Associated Legendre Polynomial at my for all l and k
-
virtual unsigned GetBasisSize() final override
Returns length of the basis, i.e. number of elements of the basis.
-
virtual unsigned GetCurrDegreeSize(unsigned currDegree) final override
Return number of basis functions with degree equals to currDegree.
- Parameters:
currDegree – degree of polynomials that are counted
-
virtual unsigned GetGlobalIndexBasis(int l_degree, int k_order) final override
helper function to get the global index for given k and l of the basis function Y_k^l.
- Parameters:
l_degree – - current degree of basis function, 0 <= l <= L
k_order – - current order of basis function, -l <= k <= l
Protected Functions
-
inline unsigned GlobalIdxAssLegendreP(unsigned l_degree, unsigned k_order)
helper function to get the global index for given k and l of the associated legendre polynomial P_k^l.
- Parameters:
l_degree – - current degree of basis function, 0 <= l <= L
k_order – - current order of basis function, 0 <= k <= l
-
void ComputeCoefficients()
computes values of a_param and b_param
-
void ComputeAssLegendrePoly(const double my)
Computes an entire set of (komplex congjugate) P_l^k and stores it in the vector _assLegendreP.
- Parameters:
my – equals cos(theta) - spherical coordinate, -1 <= my <= 1
-
void ComputeYBasis(const double phi)
Computes the spherical harmonics basis function up to degree _LmaxDegree at polar coordinates (theta, psi) and stores the result in _YBasis;.
- Parameters:
phi – spherical coordinate
-
unsigned GetBasisSizeUnprojected()
Returns length of the unprojected basis, i.e. number of elements of the basis in 3D.
Protected Attributes
-
unsigned _LMaxDegree
maximal degree of the spherical harmonics basis (this is “L” in the comments)
-
std::vector<double> _aParam
coefficients for the computations of the basis length of _aParam, _bParam : L + (L*(L+1))/2
-
std::vector<double> _assLegendreP
komplex conjugate of the associated legendre polynomials of degree 0 <= l <= L and order 0 <= k <= l length of _assLegendreP : L + (L*(L+1))/2
-
Vector _YBasis
spherical harmonic basis functions of degree 0 <= l <= L and order -l <= k <= l length : N = L² +2L
-
SphericalHarmonics(unsigned L_degree)