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

The arbitrary quadrature parent class. More...

#include "src/Quadrature.h"

Public Member Functions

 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 DoubleVecgetPhis () const
 Returns a pointer to the Quadrature's vector of azimuthal angles $ \phi $. More...
 
const DoubleVecgetAzimWeights () 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 DoubleVecgetAzimSpacings () 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...
 
virtual void setNumPolarAngles (size_t num_polar)
 Set the number of polar 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...
 
virtual void initialize ()
 Initialize the polar quadrature azimuthal angles. More...
 
virtual void precomputeWeights (bool solve_3D)
 This private routine computes the product of the sine thetas and weights for each angle in the polar quadrature. More...
 
std::string toString () const
 Converts this Quadrature to a character vector of its attributes. More...
 

Protected Member Functions

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

template<typename T >
static void resize2D (std::vector< std::vector< T > > &vec, size_t dim1, size_t dim2)
 

Protected Attributes

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
 

Friends

std::ostream & operator<< (std::ostream &os, const Quadrature &quad)
 Prints to the provided output stream. More...
 

Detailed Description

The arbitrary quadrature parent class.

Member Function Documentation

◆ getAzimSpacing()

double Quadrature::getAzimSpacing ( size_t  azim) const

Returns the adjusted azimuthal spacing at the requested azimuthal angle index.

The azimuthal spacing depends on the azimuthal angle. This function returns the azimuthal spacing used at the desired azimuthal angle index.

Parameters
azimthe requested azimuthal angle index
Returns
the requested azimuthal spacing

◆ getAzimSpacings()

const DoubleVec & Quadrature::getAzimSpacings ( ) const

Returns an vector of adjusted azimuthal spacings.

An vector of azimuthal spacings after adjustment is returned, indexed by azimuthal angle

Returns
the vector of azimuthal spacings

◆ getAzimWeight()

double Quadrature::getAzimWeight ( size_t  azim) const

Returns the azimuthal angle weight value for a particular azimuthal angle.

Parameters
azimindex of the azimuthal angle of interest
Returns
the weight for an azimuthal angle

◆ getAzimWeights()

const DoubleVec & Quadrature::getAzimWeights ( ) const

Returns a pointer to the Quadrature's vector of azimuthal weights.

Returns
a pointer to the azimuthal weights vector

◆ getNumAzimAngles()

size_t Quadrature::getNumAzimAngles ( ) const

Returns the number of azimuthal angles.

Returns
the number of azimuthal angles

◆ getNumPolarAngles()

size_t Quadrature::getNumPolarAngles ( ) const

Returns the number of polar angles.

Returns
the number of polar angles

◆ getPhi()

double Quadrature::getPhi ( size_t  azim) const

Returns the azimuthal angle value in radians.

Parameters
azimindex of the azimthal angle of interest
Returns
the value of the azimuthal angle

◆ getPhis()

const DoubleVec & Quadrature::getPhis ( ) const

Returns a pointer to the Quadrature's vector of azimuthal angles $ \phi $.

Returns
a pointer to the vector of $ \phi $

◆ getPolarSpacing()

double Quadrature::getPolarSpacing ( size_t  azim,
size_t  polar 
) const

Returns the adjusted polar spacing at the requested azimuthal angle index and polar angle index.

The polar spacing depends on the azimuthal angle and the polar angle. This function returns the azimuthal spacing used at the desired azimuthal angle and polar angle indexes.

Parameters
azimthe requested azimuthal angle index
polarthe requested polar angle index
Returns
the requested polar spacing

◆ getPolarSpacings()

const std::vector< DoubleVec > & Quadrature::getPolarSpacings ( ) const

Returns a 2D vector of adjusted polar spacings.

An vector of polar spacings after adjustment is returned, indexed first by azimuthal angle and then by polar angle

Returns
the 2D vector of polar spacings

◆ getPolarWeight()

double Quadrature::getPolarWeight ( size_t  azim,
size_t  polar 
) const

Returns the polar weight for a particular azimuthal and polar angle.

Parameters
azimindex of the azimthal angle of interest
polarindex of the polar angle of interest
Returns
the value of the polar weight for this azimuthal and polar angle

◆ getPolarWeights()

const std::vector< DoubleVec > & Quadrature::getPolarWeights ( ) const

Returns a pointer to the Quadrature's vector of polar weights.

Returns
a pointer to the polar weights vector

◆ getQuadratureType()

QuadratureType Quadrature::getQuadratureType ( ) const

Returns the type of Quadrature created.

Returns
The quadrature type

◆ getSinTheta()

double Quadrature::getSinTheta ( size_t  azim,
size_t  polar 
) const

Returns the $ sin(\theta)$ value for a particular polar angle.

Parameters
azimindex of the azimthal angle of interest
polarindex of the polar angle of interest
Returns
the value of $ \sin(\theta) $ for this azimuthal and polar angle

◆ getSinThetaInline()

double Quadrature::getSinThetaInline ( size_t  azim,
size_t  polar 
) const
inline

Returns the $ sin(\theta)$ value for a particular polar angle.

Parameters
azimindex of the azimthal angle of interest
polarindex of the polar angle of interest
Returns
the value of $ \sin(\theta) $ for this azimuthal and polar angle

azim must be between 0 and _num_azim / 2

◆ getSinThetas()

const std::vector< DoubleVec > & Quadrature::getSinThetas ( ) const

Returns a pointer to the Quadrature's vector of polar angle sines $ sin\theta_{p} $.

Returns
a reference to the vector of $ sin\theta_{p} $

◆ getTheta()

double Quadrature::getTheta ( size_t  azim,
size_t  polar 
) const

Returns the polar angle in radians for a given azimuthal and polar angle index.

Parameters
azimindex of the azimthal angle of interest
polarindex of the polar angle of interest
Returns
the value of the polar angle for this azimuthal and polar angle index

◆ getThetas()

const std::vector< DoubleVec > & Quadrature::getThetas ( ) const

Returns a reference to the Quadrature's vector of polar angles $ \theta_{p} $.

Returns
a reference to the vector of $ \theta_{p} $

◆ getWeight()

double Quadrature::getWeight ( size_t  azim,
size_t  polar 
) const

Returns the total weight for Tracks with the given azimuthal and polar indexes.

Angular weights are multiplied by Track spacings

Parameters
azimindex of the azimuthal angle of interest
polarindex of the polar angle of interest
Returns
the total weight of each Track with the given indexes

◆ getWeightInline()

double Quadrature::getWeightInline ( size_t  azim,
size_t  polar 
) const
inline

Returns the total weight for Tracks with the given azimuthal and polar indexes without error checking and inlined.

Angular weights are multiplied by Track spacings

Parameters
azimindex of the azimuthal angle of interest
polarindex of the polar angle of interest
Returns
the total weight of each Track with the given indexes

◆ initialize()

void Quadrature::initialize ( )
virtual

Initialize the polar quadrature azimuthal angles.

The parent class routine simply checks that number of polar and azimuthal angles have been set by the user and generates the azimuthal angles if not already generated.

Reimplemented in EqualAnglePolarQuad, EqualWeightPolarQuad, GLPolarQuad, LeonardPolarQuad, and TYPolarQuad.

◆ precomputeWeights()

void Quadrature::precomputeWeights ( bool  solve_3D)
virtual

This private routine computes the product of the sine thetas and weights for each angle in the polar quadrature.

Note that this routine must be called after populating the sine thetas and weights vectors.

Reimplemented in EqualAnglePolarQuad, EqualWeightPolarQuad, GLPolarQuad, LeonardPolarQuad, and TYPolarQuad.

◆ setAzimSpacing()

void Quadrature::setAzimSpacing ( double  spacing,
size_t  azim 
)

Sets the azimuthal spacing for the given index.

Parameters
spacingthe spacing (cm) in the azimuthal direction to be set
azimthe azimuthal index

◆ setAzimWeight()

void Quadrature::setAzimWeight ( double  weight,
size_t  azim 
)

Sets the azimuthal weight for the given index.

Parameters
weightthe weight of the azimuthal angle
azimthe azimuthal index

◆ setNumAzimAngles()

void Quadrature::setNumAzimAngles ( size_t  num_azim)
virtual

Set the number of azimuthal angles to initialize.

Parameters
num_azimthe number of azimuthal angles

◆ setNumPolarAngles()

void Quadrature::setNumPolarAngles ( size_t  num_polar)
virtual

Set the number of polar angles to initialize.

Parameters
num_polarthe number of polar angles

Reimplemented in EqualAnglePolarQuad, EqualWeightPolarQuad, GLPolarQuad, LeonardPolarQuad, and TYPolarQuad.

◆ setPhi()

void Quadrature::setPhi ( double  phi,
size_t  azim 
)

Sets the azimuthal angle for the given index.

Parameters
phithe value in radians of the azimuthal angle to be set
azimthe azimuthal index

◆ setPolarSpacing()

void Quadrature::setPolarSpacing ( double  spacing,
size_t  azim,
size_t  polar 
)

Sets the polar spacing for the given indexes.

Parameters
spacingthe spacing in the polar direction to be set
azimthe azimuthal index corresponding to the angle
polarthe polar index corresponding to the angle

◆ setPolarWeight()

void Quadrature::setPolarWeight ( double  weight,
size_t  azim,
size_t  polar 
)

Sets the polar weight for the given indexes.

Parameters
weightthe weight of the polar angle
azimthe azimuthal index corresponding to the angle
polarthe polar index corresponding to the angle

◆ setPolarWeights()

void Quadrature::setPolarWeights ( const DoubleVec weights)

Set the Quadrature's vector of polar weights.

This method is a helper function to allow OpenMOC users to assign the Quadrature's polar weights in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 vector the length of the number of azimuthal times polar angles) as input to this function. This function then fills the Quadrature's polar weights with the given values. An example of how this function might be called in Python is as follows:

polar_weights = numpy.array([0.1, 0.2, 0.05, ... ])
quad = openmoc.Quadrature()
quad.setNumAzimAngles(num_azim)
quad.setNumPolarAngles(len(polar_weights) / num_azim)
quad.setPolarWeights(polar_weights)
Parameters
weightsThe polar weights

◆ setTheta()

void Quadrature::setTheta ( double  theta,
size_t  azim,
size_t  polar 
)

Sets the polar angle for the given indexes.

Parameters
thetathe value in radians of the polar angle to be set
azimthe azimuthal index of the angle of interest
polarthe polar index of the angle of interest

◆ setThetas()

void Quadrature::setThetas ( const DoubleVec thetas)

Sets the Quadrature's vector of polar angles.

This method is a helper function to allow OpenMOC users to assign the Quadrature's polar angles in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 vector the length of the number of azimuthal times polar angles) as input to this function. This function then fills the Quadrature's polar angles with the given values. An example of how this function might be called in Python is as follows:

thetas = numpy.array([pi/6, pi/4, pi/3, ... ])
quad = openmoc.Quadrature()
quad.setNumAzimAngles(num_azim)
quad.setNumPolarAngles(len(thetas) / num_azim)
quad.setThetas(thetas)
Parameters
thetasthe vector of polar angle for each azimuthal/polar angle combination

◆ toString()

std::string Quadrature::toString ( ) const

Converts this Quadrature to a character vector of its attributes.

The character vector includes the number of polar angles, the the values of the sine and weight of each polar angle, and the product of the sine and weight of each polar angle.

Returns
a character vector of the Quadrature's attributes

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Quadrature quad 
)
friend

Prints to the provided output stream.

Allows printing the Quadrature using <<

Parameters
osthe provided stream to write to
quadthe quadrature object which is printed
Returns
the provided stream

Member Data Documentation

◆ _azim_spacings

DoubleVec Quadrature::_azim_spacings
protected

The actual track azimuthal spacing (cm) by azimuthal angle

◆ _azim_weights

DoubleVec Quadrature::_azim_weights
protected

An array of the quadrature azimuthal weights

◆ _num_azim

size_t Quadrature::_num_azim
protected

The number of azimuthal angles in (0, 2*PI)

◆ _num_polar

size_t Quadrature::_num_polar
protected

The number of polar angles in (0, PI)

◆ _phis

DoubleVec Quadrature::_phis
protected

An array of the quadrature azimuthal angles

◆ _polar_spacings

std::vector<DoubleVec> Quadrature::_polar_spacings
protected

The actual track polar spacing (cm) by (azim, polar)

◆ _polar_weights

std::vector<DoubleVec> Quadrature::_polar_weights
protected

An array of the quadrature polar weights

◆ _quad_type

QuadratureType Quadrature::_quad_type
protected

The quadrature type being used

◆ _sin_thetas

std::vector<DoubleVec> Quadrature::_sin_thetas
protected

An array of the sines of quadrature polar angles

◆ _thetas

std::vector<DoubleVec> Quadrature::_thetas
protected

An array of the quadrature polar angles

◆ _total_weights

std::vector<DoubleVec> Quadrature::_total_weights
protected

An array of the total weights for each azimuthal/polar angle pair


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