Use execeptions to simplify usage of ElemRearrange
This commit is contained in:
parent
7af153c75f
commit
5ebdb7e924
3 changed files with 6 additions and 9 deletions
|
|
@ -750,7 +750,9 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
|
|||
* @param[out] orderVectorElements Output vector containing the order of the
|
||||
* elements that is necessary for calculation of the formula matrix.
|
||||
*
|
||||
* @ingroup equilfunctions
|
||||
* @ingroup equilfunctions
|
||||
* @deprecated - The return value for this function is deprecated. After
|
||||
* Cantera 2.2, this function will return void.
|
||||
*/
|
||||
size_t ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
|
||||
MultiPhase* mphase,
|
||||
|
|
|
|||
|
|
@ -563,11 +563,10 @@ size_t Cantera::ElemRearrange(size_t nComponents, const vector_fp& elementAbunda
|
|||
if (k == nelements) {
|
||||
// When we are here, there is an error usually.
|
||||
// We haven't found the number of elements necessary.
|
||||
// This is signalled by returning jr != nComponents.
|
||||
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) {
|
||||
writelogf("Error exit: returning with nComponents = %d\n", jr);
|
||||
}
|
||||
return jr;
|
||||
throw CanteraError("ElemRearrange", "Required number of elements not found.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -273,12 +273,8 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
|
|||
s.setMoleFractions(DATA_PTR(xMF_est));
|
||||
s.getMoleFractions(DATA_PTR(xMF_est));
|
||||
|
||||
size_t nct = Cantera::ElemRearrange(m_nComponents, elMolesGoal, &mp,
|
||||
m_orderVectorSpecies, m_orderVectorElements);
|
||||
if (nct != m_nComponents) {
|
||||
throw CanteraError("ChemEquil::estimateElementPotentials",
|
||||
"confused");
|
||||
}
|
||||
ElemRearrange(m_nComponents, elMolesGoal, &mp,
|
||||
m_orderVectorSpecies, m_orderVectorElements);
|
||||
|
||||
s.getChemPotentials(DATA_PTR(mu_RT));
|
||||
doublereal rrt = 1.0/(GasConstant* s.temperature());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue