Apply suggestions from code review

Accessing cell/material names through accessor. Returning a const reference from `name()` accessor in both cases.

Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Patrick Shriwise 2019-07-23 14:33:35 -05:00 committed by GitHub
parent 331e198617
commit d820e6777a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -136,7 +136,7 @@ public:
//! Get the name of a cell
//! \return Cell name
std::string name() const { return name_; };
const std::string& name() const { return name_; };
//! Set the temperature of a cell instance
//! \param[in] name Cell name

View file

@ -94,7 +94,7 @@ public:
//! Get name
//! \return Material name
std::string name() const { return name_; }
const std::string& name() const { return name_; }
//! Set name
void set_name(const std::string& name) { name_ = name; }

View file

@ -1089,7 +1089,7 @@ openmc_cell_get_name(int32_t index, const char** name) {
return OPENMC_E_OUT_OF_BOUNDS;
}
*name = model::cells[index]->name_.data();
*name = model::cells[index]->name().data();
return 0;
}

View file

@ -1388,7 +1388,7 @@ openmc_material_get_name(int32_t index, const char** name) {
return OPENMC_E_OUT_OF_BOUNDS;
}
*name = model::materials[index]->name_.data();
*name = model::materials[index]->name().data();
return 0;
}