Commit 7345ce36 authored by Steffen Schotthöfer's avatar Steffen Schotthöfer
Browse files

added headers for monomial basis and abstract base class


Former-commit-id: 742a5caf
parent 45a834c7
/*!
* @file sphericalbasisbase.h
* @brief Base Class to handle basis classes on the unit sphere
* @author S. Schotthöfer
*
*/
#ifndef SPHERICALBASISBASE_H
#define SPHERICALBASISBASE_H
#include "common/typedef.h"
class Config;
class SphericalBasisBase
{
public:
SphericalBasisBase() {}
~SphericalBasisBase() {}
/*! @brief: Create a set of basis functions on the unit sphere defined in settings
* @param: Pointer to the config file
* @returns: Pointer to the createt basis class */
static SphericalBasisBase* Create( Config* settings );
/*! @brief : Computes all N basis functions at point (my, phi)
* @param : my = cos(theta) - spherical coordinate, -1 <= x <= 1
* @param : phi - spherical coordinate, 0 <= phi <= 2*pi
* @return : vector of basis functions at point (my, phi) with size N
*/
virtual Vector ComputeSphericalBasis( double my, double phi ) = 0;
/*! @brief : Computes all basis functions at point (x, y, z) on the unit sphere
* @param : x,y,z = coordinates on unit sphere
* @return : vector of basis functions at point (x,y,z) with size N
*/
virtual Vector ComputeSphericalBasis( double x, double y, double z ) = 0;
};
#endif // SPHERICALBASISBASE_H
/*!
* @file sphericalmonomials.h
* @brief Class for efficient computation of a spherical monomial basis
* @author S. Schotthöfer
*/
#ifndef SPHERICALMONOMIALS_H
#define SPHERICALMONOMIALS_H
#include "common/typedef.h"
#include "toolboxes/sphericalbasisbase.h"
#include <vector>
class SphericalMonomials : public SphericalBasisBase
{
public:
/*! @brief : Sets up class for monomial basis on sphere up to degree L.
* The basis then consists of N = L.
* @param : L_degree - maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound
* due to numerical stability)
* */
SphericalMonomials( unsigned L_degree );
/*! @brief : Computes all N = L² +2L basis functions at point (my, phi)
* @param : my = cos(theta) - spherical coordinate, -1 <= x <= 1
* @param : phi - spherical coordinate, 0 <= phi <= 2*pi
* @return : vector of basis functions at point (my, phi) with size N = L² +2L
*/
Vector ComputeSphericalBasis( double my, double phi ) override;
/*! @brief : Computes all N = L² +2L basis functions at point (x, y, z) on the unit sphere
* @param : x,y,z = coordinates on unit sphere
* @return : vector of basis functions at point (x,y,z) with size N = L² +2L
*/
Vector ComputeSphericalBasis( double x, double y, double z ) override;
private:
/*! @brief: maximal degree of the spherical monomial basis (this is "L" in the comments)*/
unsigned _LMaxDegree;
/*! @brief: Spatial dimension of the unit sphere (1,2,3) */
unsigned _spatialDim;
/*! @brief: spherical monomial basis function vector of
* degree 0 <= l <= L
* length : COmputed with ComputeBasisSize
*/
Vector _YBasis;
/*! @brief: Computes the amount of lin. independent monomials of degree degree and
* spatial dimension dim. len of a single oder: (degree + _spatialDim -1) over (degree)
* @return: lenght of a single dimension */
unsigned ComputeDimensionSize( unsigned degree );
/*! @brief: Computes the length of the basis vector for a given max degree and
* spatial dimension dim. len of a single oder: (degree + _spatialDim -1) over (degree)
* @return: lenght of whole basis */
unsigned ComputeBasisSize( unsigned degree );
/*! @brief: Function to compute factorial of n (n!) in recursive manner */
unsigned Factorial( unsigned n );
/*! @brief: Function to compute first component of spherical unit vector
* Omega_x = sqrt(1-my*my)*cos(phi)
* @return: first component of spherical unit vector */
double Omega_x( double my, double phi );
/*! @brief: Function to compute first component of spherical unit vector
* Omega_x = sqrt(1-my*my)*sin(phi)
* @return: first component of spherical unit vector */
double Omega_y( double my, double phi );
/*! @brief: Function to compute first component of spherical unit vector
* Omega_z = my
* @return: first component of spherical unit vector */
double Omega_z( double my );
/*! @brief: Helper Function to compute basis^exponent. */
double Power( double basis, unsigned exponent );
};
#endif // SPHERICALMONOMIALS_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment