Add accessors for Material.density_ and density_gpcc_

This commit is contained in:
Paul Romano 2019-07-03 22:34:06 -05:00
parent 4815cfebac
commit 5d3afc1110
2 changed files with 9 additions and 1 deletions

View file

@ -65,6 +65,14 @@ public:
//! \param[in] density Density of the nuclide in [atom/b-cm]
void add_nuclide(const std::string& nuclide, double density);
//! Get density in [atom/b-cm]
//! \return Density in [atom/b-cm]
double density() const { return density_; }
//! Get density in [g/cm^3]
//! \return Density in [g/cm^3]
double density_gpcc() const { return density_gpcc_; }
//! Set total density of the material
int set_density(double density, std::string units);

View file

@ -1216,7 +1216,7 @@ openmc_material_get_density(int32_t index, double* density)
{
if (index >= 0 && index < model::materials.size()) {
auto& mat = model::materials[index];
*density = mat->density_gpcc_;
*density = mat->density_gpcc();
return 0;
} else {
set_errmsg("Index in materials array is out of bounds.");