mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Check for invalid surface IDs in region expression
This commit is contained in:
parent
f9b74bd141
commit
443fc9e074
1 changed files with 6 additions and 1 deletions
|
|
@ -318,7 +318,12 @@ CSGCell::CSGCell(pugi::xml_node cell_node)
|
|||
// Convert user IDs to surface indices.
|
||||
for (auto& r : region_) {
|
||||
if (r < OP_UNION) {
|
||||
r = copysign(model::surface_map[abs(r)] + 1, r);
|
||||
const auto& it {model::surface_map.find(abs(r))};
|
||||
if (it == model::surface_map.end()) {
|
||||
throw std::runtime_error{"Invalid surface ID " + std::to_string(abs(r))
|
||||
+ " specified in region for cell " + std::to_string(id_) + "."};
|
||||
}
|
||||
r = copysign(it->second + 1, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue