mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[mix] Make API usable by clib
This commit is contained in:
parent
ec9de7c897
commit
17d441901c
@ -88,6 +88,17 @@ public:
|
||||
*/
|
||||
void addPhases(MultiPhase& mix);
|
||||
|
||||
//! Add a phase to the mixture.
|
||||
/*!
|
||||
* This function must be called before the init() function is called,
|
||||
* which serves to freeze the MultiPhase.
|
||||
*
|
||||
* @param p pointer to the phase object
|
||||
* @param moles total number of moles of all species in this phase
|
||||
* @since New in %Cantera 3.2.
|
||||
*/
|
||||
void addPhase(shared_ptr<ThermoPhase> p, double moles);
|
||||
|
||||
//! Add a phase to the mixture.
|
||||
/*!
|
||||
* This function must be called before the init() function is called,
|
||||
@ -575,6 +586,11 @@ private:
|
||||
//! Vector of the ThermoPhase pointers.
|
||||
vector<ThermoPhase*> m_phase;
|
||||
|
||||
//! Vector of shared ThermoPhase pointers.
|
||||
//! Contains valid phase entries if added by addPhase(shared_ptr<ThermoPhase>) and
|
||||
//! null pointers if a phase is added via addPhase(ThermoPhase*).
|
||||
vector<shared_ptr<ThermoPhase>> m_sharedPhase;
|
||||
|
||||
//! Global Stoichiometric Coefficient array
|
||||
/*!
|
||||
* This is a two dimensional array m_atoms(m, k). The first index is the
|
||||
@ -661,6 +677,9 @@ private:
|
||||
mutable vector<double> m_elemAbundances;
|
||||
};
|
||||
|
||||
//! Create a new empty MultiPhase object
|
||||
shared_ptr<MultiPhase> newMultiPhase();
|
||||
|
||||
//! Function to output a MultiPhase description to a stream
|
||||
/*!
|
||||
* Writes out a description of the contents of each phase of the
|
||||
|
@ -43,6 +43,12 @@ void MultiPhase::addPhases(vector<ThermoPhase*>& phases,
|
||||
init();
|
||||
}
|
||||
|
||||
void MultiPhase::addPhase(shared_ptr<ThermoPhase> p, double moles)
|
||||
{
|
||||
addPhase(p.get(), moles);
|
||||
m_sharedPhase.back() = p;
|
||||
}
|
||||
|
||||
void MultiPhase::addPhase(ThermoPhase* p, double moles)
|
||||
{
|
||||
if (m_init) {
|
||||
@ -57,6 +63,7 @@ void MultiPhase::addPhase(ThermoPhase* p, double moles)
|
||||
|
||||
// save the pointer to the phase object
|
||||
m_phase.push_back(p);
|
||||
m_sharedPhase.push_back(nullptr);
|
||||
|
||||
// store its number of moles
|
||||
m_moles.push_back(moles);
|
||||
@ -832,6 +839,11 @@ void MultiPhase::updatePhases() const
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<MultiPhase> newMultiPhase()
|
||||
{
|
||||
return make_shared<MultiPhase>();
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, MultiPhase& x)
|
||||
{
|
||||
x.updatePhases();
|
||||
|
Loading…
Reference in New Issue
Block a user