45 typedef DoubleVec::const_iterator DVCI;
49 std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
50 if (vec.size() == 0) {
56 using CI =
typename std::vector<T>::const_iterator;
59 for (CI cit = vec.begin(); cit != vec.end(); ++cit) {
60 if (cit != vec.begin()) {
115 template <
typename T>
116 void setPolarValues(std::vector< std::vector<T> >& vec,
size_t azim_index,
117 size_t polar_index, T value) {
118 size_t c_azim_index =
_num_azim/2 - azim_index - 1;
119 size_t s_polar_index =
_num_polar - polar_index - 1;
120 vec.at(azim_index).at(polar_index) = value;
121 vec.at(c_azim_index).at(polar_index) = value;
122 vec.at(azim_index).at(s_polar_index) = value;
123 vec.at(c_azim_index).at(s_polar_index) = value;
126 template <
typename T>
127 void setAzimuthalValues(std::vector<T>& vec,
size_t azim_index, T value) {
128 vec.at(azim_index) = value;
129 vec.at(
_num_azim/2 - azim_index - 1) = value;
132 template <
typename T>
133 static void resize2D(std::vector< std::vector<T> >& vec,
size_t dim1,
136 for (
size_t i = 0; i < dim1; ++i)
138 vec.at(i).resize(dim2);
148 double getSinTheta(
size_t azim,
size_t polar)
const;
150 double getTheta(
size_t azim,
size_t polar)
const;
151 double getPhi(
size_t azim)
const;
154 double getWeight(
size_t azim,
size_t polar)
const;
157 const std::vector<DoubleVec>&
getThetas()
const;
171 void setTheta(
double theta,
size_t azim,
size_t polar);
172 void setPhi(
double phi,
size_t azim);
230 std::vector <double> _roots;
233 std::vector <double> _adjusted_roots;
236 bool _correct_weights;
void setTheta(double theta, size_t azim, size_t polar)
Sets the polar angle for the given indexes.
Definition: Quadrature.cpp:492
double getSinTheta(size_t azim, size_t polar) const
Returns the value for a particular polar angle.
Definition: Quadrature.cpp:41
double getPolarSpacing(size_t azim, size_t polar) const
Returns the adjusted polar spacing at the requested azimuthal angle index and polar angle index...
Definition: Quadrature.cpp:357
void precomputeWeights(bool solve_3D)
Calculates total weights for every azimuthal/polar combination based on the Leonard polar quadrature...
Definition: Quadrature.cpp:954
void setPolarWeight(double weight, size_t azim, size_t polar)
Sets the polar weight for the given indexes.
Definition: Quadrature.cpp:615
const DoubleVec & getAzimSpacings() const
Returns an vector of adjusted azimuthal spacings.
Definition: Quadrature.cpp:316
std::vector< DoubleVec > _sin_thetas
Definition: Quadrature.h:90
DoubleVec _azim_spacings
Definition: Quadrature.h:99
double getSinThetaInline(size_t azim, size_t polar) const
Returns the value for a particular polar angle.
Definition: Quadrature.h:296
std::vector< double > DoubleVec
Definition: Quadrature.h:44
Leonard's polar quadrature.
Definition: Quadrature.h:208
virtual void precomputeWeights(bool solve_3D)
This private routine computes the product of the sine thetas and weights for each angle in the polar ...
Definition: Quadrature.cpp:674
DoubleVec getCorrectedWeights(size_t azim) const
Calculates the weights to be used in numerical integration.
Definition: Quadrature.cpp:1273
std::vector< DoubleVec > _polar_weights
Definition: Quadrature.h:108
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...
Definition: Quadrature.h:313
void initialize()
Routine to initialize the polar quadrature.
Definition: Quadrature.cpp:919
QuadratureType
The types of quadrature sets supported by OpenMOC.
Definition: Quadrature.h:35
Math constants and comparision tolerances.
void precomputeWeights(bool solve_3D)
Calculates total weights for every azimuthal/polar combination based on the equal angle polar quadrat...
Definition: Quadrature.cpp:1514
void setAzimWeight(double weight, size_t azim)
Sets the azimuthal weight for the given index.
Definition: Quadrature.cpp:593
friend std::ostream & operator<<(std::ostream &os, const Quadrature &quad)
Prints to the provided output stream.
Definition: Quadrature.cpp:772
void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:1468
const DoubleVec & getAzimWeights() const
Returns a pointer to the Quadrature's vector of azimuthal weights.
Definition: Quadrature.cpp:255
std::vector< DoubleVec > _thetas
Definition: Quadrature.h:93
Quadrature()
Dummy constructor sets the default number of angles to zero.
Definition: Quadrature.cpp:11
const std::vector< DoubleVec > & getThetas() const
Returns a reference to the Quadrature's vector of polar angles .
Definition: Quadrature.cpp:226
virtual void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:367
EqualWeightPolarQuad()
Dummy constructor calls the parent constructor.
Definition: Quadrature.cpp:1367
void setThetas(const DoubleVec &thetas)
Sets the Quadrature's vector of polar angles.
Definition: Quadrature.cpp:412
std::vector< DoubleVec > _total_weights
Definition: Quadrature.h:111
Tabuchi-Yamamoto's polar quadrature.
Definition: Quadrature.h:192
static double getSingleWeight(double root, size_t n)
Calculates the weights to be used in Gauss-Legendre Quadrature.
Definition: Quadrature.cpp:1260
void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:997
void useCorrectedWeights(bool use_corrected_weights)
Indicates whether to correct weights based on altered polar angles.
Definition: Quadrature.cpp:1035
std::vector< DoubleVec > _polar_spacings
Definition: Quadrature.h:105
static DoubleVec getLegendreRoots(size_t n)
Finds the roots of Legendre polynomial of order n.
Definition: Quadrature.cpp:1128
static double legendrePolynomial(size_t n, double x)
the Legendre polynomial of degree n evaluated at x
Definition: Quadrature.cpp:1076
The arbitrary quadrature parent class.
Definition: Quadrature.h:76
Equal angle polar quadrature.
Definition: Quadrature.h:277
static DoubleVec getGLWeights(const DoubleVec &roots, size_t n)
Calculates the weights to be used in Gauss-Legendre Quadrature.
Definition: Quadrature.cpp:1241
void setPolarSpacing(double spacing, size_t azim, size_t polar)
Sets the polar spacing for the given indexes.
Definition: Quadrature.cpp:567
void initialize()
Routine to initialize the polar quadrature.
Definition: Quadrature.cpp:1008
TYPolarQuad()
Dummy constructor calls the parent constructor.
Definition: Quadrature.cpp:790
void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:800
double getAzimWeight(size_t azim) const
Returns the azimuthal angle weight value for a particular azimuthal angle.
Definition: Quadrature.cpp:126
void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:904
double getAzimSpacing(size_t azim) const
Returns the adjusted azimuthal spacing at the requested azimuthal angle index.
Definition: Quadrature.cpp:330
GLPolarQuad()
Dummy constructor calls the parent constructor.
Definition: Quadrature.cpp:986
QuadratureType _quad_type
Definition: Quadrature.h:81
EqualAnglePolarQuad()
Dummy constructor calls the parent constructor.
Definition: Quadrature.cpp:1458
void setPolarWeights(const DoubleVec &weights)
Set the Quadrature's vector of polar weights.
Definition: Quadrature.cpp:460
size_t getNumPolarAngles() const
Returns the number of polar angles.
Definition: Quadrature.cpp:21
const std::vector< DoubleVec > & getPolarWeights() const
Returns a pointer to the Quadrature's vector of polar weights.
Definition: Quadrature.cpp:269
std::string toString() const
Converts this Quadrature to a character vector of its attributes.
Definition: Quadrature.cpp:745
QuadratureType getQuadratureType() const
Returns the type of Quadrature created.
Definition: Quadrature.cpp:782
void initialize()
Routine to initialize the polar quadrature.
Definition: Quadrature.cpp:815
static double secondLogDerivLegendre(size_t n, double x)
The second logarithmic derivative of a Legendre polynomial.
Definition: Quadrature.cpp:1111
const DoubleVec & getPhis() const
Returns a pointer to the Quadrature's vector of azimuthal angles .
Definition: Quadrature.cpp:241
size_t _num_azim
Definition: Quadrature.h:84
const std::vector< DoubleVec > & getPolarSpacings() const
Returns a 2D vector of adjusted polar spacings.
Definition: Quadrature.cpp:342
virtual void initialize()
Initialize the polar quadrature azimuthal angles.
Definition: Quadrature.cpp:646
void precomputeWeights(bool solve_3D)
Calculates total weights for every azimuthal/polar combination based on the equal weight polar quadra...
Definition: Quadrature.cpp:1419
Gauss-Legendre's polar quadrature.
Definition: Quadrature.h:225
const std::vector< DoubleVec > & getSinThetas() const
Returns a pointer to the Quadrature's vector of polar angle sines .
Definition: Quadrature.cpp:211
double getPhi(size_t azim) const
Returns the azimuthal angle value in radians.
Definition: Quadrature.cpp:101
void setPhi(double phi, size_t azim)
Sets the azimuthal angle for the given index.
Definition: Quadrature.cpp:522
virtual void setNumAzimAngles(size_t num_azim)
Set the number of azimuthal angles to initialize.
Definition: Quadrature.cpp:283
LeonardPolarQuad()
Dummy constructor calls the parent constructor.
Definition: Quadrature.cpp:894
void initialize()
Routine to initialize the polar quadrature.
Definition: Quadrature.cpp:1477
void precomputeWeights(bool solve_3D)
Calculates total weights for every azimuthal/polar combination based on the TY quadrature.
Definition: Quadrature.cpp:856
void initialize()
Routine to initialize the polar quadrature.
Definition: Quadrature.cpp:1386
#define weights(i, p)
Definition: GPUSolver.h:51
double getTheta(size_t azim, size_t polar) const
Returns the polar angle in radians for a given azimuthal and polar angle index.
Definition: Quadrature.cpp:72
double getWeight(size_t azim, size_t polar) const
Returns the total weight for Tracks with the given azimuthal and polar indexes.
Definition: Quadrature.cpp:182
size_t getNumAzimAngles() const
Returns the number of azimuthal angles.
Definition: Quadrature.cpp:30
double getPolarWeight(size_t azim, size_t polar) const
Returns the polar weight for a particular azimuthal and polar angle.
Definition: Quadrature.cpp:150
DoubleVec _azim_weights
Definition: Quadrature.h:102
Utility functions for writing log messages to the screen.
static double logDerivLegendre(size_t n, double x)
The first logarithmic derivative of a Legendre polynomial.
Definition: Quadrature.cpp:1098
DoubleVec _phis
Definition: Quadrature.h:96
void setAzimSpacing(double spacing, size_t azim)
Sets the azimuthal spacing for the given index.
Definition: Quadrature.cpp:544
void precomputeWeights(bool solve_3D)
Calculates total weights for every azimuthal/polar combination based on the Gauss-Legendre polar quad...
Definition: Quadrature.cpp:1045
Equal weight polar quadrature.
Definition: Quadrature.h:260
size_t _num_polar
Definition: Quadrature.h:87
void setNumPolarAngles(size_t num_polar)
Set the number of polar angles to initialize.
Definition: Quadrature.cpp:1377