[equil] Add species lock

This commit is contained in:
Ingmar Schoegl 2024-03-31 10:02:45 -05:00
parent 46913c88cc
commit 4d3025587f
2 changed files with 11 additions and 1 deletions

View File

@ -65,7 +65,7 @@ public:
//! Destructor. Does nothing. Class MultiPhase does not take "ownership" //! Destructor. Does nothing. Class MultiPhase does not take "ownership"
//! (that is, responsibility for destroying) the phase objects. //! (that is, responsibility for destroying) the phase objects.
virtual ~MultiPhase() = default; virtual ~MultiPhase();
//! Add a vector of phases to the mixture //! Add a vector of phases to the mixture
/*! /*!

View File

@ -20,6 +20,13 @@ using namespace std;
namespace Cantera namespace Cantera
{ {
MultiPhase::~MultiPhase()
{
for (size_t i = 0; i < m_phase.size(); i++) {
m_phase[i]->removeSpeciesLock();
}
}
void MultiPhase::addPhases(MultiPhase& mix) void MultiPhase::addPhases(MultiPhase& mix)
{ {
for (size_t n = 0; n < mix.nPhases(); n++) { for (size_t n = 0; n < mix.nPhases(); n++) {
@ -101,6 +108,9 @@ void MultiPhase::addPhase(ThermoPhase* p, double moles)
m_Tmin = std::max(p->minTemp(), m_Tmin); m_Tmin = std::max(p->minTemp(), m_Tmin);
m_Tmax = std::min(p->maxTemp(), m_Tmax); m_Tmax = std::min(p->maxTemp(), m_Tmax);
} }
// lock species list
p->addSpeciesLock();
} }
void MultiPhase::init() void MultiPhase::init()