Correcting default values in set_id methods. Initializing material ids to match the initialization logic.

This commit is contained in:
Patrick Shriwise 2019-09-27 10:43:36 -05:00
parent a8d90844a3
commit 1b8bc2d01d
3 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
}