10#define POLAR_ILLEGAL_GEOTYPE (fname + \
11 ": The simulation is using polar angle aggregation for which only " \
12 "certain geometry types are supported, i.e., ORTHOGONAL, DIMENSION_2 " \
15#define POLAR_ONLY_PRODUCT (fname + \
16 ": The simulation is using polar angle aggregation for which only " \
17 "Product-type quadratures are supported.")
19#define PRODUCT_QUAD_CASTING_FAILED (fname + \
20 ": Casting the angular quadrature to the product quadrature base, failed.")
22#define AZIMUTHAL_ILLEGAL_GEOTYPE (fname + \
23 ": The simulation is using azimuthal angle aggregation for which only " \
24 "ONED_SPHERICAL or TWOD_CYLINDRICAL derived geometry types are supported.")
26#define AZIMUTHAL_ONLY_PRODUCT (fname + \
27 ": The simulation is using azimuthal angle aggregation for which only " \
28 "Product-type quadratures are supported.")
30#define LogicCheck(condition, message) \
32 throw std::logic_error(fname+(message));
40std::pair<UniqueSOGroupings, DirIDToSOMap>
47 const std::string fname = __FUNCTION__;
51 ": Quadrature with no omegas cannot be used.")
53 ": Quadrature with no weights cannot be used.")
66 const size_t num_dirs = quadrature.
omegas_.size();
67 for (
size_t n=0; n<num_dirs; ++n)
68 unq_so_grps.push_back({n});
85 const auto quad_type = quadrature.
type_;
93 const auto& product_quad =
dynamic_cast<const ProdQuadType&
>(quadrature);
95 const auto num_azi = product_quad.
azimu_ang_.size();
96 const auto num_pol = product_quad.polar_ang_.size();
100 std::vector<size_t> upward_polar_ids;
101 std::vector<size_t> dnward_polar_ids;
102 for (
size_t p=0; p<num_pol; ++p)
103 if (product_quad.polar_ang_[p] > M_PI_2)
104 upward_polar_ids.push_back(p);
106 dnward_polar_ids.push_back(p);
110 auto MapPolarAndAzimuthalIDs = [&product_quad, &unq_so_grps](
111 const DirIDs& polar_ids,
const size_t azimuthal_id)
114 dir_ids.reserve(polar_ids.size());
115 for (
const size_t p : polar_ids)
116 dir_ids.push_back(product_quad.GetAngleNum(p, azimuthal_id));
117 unq_so_grps.push_back(std::move(dir_ids));
121 for (
size_t a=0; a<num_azi; ++a)
123 if (not upward_polar_ids.empty())
124 MapPolarAndAzimuthalIDs(upward_polar_ids, a);
125 if (not dnward_polar_ids.empty())
126 MapPolarAndAzimuthalIDs(dnward_polar_ids, a);
130 catch (
const std::bad_cast& bc)
147 const auto quad_type = quadrature.
type_;
155 const auto& product_quad =
dynamic_cast<const ProdQuadType&
>(quadrature);
157 for (
const auto& dir_set : product_quad.GetDirectionMap())
159 std::vector<unsigned int> group1;
160 std::vector<unsigned int> group2;
161 for (
const auto& dir_id : dir_set.second)
162 if (quadrature.
abscissae_[dir_id].phi > M_PI_2)
163 group1.push_back(dir_id);
165 group2.push_back(dir_id);
167 DirIDs group1_ids(group1.begin(),group1.end());
168 DirIDs group2_ids(group2.begin(),group2.end());
170 unq_so_grps.push_back(std::move(group1_ids));
171 unq_so_grps.push_back(std::move(group2_ids));
174 catch (
const std::bad_cast& bc)
182 throw std::invalid_argument(fname +
": Called with UNDEFINED angle "
183 "aggregation type.");
190 size_t so_grouping_id = 0;
191 for (
const auto& so_grouping : unq_so_grps)
193 for (
const size_t dir_id: so_grouping)
194 dir_id_to_so_map[dir_id] = so_grouping_id;
200 return {unq_so_grps, dir_id_to_so_map};
std::vector< double > weights_
const chi_math::AngularQuadratureType type_
std::vector< chi_math::QuadraturePointPhiTheta > abscissae_
std::vector< chi_mesh::Vector3 > omegas_
std::vector< double > azimu_ang_
MeshAttributes Attributes() const
static std::pair< UniqueSOGroupings, DirIDToSOMap > AssociateSOsAndDirections(const chi_mesh::MeshContinuum &grid, const chi_math::AngularQuadrature &quadrature, AngleAggregationType agg_type, lbs::GeometryType lbs_geo_type)
#define AZIMUTHAL_ILLEGAL_GEOTYPE
#define LogicCheck(condition, message)
#define POLAR_ILLEGAL_GEOTYPE
#define PRODUCT_QUAD_CASTING_FAILED
#define AZIMUTHAL_ONLY_PRODUCT
#define POLAR_ONLY_PRODUCT
std::vector< size_t > DirIDs
Direction-IDs.
std::map< size_t, size_t > DirIDToSOMap
std::vector< DirIDs > UniqueSOGroupings