An open source method of characteristics neutron transport code.
GLPolarQuad Class Reference

Gauss-Legendre's polar quadrature. More...

#include "src/Quadrature.h"

Public Member Functions

 GLPolarQuad ()
 Dummy constructor calls the parent constructor.
 
void setNumPolarAngles (size_t num_polar)
 Set the number of polar angles to initialize. More...
 
void useCorrectedWeights (bool use_corrected_weights)
 Indicates whether to correct weights based on altered polar angles. More...
 
void initialize ()
 Routine to initialize the polar quadrature. More...
 
void precomputeWeights (bool solve_3D)
 Calculates total weights for every azimuthal/polar combination based on the Gauss-Legendre polar quadrature. More...
 
DoubleVec getCorrectedWeights (size_t azim) const
 Calculates the weights to be used in numerical integration. More...
 
- Public Member Functions inherited from Quadrature
 Quadrature ()
 Dummy constructor sets the default number of angles to zero.
 
size_t getNumPolarAngles () const
 Returns the number of polar angles. More...
 
size_t getNumAzimAngles () const
 Returns the number of azimuthal angles. More...
 
double getSinTheta (size_t azim, size_t polar) const
 Returns the $ sin(\theta)$ value for a particular polar angle. More...
 
double getSinThetaInline (size_t azim, size_t polar) const
 Returns the $ sin(\theta)$ value for a particular polar angle. More...
 
double getTheta (size_t azim, size_t polar) const
 Returns the polar angle in radians for a given azimuthal and polar angle index. More...
 
double getPhi (size_t azim) const
 Returns the azimuthal angle value in radians. More...
 
double getAzimWeight (size_t azim) const
 Returns the azimuthal angle weight value for a particular azimuthal angle. More...
 
double getPolarWeight (size_t azim, size_t polar) const
 Returns the polar weight for a particular azimuthal and polar angle. More...
 
double getWeight (size_t azim, size_t polar) const
 Returns the total weight for Tracks with the given azimuthal and polar indexes. More...
 
double getWeightInline (size_t azim, size_t polar) const
 Returns the total weight for Tracks with the given azimuthal and polar indexes without error checking and inlined. More...
 
const std::vector< DoubleVec > & getSinThetas () const
 Returns a pointer to the Quadrature's vector of polar angle sines $ sin\theta_{p} $. More...
 
const std::vector< DoubleVec > & getThetas () const
 Returns a reference to the Quadrature's vector of polar angles $ \theta_{p} $. More...
 
const DoubleVec & getPhis () const
 Returns a pointer to the Quadrature's vector of azimuthal angles $ \phi $. More...
 
const DoubleVec & getAzimWeights () const
 Returns a pointer to the Quadrature's vector of azimuthal weights. More...
 
const std::vector< DoubleVec > & getPolarWeights () const
 Returns a pointer to the Quadrature's vector of polar weights. More...
 
QuadratureType getQuadratureType () const
 Returns the type of Quadrature created. More...
 
const DoubleVec & getAzimSpacings () const
 Returns an vector of adjusted azimuthal spacings. More...
 
double getAzimSpacing (size_t azim) const
 Returns the adjusted azimuthal spacing at the requested azimuthal angle index. More...
 
const std::vector< DoubleVec > & getPolarSpacings () const
 Returns a 2D vector of adjusted polar spacings. More...
 
double getPolarSpacing (size_t azim, size_t polar) const
 Returns the adjusted polar spacing at the requested azimuthal angle index and polar angle index. More...
 
virtual void setNumAzimAngles (size_t num_azim)
 Set the number of azimuthal angles to initialize. More...
 
void setThetas (const DoubleVec &thetas)
 Sets the Quadrature's vector of polar angles. More...
 
void setPolarWeights (const DoubleVec &weights)
 Set the Quadrature's vector of polar weights. More...
 
void setTheta (double theta, size_t azim, size_t polar)
 Sets the polar angle for the given indexes. More...
 
void setPhi (double phi, size_t azim)
 Sets the azimuthal angle for the given index. More...
 
void setAzimSpacing (double spacing, size_t azim)
 Sets the azimuthal spacing for the given index. More...
 
void setPolarSpacing (double spacing, size_t azim, size_t polar)
 Sets the polar spacing for the given indexes. More...
 
void setAzimWeight (double weight, size_t azim)
 Sets the azimuthal weight for the given index. More...
 
void setPolarWeight (double weight, size_t azim, size_t polar)
 Sets the polar weight for the given indexes. More...
 
std::string toString () const
 Converts this Quadrature to a character vector of its attributes. More...
 

Static Public Member Functions

static double legendrePolynomial (size_t n, double x)
 the Legendre polynomial of degree n evaluated at x More...
 
static double logDerivLegendre (size_t n, double x)
 The first logarithmic derivative of a Legendre polynomial. More...
 
static double secondLogDerivLegendre (size_t n, double x)
 The second logarithmic derivative of a Legendre polynomial. More...
 
static double getSingleWeight (double root, size_t n)
 Calculates the weights to be used in Gauss-Legendre Quadrature. More...
 
static DoubleVec getLegendreRoots (size_t n)
 Finds the roots of Legendre polynomial of order n. More...
 
static DoubleVec getGLWeights (const DoubleVec &roots, size_t n)
 Calculates the weights to be used in Gauss-Legendre Quadrature. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Quadrature
template<typename T >
void setPolarValues (std::vector< std::vector< T > > &vec, size_t azim_index, size_t polar_index, T value)
 
template<typename T >
void setAzimuthalValues (std::vector< T > &vec, size_t azim_index, T value)
 
- Static Protected Member Functions inherited from Quadrature
template<typename T >
static void resize2D (std::vector< std::vector< T > > &vec, size_t dim1, size_t dim2)
 
- Protected Attributes inherited from Quadrature
QuadratureType _quad_type
 
size_t _num_azim
 
size_t _num_polar
 
std::vector< DoubleVec > _sin_thetas
 
std::vector< DoubleVec > _thetas
 
DoubleVec _phis
 
DoubleVec _azim_spacings
 
DoubleVec _azim_weights
 
std::vector< DoubleVec > _polar_spacings
 
std::vector< DoubleVec > _polar_weights
 
std::vector< DoubleVec > _total_weights
 

Detailed Description

Gauss-Legendre's polar quadrature.

Member Function Documentation

◆ getCorrectedWeights()

DoubleVec GLPolarQuad::getCorrectedWeights ( size_t  azim) const

Calculates the weights to be used in numerical integration.

assumes the function will be integrated over (-1, 1)

azim the azimuthal angle index

Returns
the vector of weights

◆ getGLWeights()

DoubleVec GLPolarQuad::getGLWeights ( const DoubleVec &  roots,
size_t  n 
)
static

Calculates the weights to be used in Gauss-Legendre Quadrature.

Parameters
rootsa vector containing the roots of the Legendre polynomial
nthe order of the Legendre Polynomial
Returns
a vector of weights matched by index to the vector of roots

◆ getLegendreRoots()

DoubleVec GLPolarQuad::getLegendreRoots ( size_t  n)
static

Finds the roots of Legendre polynomial of order n.

Guesses for positive roots are set at logarithmic intervals. Positive roots are found simultaneously using an Alberth-Householder-n method. Each guess is successively nudged towards a true root. Only the positive roots are calculated

Parameters
nthe order of the polynomial
Returns
a list of the roots of the polynomial

◆ getSingleWeight()

double GLPolarQuad::getSingleWeight ( double  root,
size_t  n 
)
static

Calculates the weights to be used in Gauss-Legendre Quadrature.

Parameters
rootthe root of the Legendre polynomial
nthe order of the Legendre Polynomial
Returns
a vector of weights matched by index to the vector of roots

◆ initialize()

void GLPolarQuad::initialize ( )
virtual

Routine to initialize the polar quadrature.

This routine uses the tabulated values for the Gauss-Legendre polar angle quadrature, including the sine thetas and weights.

Reimplemented from Quadrature.

◆ legendrePolynomial()

double GLPolarQuad::legendrePolynomial ( size_t  n,
double  x 
)
static

the Legendre polynomial of degree n evaluated at x

Parameters
nan integer >=0: the order of the polynomial
xin (-1,1), the point at which to evaluate the polynomial
Returns
the value of the Legendre polynomial of degree n at x

◆ logDerivLegendre()

double GLPolarQuad::logDerivLegendre ( size_t  n,
double  x 
)
static

The first logarithmic derivative of a Legendre polynomial.

Parameters
nthe order of the polynomial
xpoint at which to evaluate the logarithmic derivative
Returns
the value of the logarithmic derivative at x

◆ precomputeWeights()

void GLPolarQuad::precomputeWeights ( bool  solve_3D)
virtual

Calculates total weights for every azimuthal/polar combination based on the Gauss-Legendre polar quadrature.

Parameters
solve_3DBoolean indicating whether this is a 3D quadrature

Reimplemented from Quadrature.

◆ secondLogDerivLegendre()

double GLPolarQuad::secondLogDerivLegendre ( size_t  n,
double  x 
)
static

The second logarithmic derivative of a Legendre polynomial.

Parameters
nthe order of the polynomial
xpoint at which to evaluate the logarithmic derivative
Returns
the value of the logarithmic derivative at x

◆ setNumPolarAngles()

void GLPolarQuad::setNumPolarAngles ( size_t  num_polar)
virtual

Set the number of polar angles to initialize.

Parameters
num_polarthe number of polar angles (maximum 20)

Reimplemented from Quadrature.

◆ useCorrectedWeights()

void GLPolarQuad::useCorrectedWeights ( bool  use_corrected_weights)

Indicates whether to correct weights based on altered polar angles.

Parameters
use_corrected_weightsWhether to alter the weights

The documentation for this class was generated from the following files: