mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Correcting default values in set_id methods. Initializing material ids to match the initialization logic.
This commit is contained in:
parent
a8d90844a3
commit
1b8bc2d01d
3 changed files with 5 additions and 5 deletions
|
|
@ -120,7 +120,7 @@ public:
|
|||
//! Assign a unique ID to the material
|
||||
//! \param[in] Unique ID to assign. A value of -1 indicates that an ID
|
||||
//! should be automatically assigned.
|
||||
void set_id(int32_t id);
|
||||
void set_id(int32_t id = -1);
|
||||
|
||||
//! Get whether material is fissionable
|
||||
//! \return Whether material is fissionable
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public:
|
|||
//! Assign a unique ID to the filter
|
||||
//! \param[in] Unique ID to assign. A value of -1 indicates that an ID should
|
||||
//! be automatically assigned
|
||||
void set_id(int32_t id);
|
||||
void set_id(int32_t id = -1);
|
||||
|
||||
//! Get number of bins
|
||||
//! \return Number of bins
|
||||
|
|
|
|||
|
|
@ -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