diff --git a/include/enrico/cell_instance.h b/include/enrico/cell_instance.h index c3f3aa69..d4905f8c 100644 --- a/include/enrico/cell_instance.h +++ b/include/enrico/cell_instance.h @@ -34,6 +34,10 @@ class CellInstance { //! \return cell temperature in [K] double get_temperature() const; + //! Get the density of this cell + //! \return cell density in [g/cm^3] + double get_density() const; + //! Check for equality bool operator==(const CellInstance& other) const; diff --git a/src/cell_instance.cpp b/src/cell_instance.cpp index 2cdf03a5..687a7f3c 100644 --- a/src/cell_instance.cpp +++ b/src/cell_instance.cpp @@ -53,6 +53,13 @@ void CellInstance::set_density(double rho) const err_chk(openmc_material_set_density(material_index_, rho, "g/cm3")); } +double CellInstance::get_density() const +{ + double rho; + err_chk(openmc_material_get_density(material_index)); + return rho; +} + bool CellInstance::operator==(const CellInstance& other) const { return index_ == other.index_ && instance_ == other.instance_;