diff --git a/src/material.cpp b/src/material.cpp index a5bc3dc138..38eef82a7f 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -857,12 +857,12 @@ void Material::calculate_photon_xs(Particle& p) const void Material::set_id(int32_t id) { - Expects(id >= -1); + Expects(id >= 0 || id == C_NONE); // Clear entry in material map if an ID was already assigned before - if (id_ != -1) { + if (id_ != C_NONE) { model::material_map.erase(id_); - id_ = -1; + id_ = C_NONE; } // Make sure no other material has same ID @@ -871,7 +871,7 @@ void Material::set_id(int32_t id) } // If no ID specified, auto-assign next ID in sequence - if (id == -1) { + if (id == C_NONE) { id = 0; for (const auto& m : model::materials) { id = std::max(id, m->id_); diff --git a/src/tallies/filter.cpp b/src/tallies/filter.cpp index c67eec830d..d8fe58cc79 100644 --- a/src/tallies/filter.cpp +++ b/src/tallies/filter.cpp @@ -148,12 +148,12 @@ Filter* Filter::create(const std::string& type, int32_t id) void Filter::set_id(int32_t id) { - Expects(id >= -1); + Expects(id >= 0 || id == C_NONE); // Clear entry in filter map if an ID was already assigned before - if (id_ != -1) { + if (id_ != C_NONE) { model::filter_map.erase(id_); - id_ = -1; + id_ = C_NONE; } // Make sure no other filter has same ID @@ -162,7 +162,7 @@ void Filter::set_id(int32_t id) } // If no ID specified, auto-assign next ID in sequence - if (id == -1) { + if (id == C_NONE) { id = 0; for (const auto& f : model::tally_filters) { id = std::max(id, f->id_); diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 852918a0cd..059803e767 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -483,12 +483,12 @@ Tally::create(int32_t id) void Tally::set_id(int32_t id) { - Expects(id >= -1); + Expects(id >= 0 || id == C_NONE); // Clear entry in tally map if an ID was already assigned before - if (id_ != -1) { + if (id_ != C_NONE) { model::tally_map.erase(id_); - id_ = -1; + id_ = C_NONE; } // Make sure no other tally has the same ID @@ -497,7 +497,7 @@ Tally::set_id(int32_t id) } // If no ID specified, auto-assign next ID in sequence - if (id == -1) { + if (id == C_NONE) { id = 0; for (const auto& t : model::tallies) { id = std::max(id, t->id_);