20 const std::string & geometry_type,
21 const std::vector<Real> & ring_radii,
22 const std::vector<Real> & duct_apothems,
23 const std::vector<std::vector<std::string>> & region_names,
24 const std::vector<Real> & axial_plane_levels,
25 const std::vector<std::string> & axial_plane_names)
27 _ring_radii(ring_radii),
28 _duct_apothems(duct_apothems),
29 _region_names(region_names),
30 _axial_plane_levels(axial_plane_levels),
31 _axial_plane_names(axial_plane_names)
35 for (
const auto i : make_range(
_ring_radii.size() - 1))
38 "Ducted pin engineering unit must have ring radii defined in strictly ascending order");
44 mooseError(
"Ducted pin engineering unit must have duct apothems defined in strictly "
51 mooseError(
"Ducted pin engineering unit must have axial plane levels defined in strictly "
56 mooseError(
"Size of axial plane levels must match size of axial plane names");
61 mooseError(
"Size of region IDs must be one larger than the number of axial levels");
65 if (region_names_radial.size() != n_radial)
66 mooseError(
"Size of each entry in region IDs must be one larger than the number of radial "
103 std::vector<std::reference_wrapper<const CSG::PinUniverseEngUnit>> pin_units_by_axial_region;
108 for (
const auto i : make_range(n_axial))
110 auto unit_name =
_name +
"_pin_unit";
111 if (has_axial_levels)
112 unit_name +=
"_axial_" + std::to_string(i);
113 std::vector<std::string> pin_fill_mats;
114 for (
const auto j : make_range(n_ring + 1))
117 std::unique_ptr<CSG::PinUniverseEngUnit> pin_ptr =
118 std::make_unique<CSG::PinUniverseEngUnit>(unit_name,
_ring_radii, pin_fill_mats);
120 pin_units_by_axial_region.push_back(pin_unit);
126 std::vector<CSG::CSGRegion> radial_regions;
128 std::vector<std::reference_wrapper<const CSG::CSGNPolygonUnit>> duct_units_by_radial_region;
131 const auto unit_name =
_name +
"_radial_duct_" + std::to_string(i);
133 std::unique_ptr<CSG::CSGNPolygonUnit> duct_ptr =
134 std::make_unique<CSG::CSGNPolygonUnit>(unit_name, n_sides,
_duct_apothems[i]);
135 auto & duct_unit =
_internal_base->addEngUnit(std::move(duct_ptr));
136 duct_units_by_radial_region.push_back(duct_unit);
141 inner_region = -duct_unit;
142 radial_region = inner_region;
148 outer_region = ~inner_region;
149 inner_region = -duct_unit;
150 radial_region = inner_region & outer_region;
152 radial_regions.push_back(radial_region);
156 radial_region = radial_regions.empty() ? outer_region : ~inner_region;
157 radial_regions.push_back(radial_region);
160 std::vector<CSG::CSGRegion> axial_regions;
161 std::vector<std::reference_wrapper<const CSG::CSGSurface>> surfaces_by_axial_region;
162 if (has_axial_levels)
163 for (
const auto i : make_range(n_axial))
170 std::unique_ptr<CSG::CSGSurface> plane_surf_ptr =
171 std::make_unique<CSG::CSGPlane>(axial_surf_name, 0, 0, 1, axial_level);
172 const auto & plane_surf =
_internal_base->addSurface(std::move(plane_surf_ptr));
173 surfaces_by_axial_region.push_back(plane_surf);
178 const auto & current_surf = surfaces_by_axial_region.back().get();
181 axial_region = -current_surf;
184 axial_region = +current_surf;
189 const auto & prev_surf = surfaces_by_axial_region[i - 1].get();
190 axial_region = -current_surf & +prev_surf;
192 axial_regions.push_back(axial_region);
196 for (
const auto i : index_range(radial_regions))
198 const unsigned int radial_index =
_ring_radii.size() + i;
199 for (
const auto j : make_range(has_axial_levels ? axial_regions.size() : 1))
201 auto cell_region = radial_regions[i];
202 auto cell_name =
_name +
"_cell_radial_" + std::to_string(i);
203 if (has_axial_levels)
206 const auto axial_region = axial_regions[j];
207 if (cell_region.getRegionType() != CSG::CSGRegion::RegionType::EMPTY)
208 cell_region &= axial_region;
210 cell_region = axial_region;
211 cell_name +=
"_axial_" + std::to_string(j);
213 if (i == 0 && n_ring > 0)
215 _internal_base->createCell(cell_name, pin_units_by_axial_region[j], cell_region);
DuctedPinEngUnit(const std::string &name, const std::string &geometry_type, const std::vector< Real > &ring_radii, const std::vector< Real > &duct_apothems, const std::vector< std::vector< std::string > > ®ion_names, const std::vector< Real > &axial_plane_levels, const std::vector< std::string > &axial_plane_names)
Constructor for DuctedPinEngUnit.