mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Use 0-based indices for materials consistently
This commit is contained in:
parent
5c6633c2c3
commit
4a89075890
17 changed files with 82 additions and 107 deletions
|
|
@ -85,18 +85,17 @@ adjust_indices()
|
|||
}
|
||||
} else {
|
||||
c->type_ = FILL_MATERIAL;
|
||||
for (auto it = c->material_.begin(); it != c->material_.end(); it++) {
|
||||
int32_t mid = *it;
|
||||
if (mid != MATERIAL_VOID) {
|
||||
auto search = model::material_map.find(mid);
|
||||
if (search != model::material_map.end()) {
|
||||
*it = search->second;
|
||||
} else {
|
||||
for (auto& mat_id : c->material_) {
|
||||
if (mat_id != MATERIAL_VOID) {
|
||||
auto search = model::material_map.find(mat_id);
|
||||
if (search == model::material_map.end()) {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Could not find material " << mid
|
||||
err_msg << "Could not find material " << mat_id
|
||||
<< " specified on cell " << c->id_;
|
||||
fatal_error(err_msg);
|
||||
}
|
||||
// Change from ID to index
|
||||
mat_id = search->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue