diff --git a/Cantera/src/State.cpp b/Cantera/src/State.cpp index cc116bcc0..18c489bfa 100644 --- a/Cantera/src/State.cpp +++ b/Cantera/src/State.cpp @@ -28,6 +28,41 @@ namespace Cantera { State::~State() {} + State::State(const State& right) : + m_kk(0), + m_temp(0.0), + m_dens(0.001), + m_mmw(0.0) { + /* + * Call the assignment operator. + */ + *this = operator=(right); + } + + /* + * Assignment operator for the State Class + */ + State& State::operator=(const State& right) { + /* + * Check for self assignment. + */ + if (this == &right) return *this; + /* + * We do a straight assignment operator on all of the + * data. The vectors are copied. + */ + m_temp = right.m_temp; + m_dens = right.m_dens; + m_mmw = right.m_mmw; + m_y = right.m_y; + m_molwts = right.m_molwts; + m_rmolwts = right.m_rmolwts; + /* + * Return the reference to the current object + */ + return *this; + } + doublereal State::moleFraction(int k) const { if (k >= 0 && k < m_kk) { return m_ym[k] * m_mmw; diff --git a/Cantera/src/State.h b/Cantera/src/State.h index ea06e6019..9772b1110 100755 --- a/Cantera/src/State.h +++ b/Cantera/src/State.h @@ -24,7 +24,10 @@ namespace Cantera { /** - * Manages the thermodynamic state. Class State stores just enough + * Manages the independent variables of temperature, mass + * density, and mass/mole species fraction that define the + * thermodynamic state. + * Class State stores just enough * information about a multicomponent solution to specify its * intensive thermodynamic state. It stores values for the * temperature, mass density, and an array of species mass @@ -57,6 +60,16 @@ namespace Cantera { */ virtual ~State(); + /** + * Copy Constructor for the State Class + */ + State(const State& right); + + /** + * Assignment operator for the state class. + */ + State& operator=(const State& right); + /// @name Species Information /// The only thing class State knows about the species is their