mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge pull request #1367 from pshriwise/initialize_mat_id
Correction to `id_` attribute in Material/Filter classes
This commit is contained in:
commit
ae1209e283
2 changed files with 3 additions and 3 deletions
|
|
@ -132,7 +132,7 @@ public:
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
// Data
|
||||
int32_t id_; //!< Unique ID
|
||||
int32_t id_ {-1}; //!< Unique ID
|
||||
std::string name_; //!< Name of material
|
||||
std::vector<int> nuclide_; //!< Indices in nuclides vector
|
||||
std::vector<int> element_; //!< Indices in elements vector
|
||||
|
|
|
|||
|
|
@ -873,8 +873,8 @@ void Material::set_id(int32_t id)
|
|||
// If no ID specified, auto-assign next ID in sequence
|
||||
if (id == -1) {
|
||||
id = 0;
|
||||
for (const auto& f : model::materials) {
|
||||
id = std::max(id, f->id_);
|
||||
for (const auto& m : model::materials) {
|
||||
id = std::max(id, m->id_);
|
||||
}
|
||||
++id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue