hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
gauss_legendre_trapezoid.cc
Go to the documentation of this file.
2
3#include <cmath>
4namespace hummingbird {
6 const size_t n_polar,
7 const bool polar_measured_from_x) {
8 abscissas_.reserve(n_azim * n_polar);
9 GaussLegendre gl_polar_quad(n_polar);
10
11 double delta_azim = 2.0 * M_PI / (static_cast<double>(n_azim));
12 size_t counter = 0;
13 for (auto i = 0; i < n_polar; i++) {
14 double polar = gl_polar_quad.GetAbscissa(i);
15 for (double j = 0; j < n_azim; j++) {
16 double azim = -M_PI + j * delta_azim;
17
18 Ordinate new_ordinate = polar_measured_from_x
19 ? Ordinate(std::acos(polar), M_PI / 2.0)
20 : Ordinate(azim, std::acos(polar));
21 abscissas_.push_back(std::move(new_ordinate));
22
23 double weight = gl_polar_quad.GetWeight(i) * delta_azim;
24 weight_map_.insert({counter, weight});
25 counter++;
26 }
27 }
28}
29} // namespace hummingbird
GaussLegendreTrapezoid(const size_t n_azim, const size_t n_polar, const bool polar_measured_from_x=false)
Construct a new Gauss Legendre Trapezoid object.
Defines a Gauss-Legendre quadrature set on the interval [-1,1].
Defines a solid angle, or ordinate, in spherical geometry.
Definition ordinate.h:15
std::map< unsigned int, double > weight_map_
T GetAbscissa(const unsigned int index) const
Get the abscissa corresponding to the index.
double GetWeight(const unsigned int abscissa_index) const
Get the weight value corresponding to a given abscissa value.