15 const std::vector<double>& polar,
16 const std::vector<double>& in_weights,
19 size_t Na = azimuthal.size();
20 size_t Np = polar.size();
21 size_t Nw = in_weights.size();
26 <<
"Product Quadrature, InitializeWithCustom: mismatch in the amount "
27 "angles and weights. Number of azimuthal angles times number "
28 "polar angles must equal the amount of weights.";
48 for (
unsigned int j = 0; j < Np; ++j)
53 std::stringstream ostr;
54 double weight_sum = 0.0;
55 for (
unsigned int i = 0; i < Na; ++i)
57 for (
unsigned int j = 0; j < Np; ++j)
66 const double weight = in_weights[i*Np+j];
73 snprintf(buf,200,
"Varphi=%.2f Theta=%.2f Weight=%.3e\n",
74 abscissa.phi*180.0/M_PI,
75 abscissa.theta*180.0/M_PI,
87 new_omega.
x = sin(qpoint.theta)*cos(qpoint.phi);
88 new_omega.
y = sin(qpoint.theta)*sin(qpoint.phi);
89 new_omega.
z = cos(qpoint.theta);
91 omegas_.emplace_back(new_omega);
100 <<
"Weight sum=" << weight_sum;
116 std::vector<chi_math::QuadraturePointPhiTheta> new_abscissae;
117 std::vector<double> new_weights;
118 std::vector<chi_mesh::Vector3> new_omegas;
119 std::vector<double> new_polar_ang;
120 std::vector<double> new_azimu_ang;
122 const size_t num_pol = polar_ang_.size();
123 const size_t num_azi = azimu_ang_.size();
125 std::vector<unsigned int> new_polar_map;
126 for (
size_t p=0; p<num_pol; ++p)
127 if (polar_ang_[p] < M_PI_2)
129 new_polar_ang.push_back(polar_ang_[p]);
130 new_polar_map.push_back(p);
132 new_azimu_ang = azimu_ang_;
134 const size_t new_num_pol = new_polar_ang.size();
135 double weight_sum = 0.0;
136 for (
size_t a=0; a<num_azi; ++a)
137 for (
size_t p=0; p<new_num_pol; ++p)
139 const auto pmap = new_polar_map[p];
140 const auto dmap = GetAngleNum(pmap,a);
141 new_weights.push_back(weights_[dmap]);
142 weight_sum += weights_[dmap];
145 if (normalization > 0.0)
146 for (
double& w : new_weights)
147 w *= normalization/weight_sum;
150 AssembleCosines(new_azimu_ang, new_polar_ang,new_weights,
false);
151 polar_ang_ = new_polar_ang;
152 azimu_ang_ = new_azimu_ang;
170 for (
unsigned int j = 0; j < (Nphemi*2); ++j)
191 for (
unsigned int i = 0; i < (Na*4); ++i)
192 azimu_ang_.emplace_back(M_PI * gl_azimu.
qpoints_[i][0] + M_PI);
196 for (
unsigned int j = 0; j < (Np*2); ++j)
197 polar_ang_.emplace_back(M_PI - acos(gl_polar.
qpoints_[j][0]));
200 std::vector<double> weights;
201 for (
unsigned int i = 0; i < azimu_ang_.size(); ++i)
202 for (
unsigned int j = 0; j < polar_ang_.size(); ++j)
206 AssembleCosines(azimu_ang_, polar_ang_, weights, verbose);
219 for (
unsigned int i = 0; i < (Na*4); ++i)
220 azimu_ang_.emplace_back(M_PI * (2 * (i + 1) - 1) / (Na * 4));
224 for (
unsigned int j = 0; j < (Np*2); ++j)
225 polar_ang_.emplace_back(M_PI - acos(gl_polar.
qpoints_[j][0]));
228 std::vector<double> weights;
229 for (
unsigned int i = 0; i < azimu_ang_.size(); ++i)
230 for (
unsigned int j = 0; j < polar_ang_.size(); ++j)
234 AssembleCosines(azimu_ang_, polar_ang_, weights, verbose);
241 const std::vector<double> &polar,
242 const std::vector<double> &in_weights,
245 size_t Na = azimuthal.size();
246 size_t Np = polar.size();
247 size_t Nw = in_weights.size();
252 <<
"Product Quadrature, InitializeWithCustom: mismatch in the amount "
253 "angles and weights. Number of azimuthal angles times number "
254 "polar angles must equal the amount of weights.";
258 AssembleCosines(azimuthal, polar, weights_, verbose);
static void Exit(int error_code)
LogStream Log(LOG_LVL level=LOG_0)
std::vector< double > weights_
std::vector< chi_math::QuadraturePointPhiTheta > abscissae_
std::vector< chi_mesh::Vector3 > omegas_
AngularQuadratureProdCustom(const std::vector< double > &azimuthal, const std::vector< double > &polar, const std::vector< double > &in_weights, bool verbose)
AngularQuadratureProdGLC(int Na, int Np, bool verbose=false)
AngularQuadratureProdGL(int Np, bool verbose=false)
AngularQuadratureProdGLL(int Na, int Np, bool verbose=false)
std::vector< double > polar_ang_
std::vector< double > azimu_ang_
void AssembleCosines(const std::vector< double > &azimuthal, const std::vector< double > &polar, const std::vector< double > &in_weights, bool verbose)
void OptimizeForPolarSymmetry(double normalization) override
std::map< unsigned int, std::vector< unsigned int > > map_directions_
std::vector< chi_math::QuadraturePointXYZ > qpoints_
std::vector< double > weights_
std::string PrintS() const