Skip to content

Commit

Permalink
Add interface to material density method in OpenMC. Refs enrico-dev#17
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilnovak committed Jun 12, 2019
1 parent 110ba23 commit cd6ce5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/enrico/cell_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 7 additions & 0 deletions src/cell_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit cd6ce5a

Please sign in to comment.