Fixed signed/unsigned equality comparisons
This commit is contained in:
parent
de7d58805e
commit
1ff7c23860
62 changed files with 192 additions and 195 deletions
|
|
@ -20,7 +20,7 @@ Storage::Storage() {
|
|||
Storage::~Storage() { clear(); }
|
||||
|
||||
size_t Storage::addThermo(thermo_t* th) {
|
||||
if (th->index() != -1)
|
||||
if (th->index() != npos)
|
||||
return th->index();
|
||||
__thtable.push_back(th);
|
||||
size_t n = __thtable.size() - 1;
|
||||
|
|
@ -42,7 +42,7 @@ size_t Storage::nThermo() {
|
|||
}
|
||||
|
||||
size_t Storage::addKinetics(Kinetics* kin) {
|
||||
if (kin->index() != -1)
|
||||
if (kin->index() != npos)
|
||||
return kin->index();
|
||||
__ktable.push_back(kin);
|
||||
size_t n = __ktable.size() - 1;
|
||||
|
|
@ -51,7 +51,7 @@ size_t Storage::addKinetics(Kinetics* kin) {
|
|||
}
|
||||
|
||||
size_t Storage::addTransport(Transport* tr) {
|
||||
if (tr->index() != -1)
|
||||
if (tr->index() != npos)
|
||||
return tr->index();
|
||||
__trtable.push_back(tr);
|
||||
size_t n = __trtable.size() - 1;
|
||||
|
|
|
|||
|
|
@ -225,6 +225,8 @@ namespace Cantera {
|
|||
//! typedef for a pointer to temporary work storage which is treated as constant
|
||||
typedef const doublereal* const_workPtr;
|
||||
|
||||
//! index returned by functions to indicate "no position"
|
||||
const size_t npos = -1;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -1149,7 +1149,7 @@ namespace ctml {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (irow == -1) {
|
||||
if (irow == npos) {
|
||||
throw CanteraError("getMatrixValues","Row not matched by string: "
|
||||
+ key1);
|
||||
}
|
||||
|
|
@ -1159,7 +1159,7 @@ namespace ctml {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (icol == -1) {
|
||||
if (icol == npos) {
|
||||
throw CanteraError("getMatrixValues","Col not matched by string: "
|
||||
+ key2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace Cantera {
|
|||
// if negative atom numbers have already been specified
|
||||
// for some element other than this one, throw
|
||||
// an exception
|
||||
if (mneg != -1 && mneg != m)
|
||||
if (mneg != npos && mneg != m)
|
||||
throw CanteraError("ChemEquil::initialize",
|
||||
"negative atom numbers allowed for only one element");
|
||||
mneg = m;
|
||||
|
|
@ -1573,7 +1573,7 @@ namespace Cantera {
|
|||
if (n_i_calc[k] > nCutoff) {
|
||||
if (fabs(nAtoms(k,m)) > 0.001) {
|
||||
nSpeciesWithElem++;
|
||||
if (kMSp != -1) {
|
||||
if (kMSp != npos) {
|
||||
kMSp2 = k;
|
||||
double factor = fabs(nAtoms(kMSp,m) / nAtoms(kMSp2,m));
|
||||
for (n = 0; n < m_mm; n++) {
|
||||
|
|
@ -1763,7 +1763,7 @@ namespace Cantera {
|
|||
*/
|
||||
modifiedMatrix = false;
|
||||
for (m = 0; m < m_mm; m++) {
|
||||
size_t sameAsRow = -1;
|
||||
size_t sameAsRow = npos;
|
||||
for (size_t im = 0; im < m; im++) {
|
||||
bool theSame = true;
|
||||
for (n = 0; n < m_mm; n++) {
|
||||
|
|
@ -1776,7 +1776,7 @@ namespace Cantera {
|
|||
sameAsRow = im;
|
||||
}
|
||||
}
|
||||
if (sameAsRow != -1 || lumpSum[m]) {
|
||||
if (sameAsRow != npos || lumpSum[m]) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (ChemEquil_print_lvl > 0) {
|
||||
if (lumpSum[m]) {
|
||||
|
|
@ -1897,7 +1897,7 @@ namespace Cantera {
|
|||
*
|
||||
*/
|
||||
void ChemEquil::adjustEloc(thermo_t &s, vector_fp & elMolesGoal) {
|
||||
if (m_eloc == -1) return;
|
||||
if (m_eloc == npos) return;
|
||||
if (fabs(elMolesGoal[m_eloc]) > 1.0E-20) return;
|
||||
s.getMoleFractions(DATA_PTR(m_molefractions));
|
||||
size_t k;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ namespace Cantera {
|
|||
nsp = p->nSpecies();
|
||||
mlocal = p->elementIndex(sym);
|
||||
for (kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal != -1) {
|
||||
if (mlocal != npos) {
|
||||
m_atoms(m, k) = p->nAtoms(kp, mlocal);
|
||||
}
|
||||
if (m == 0) {
|
||||
|
|
@ -159,12 +159,12 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
if (m_eloc >= 0) {
|
||||
if (m_eloc != npos) {
|
||||
doublereal esum;
|
||||
for (k = 0; k < m_nsp; k++) {
|
||||
esum = 0.0;
|
||||
for (m = 0; m < m_nel; m++) {
|
||||
if (int(m) != m_eloc)
|
||||
if (m != m_eloc)
|
||||
esum += m_atoms(m,k) * m_atomicNumber[m];
|
||||
}
|
||||
//m_atoms(m_eloc, k) += esum;
|
||||
|
|
@ -226,11 +226,11 @@ namespace Cantera {
|
|||
|
||||
size_t MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) {
|
||||
size_t p = phaseIndex(phaseName);
|
||||
if (p == -1) {
|
||||
if (p == npos) {
|
||||
throw CanteraError("MultiPhase::speciesIndex", "phase not found: " + phaseName);
|
||||
}
|
||||
size_t k = m_phase[p]->speciesIndex(speciesName);
|
||||
if (k == -1) {
|
||||
if (k == npos) {
|
||||
throw CanteraError("MultiPhase::speciesIndex", "species not found: " + speciesName);
|
||||
}
|
||||
return m_spstart[p] + k;
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ namespace Cantera {
|
|||
// The left m_nel columns of A are now upper-diagonal. Now
|
||||
// reduce the m_nel columns to diagonal form by back-solving
|
||||
for (m = nRows-1; m > 0; m--) {
|
||||
for (size_t n = m-1; n != -1; n--) {
|
||||
for (size_t n = m-1; n != npos; n--) {
|
||||
if (m_A(n,m) != 0.0) {
|
||||
fctr = m_A(n,m);
|
||||
for (k = m; k < m_nsp; k++) {
|
||||
|
|
@ -828,7 +828,7 @@ namespace Cantera {
|
|||
}
|
||||
ok = false;
|
||||
for (ij = 0; ij < m_nel; ij++) {
|
||||
if (int(k) == m_order[ij]) ok = true;
|
||||
if (k == m_order[ij]) ok = true;
|
||||
}
|
||||
if (!ok || m_force) {
|
||||
getComponents(m_sortindex);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace VCSnonideal {
|
|||
* @param w Species mole number vector
|
||||
* @param fe vector of partial molar free energies of the species.
|
||||
*/
|
||||
double VCS_SOLVE::vcs_GibbsPhase(int iphase, const double * const w,
|
||||
double VCS_SOLVE::vcs_GibbsPhase(size_t iphase, const double * const w,
|
||||
const double * const fe) {
|
||||
double g = 0.0;
|
||||
double phaseMols = 0.0;
|
||||
|
|
|
|||
|
|
@ -1334,7 +1334,7 @@ namespace VCSnonideal {
|
|||
|
||||
kT++;
|
||||
}
|
||||
if (volPhase->phiVarIndex() != -1) {
|
||||
if (volPhase->phiVarIndex() != npos) {
|
||||
size_t kphi = volPhase->phiVarIndex();
|
||||
size_t kglob = volPhase->spGlobalIndexVCS(kphi);
|
||||
vprob->w[kglob] = tPhase->electricPotential();
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ namespace VCSnonideal {
|
|||
|
||||
IndSpecies.resize(nspecies, -1);
|
||||
|
||||
if ((int) ListSpeciesPtr.size() >= m_numSpecies) {
|
||||
if (ListSpeciesPtr.size() >= m_numSpecies) {
|
||||
for (size_t i = 0; i < m_numSpecies; i++) {
|
||||
if (ListSpeciesPtr[i]) {
|
||||
delete ListSpeciesPtr[i];
|
||||
|
|
@ -646,7 +646,7 @@ namespace VCSnonideal {
|
|||
* Update the electric potential if it is a solution variable
|
||||
* in the equation system
|
||||
*/
|
||||
if (m_phiVarIndex != -1) {
|
||||
if (m_phiVarIndex != npos) {
|
||||
kglob = IndSpecies[m_phiVarIndex];
|
||||
if (m_numSpecies == 1) {
|
||||
Xmol[m_phiVarIndex] = 1.0;
|
||||
|
|
@ -1468,7 +1468,7 @@ namespace VCSnonideal {
|
|||
size_t vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) {
|
||||
size_t e, k, eT;
|
||||
std::string ename;
|
||||
size_t eFound = -2;
|
||||
size_t eFound = npos;
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
|
@ -1492,7 +1492,7 @@ namespace VCSnonideal {
|
|||
elemResize(ne);
|
||||
|
||||
|
||||
if (ChargeNeutralityElement != -1) {
|
||||
if (ChargeNeutralityElement != npos) {
|
||||
m_elementType[ChargeNeutralityElement] = VCS_ELEM_TYPE_CHARGENEUTRALITY;
|
||||
}
|
||||
|
||||
|
|
@ -1524,7 +1524,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (eFound == -2) {
|
||||
if (eFound == npos) {
|
||||
eFound = ne;
|
||||
m_elementType[ne] = VCS_ELEM_TYPE_ELECTRONCHARGE;
|
||||
m_elementActive[ne] = 0;
|
||||
|
|
@ -1568,7 +1568,7 @@ namespace VCSnonideal {
|
|||
fm[e][k] = tPhase->nAtoms(k, eT);
|
||||
e++;
|
||||
}
|
||||
if (eFound != -2) {
|
||||
if (eFound != npos) {
|
||||
fm[eFound][k] = - tPhase->charge(k);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace VCSnonideal {
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void VCS_SOLVE::vcs_elabPhase(int iphase, double * const elemAbundPhase)
|
||||
void VCS_SOLVE::vcs_elabPhase(size_t iphase, double * const elemAbundPhase)
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "global.h"
|
||||
|
||||
namespace VCSnonideal {
|
||||
using Cantera::npos;
|
||||
|
||||
//! Points to the data in a std::vector<> object
|
||||
#define VCS_DATA_PTR(vvv) (&(vvv[0]))
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ namespace VCSnonideal {
|
|||
foundPos = e;
|
||||
}
|
||||
}
|
||||
if (foundPos == -1) {
|
||||
if (foundPos == npos) {
|
||||
int elType = volPhase->elementType(eVP);
|
||||
int elactive = volPhase->elementActive(eVP);
|
||||
e = addElement(enVP.c_str(), elType, elactive);
|
||||
|
|
|
|||
|
|
@ -1012,7 +1012,7 @@ public:
|
|||
void vcs_elab();
|
||||
|
||||
int vcs_elabcheck(int ibound);
|
||||
void vcs_elabPhase(int iphase, double * const elemAbundPhase);
|
||||
void vcs_elabPhase(size_t iphase, double * const elemAbundPhase);
|
||||
int vcs_elcorr(double aa[], double x[]);
|
||||
|
||||
|
||||
|
|
@ -1054,7 +1054,7 @@ public:
|
|||
* @param fe vector of partial molar free energies of all of the
|
||||
* species
|
||||
*/
|
||||
double vcs_GibbsPhase(int iphase, const double * const w,
|
||||
double vcs_GibbsPhase(size_t iphase, const double * const w,
|
||||
const double * const fe);
|
||||
|
||||
//! Transfer the results of the equilibrium calculation back to VCS_PROB
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ namespace VCSnonideal {
|
|||
bool justDeletedMultiPhase = false;
|
||||
size_t usedZeroedSpecies; /* return flag from basopt indicating that
|
||||
one of the components had a zero concentration */
|
||||
size_t doPhaseDeleteIph = -1;
|
||||
size_t doPhaseDeleteKspec = -1;
|
||||
size_t doPhaseDeleteIph = npos;
|
||||
size_t doPhaseDeleteKspec = npos;
|
||||
vcs_VolPhase *Vphase;
|
||||
double *sc_irxn = NULL; /* Stoichiometric coefficients for cur rxn */
|
||||
double *dnPhase_irxn;
|
||||
|
|
@ -395,10 +395,10 @@ namespace VCSnonideal {
|
|||
*
|
||||
*/
|
||||
soldel = -1;
|
||||
if (iphasePop != -1) {
|
||||
if (iphasePop != npos) {
|
||||
soldel = vcs_popPhaseRxnStepSizes(iphasePop);
|
||||
if (soldel == 3) {
|
||||
iphasePop = -1;
|
||||
iphasePop = npos;
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_debug_print_lvl >= 2) {
|
||||
plogf(" --- vcs_popPhaseRxnStepSizes() was called but stoich "
|
||||
|
|
@ -407,7 +407,7 @@ namespace VCSnonideal {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if (iphasePop == -1) {
|
||||
if (iphasePop == npos) {
|
||||
/*
|
||||
* Figure out the new reaction step sizes
|
||||
* for the major species (do minor species in the future too)
|
||||
|
|
@ -429,8 +429,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
#endif
|
||||
lec = FALSE;
|
||||
doPhaseDeleteIph = -1;
|
||||
doPhaseDeleteKspec = -1;
|
||||
doPhaseDeleteIph = npos;
|
||||
doPhaseDeleteKspec = npos;
|
||||
/*
|
||||
* Zero out the net change in moles of multispecies phases
|
||||
*/
|
||||
|
|
@ -486,7 +486,7 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
ANOTE[0] = '\0';
|
||||
#endif
|
||||
if (iphasePop != -1) {
|
||||
if (iphasePop != npos) {
|
||||
if (iph == iphasePop) {
|
||||
dx = m_deltaMolNumSpecies[kspec];
|
||||
m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + m_deltaMolNumSpecies[kspec];
|
||||
|
|
@ -865,7 +865,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
if ((dx != 0.0) &&
|
||||
(m_molNumSpecies_old[kspec] > 0.0) &&
|
||||
(doPhaseDeleteIph == -1) &&
|
||||
(doPhaseDeleteIph == npos) &&
|
||||
(m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
double dx_old = dx;
|
||||
|
||||
|
|
@ -935,7 +935,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
L_MAIN_LOOP_END_NO_PRINT: ;
|
||||
#endif
|
||||
if (doPhaseDeleteIph != -1) {
|
||||
if (doPhaseDeleteIph != npos) {
|
||||
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
|
||||
plogf(" --- ");
|
||||
plogf("%-12.12s Main Loop Special Case deleting phase with species: ",
|
||||
|
|
@ -1335,7 +1335,7 @@ namespace VCSnonideal {
|
|||
for (i = 0; i < m_numRxnRdc; ++i) {
|
||||
l = m_indexRxnToSpecies[i];
|
||||
if (m_speciesUnknownType[l] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
for (j = m_numComponents - 1; j != -1; j--) {
|
||||
for (j = m_numComponents - 1; j != npos; j--) {
|
||||
bool doSwap = false;
|
||||
if (m_SSPhase[j]) {
|
||||
doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) >
|
||||
|
|
@ -3198,7 +3198,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (kfound == -1) {
|
||||
if (kfound == npos) {
|
||||
double gmin = 0.0;
|
||||
kfound = k;
|
||||
for (kspec = ncTrial; kspec < m_numSpeciesTot; kspec++) {
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ namespace Cantera {
|
|||
m_rxnstoich->multiplyRevProducts(&m_conc[0], &ropr[0]);
|
||||
//m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
|
||||
|
||||
for (int j = 0; j != m_ii; ++j) {
|
||||
for (size_t j = 0; j != m_ii; ++j) {
|
||||
ropnet[j] = ropf[j] - ropr[j];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ namespace Cantera {
|
|||
m_rxnstoich->multiplyRevProducts(&m_conc[0], &ropr[0]);
|
||||
//m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
|
||||
|
||||
for (int j = 0; j != m_ii; ++j) {
|
||||
for (size_t j = 0; j != m_ii; ++j) {
|
||||
ropnet[j] = ropf[j] - ropr[j];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ namespace Cantera {
|
|||
|
||||
for (size_t i = 0; i < m_nrev; i++) {
|
||||
size_t irxn = m_revindex[i];
|
||||
if (irxn == -1 || irxn >= nReactions()) {
|
||||
if (irxn == npos || irxn >= nReactions()) {
|
||||
throw CanteraError("InterfaceKinetics",
|
||||
"illegal value: irxn = "+int2str(int(irxn)));
|
||||
}
|
||||
|
|
@ -1129,8 +1129,8 @@ namespace Cantera {
|
|||
Kinetics::finalize();
|
||||
m_rwork.resize(nReactions());
|
||||
size_t ks = reactionPhaseIndex();
|
||||
if (ks == -1) throw CanteraError("InterfaceKinetics::finalize",
|
||||
"no surface phase is present.");
|
||||
if (ks == npos) throw CanteraError("InterfaceKinetics::finalize",
|
||||
"no surface phase is present.");
|
||||
m_surf = (SurfPhase*)&thermo(ks);
|
||||
if (m_surf->nDim() != 2)
|
||||
throw CanteraError("InterfaceKinetics::finalize",
|
||||
|
|
@ -1231,8 +1231,8 @@ namespace Cantera {
|
|||
void EdgeKinetics::finalize() {
|
||||
m_rwork.resize(nReactions());
|
||||
size_t ks = reactionPhaseIndex();
|
||||
if (ks == -1) throw CanteraError("EdgeKinetics::finalize",
|
||||
"no edge phase is present.");
|
||||
if (ks == npos) throw CanteraError("EdgeKinetics::finalize",
|
||||
"no edge phase is present.");
|
||||
m_surf = (SurfPhase*)&thermo(ks);
|
||||
if (m_surf->nDim() != 1)
|
||||
throw CanteraError("EdgeKinetics::finalize",
|
||||
|
|
|
|||
|
|
@ -173,9 +173,7 @@ namespace Cantera {
|
|||
* return
|
||||
* - If a match is found, the position in the species list
|
||||
* is returned.
|
||||
* - If a specific phase is specified and no match is found,
|
||||
* the value -1 is returned.
|
||||
* - If no match is found in any phase, the value -2 is returned.
|
||||
* - If no match is found, the value -1 (npos) is returned.
|
||||
*/
|
||||
size_t Kinetics::kineticsSpeciesIndex(std::string nm, std::string ph) const {
|
||||
size_t np = m_thermo.size();
|
||||
|
|
@ -185,7 +183,7 @@ namespace Cantera {
|
|||
id = thermo(n).id();
|
||||
if (ph == id) {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k == -1) return -1;
|
||||
if (k == npos) return npos;
|
||||
return k + m_start[n];
|
||||
}
|
||||
else if (ph == "<any>") {
|
||||
|
|
@ -194,10 +192,10 @@ namespace Cantera {
|
|||
* ThermoPhase object to find a match.
|
||||
*/
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k != -1) return k + m_start[n];
|
||||
if (k != npos) return k + m_start[n];
|
||||
}
|
||||
}
|
||||
return -2;
|
||||
return npos;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -212,7 +210,7 @@ namespace Cantera {
|
|||
string id;
|
||||
for (size_t n = 0; n < np; n++) {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k != -1) return thermo(n);
|
||||
if (k != npos) return thermo(n);
|
||||
}
|
||||
throw CanteraError("speciesPhase", "unknown species "+nm);
|
||||
return thermo(0);
|
||||
|
|
@ -226,7 +224,7 @@ namespace Cantera {
|
|||
* species.
|
||||
*/
|
||||
size_t Kinetics::speciesPhaseIndex(size_t k) {
|
||||
for (size_t n = m_start.size()-1; n != -1; n--) {
|
||||
for (size_t n = m_start.size()-1; n != npos; n--) {
|
||||
if (k >= m_start[n]) {
|
||||
return n;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Cantera {
|
|||
{
|
||||
k2 = m_speciesNumber[i2];
|
||||
flx = netFlow(k1, k2);
|
||||
if (m_local != -1) {
|
||||
if (m_local != npos) {
|
||||
if (k1 != m_local && k2 != m_local) flx = 0.0;
|
||||
}
|
||||
if (flx != 0.0)
|
||||
|
|
@ -383,7 +383,7 @@ namespace Cantera {
|
|||
for (size_t i = 0; i < nPaths(); i++) {
|
||||
p = path(i);
|
||||
flxratio = p->flow()/flmax;
|
||||
if (m_local != -1) {
|
||||
if (m_local != npos) {
|
||||
if (p->begin()->number != m_local
|
||||
&& p->end()->number != m_local) flxratio = 0.0;
|
||||
}
|
||||
|
|
@ -678,7 +678,7 @@ namespace Cantera {
|
|||
size_t nsp = p->nSpecies();
|
||||
size_t mlocal = p->elementIndex(sym);
|
||||
for (size_t kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal != -1) {
|
||||
if (mlocal != npos) {
|
||||
m_atoms(k, m) = p->nAtoms(kp, mlocal);
|
||||
}
|
||||
k++;
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ namespace Cantera {
|
|||
* for the species in all phases defined in the kinetics operator.
|
||||
*/
|
||||
size_t isp = kin.kineticsSpeciesIndex(sp,"<any>");
|
||||
if (isp == -2) {
|
||||
if (isp == npos) {
|
||||
if (rule == 1)
|
||||
return false;
|
||||
else {
|
||||
|
|
@ -1105,7 +1105,7 @@ namespace Cantera {
|
|||
|
||||
// if no phase with this id has been added to
|
||||
//the kinetics manager yet, then add this one
|
||||
if (kin.phaseIndex(phase_id) == -1) {
|
||||
if (kin.phaseIndex(phase_id) == npos) {
|
||||
kin.addPhase(*th[m]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ namespace Cantera {
|
|||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* mask, doublereal rdt) {
|
||||
|
||||
if (jg != -1 && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
if (jg != npos && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
|
||||
// if evaluating a Jacobian, compute the steady-state residual
|
||||
if (jg != -1) rdt = 0.0;
|
||||
if (jg != npos) rdt = 0.0;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -85,7 +85,7 @@ namespace Cantera {
|
|||
size_t jmin, jmax, jpt, j, i;
|
||||
jpt = jg - firstPoint();
|
||||
|
||||
if (jg == -1) { // evaluate all points
|
||||
if (jg == npos) { // evaluate all points
|
||||
jmin = 0;
|
||||
jmax = m_points - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace Cantera {
|
|||
|
||||
// compute nth column of Jacobian
|
||||
for (i = j - 1; i <= j+1; i++) {
|
||||
if (i != -1 && i < m_points) {
|
||||
if (i != npos && i < m_points) {
|
||||
mv = m_resid->nVars(i);
|
||||
iloc = m_resid->loc(i);
|
||||
for (m = 0; m < mv; m++) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Cantera {
|
|||
"-----------------------------------------------------------------";
|
||||
|
||||
const doublereal DampFactor = sqrt(2.0);
|
||||
const int NDAMP = 7;
|
||||
const size_t NDAMP = 7;
|
||||
|
||||
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ namespace Cantera {
|
|||
iok--;
|
||||
size_t nd = r.nDomains();
|
||||
size_t n;
|
||||
for (n = nd-1; n != -1; n--)
|
||||
for (n = nd-1; n != npos; n--)
|
||||
if (iok >= r.start(n)) { break; }
|
||||
Domain1D& dom = r.domain(n);
|
||||
size_t offset = iok - r.start(n);
|
||||
|
|
|
|||
|
|
@ -165,14 +165,14 @@ namespace Cantera {
|
|||
|
||||
// bandwidth of the local block
|
||||
bw1 = d->bandwidth();
|
||||
if (bw1 == -1)
|
||||
if (bw1 == npos)
|
||||
bw1 = 2*d->nComponents() - 1;
|
||||
|
||||
// bandwidth of the block coupling the first point of this
|
||||
// domain to the last point of the previous domain
|
||||
if (i > 0) {
|
||||
bw2 = m_dom[i-1]->bandwidth();
|
||||
if (bw2 == -1)
|
||||
if (bw2 == npos)
|
||||
bw2 = m_dom[i-1]->nComponents();
|
||||
bw2 += d->nComponents() - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ namespace Cantera {
|
|||
// if evaluating a Jacobian, and the global point is outside
|
||||
// the domain of influence for this domain, then skip
|
||||
// evaluating the residual
|
||||
if (jg != -1 && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
if (jg != npos && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
|
||||
// if evaluating a Jacobian, compute the steady-state residual
|
||||
if (jg != -1) rdt = 0.0;
|
||||
if (jg != npos) rdt = 0.0;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -341,7 +341,7 @@ namespace Cantera {
|
|||
size_t jmin, jmax, jpt;
|
||||
jpt = jg - firstPoint();
|
||||
|
||||
if (jg == -1) { // evaluate all points
|
||||
if (jg == npos) { // evaluate all points
|
||||
jmin = 0;
|
||||
jmax = m_points - 1;
|
||||
}
|
||||
|
|
@ -632,10 +632,10 @@ namespace Cantera {
|
|||
// if evaluating a Jacobian, and the global point is outside
|
||||
// the domain of influence for this domain, then skip
|
||||
// evaluating the residual
|
||||
if (jg != -1 && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
if (jg != npos && (jg + 1 < firstPoint() || jg > lastPoint() + 1)) return;
|
||||
|
||||
// if evaluating a Jacobian, compute the steady-state residual
|
||||
if (jg != -1) rdt = 0.0;
|
||||
if (jg != npos) rdt = 0.0;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -645,7 +645,7 @@ namespace Cantera {
|
|||
size_t jmin, jmax, jpt;
|
||||
jpt = jg - firstPoint();
|
||||
|
||||
if (jg == -1) { // evaluate all points
|
||||
if (jg == npos) { // evaluate all points
|
||||
jmin = 0;
|
||||
jmax = m_points - 1;
|
||||
}
|
||||
|
|
@ -1051,7 +1051,7 @@ namespace Cantera {
|
|||
getFloatArray(fa,x,false);
|
||||
if (nm == "u") {
|
||||
writelog("axial velocity ");
|
||||
if ((int) x.size() == np) {
|
||||
if (x.size() == np) {
|
||||
for (j = 0; j < np; j++) {
|
||||
soln[index(0,j)] = x[j];
|
||||
}
|
||||
|
|
@ -1065,7 +1065,7 @@ namespace Cantera {
|
|||
}
|
||||
else if (nm == "V") {
|
||||
writelog("radial velocity ");
|
||||
if ((int) x.size() == np) {
|
||||
if (x.size() == np) {
|
||||
for (j = 0; j < np; j++)
|
||||
soln[index(1,j)] = x[j];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,8 +192,8 @@ namespace Cantera {
|
|||
needJacUpdate();
|
||||
}
|
||||
|
||||
void fixTemperature(int j=-1) {
|
||||
if (j < 0)
|
||||
void fixTemperature(size_t j=npos) {
|
||||
if (j == npos)
|
||||
for (size_t i = 0; i < m_points; i++) {
|
||||
m_do_energy[i] = false;
|
||||
}
|
||||
|
|
@ -207,8 +207,8 @@ namespace Cantera {
|
|||
bool doSpecies(size_t k) { return m_do_species[k]; }
|
||||
bool doEnergy(size_t j) { return m_do_energy[j]; }
|
||||
|
||||
void solveSpecies(int k=-1) {
|
||||
if (k == -1) {
|
||||
void solveSpecies(size_t k=npos) {
|
||||
if (k == npos) {
|
||||
for (size_t i = 0; i < m_nsp; i++)
|
||||
m_do_species[i] = true;
|
||||
}
|
||||
|
|
@ -216,8 +216,8 @@ namespace Cantera {
|
|||
needJacUpdate();
|
||||
}
|
||||
|
||||
void fixSpecies(int k=-1) {
|
||||
if (k == -1) {
|
||||
void fixSpecies(size_t k=npos) {
|
||||
if (k == npos) {
|
||||
for (size_t i = 0; i < m_nsp; i++)
|
||||
m_do_species[i] = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ namespace Cantera {
|
|||
void Inlet1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -285,7 +285,7 @@ namespace Cantera {
|
|||
void Empty1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -343,7 +343,7 @@ namespace Cantera {
|
|||
void Symm1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2< firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2< firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -429,7 +429,7 @@ namespace Cantera {
|
|||
void Outlet1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -565,7 +565,7 @@ namespace Cantera {
|
|||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -669,7 +669,7 @@ namespace Cantera {
|
|||
void Surf1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
@ -766,7 +766,7 @@ namespace Cantera {
|
|||
void ReactingSurf1D::
|
||||
eval(size_t jg, doublereal* xg, doublereal* rg,
|
||||
integer* diagg, doublereal rdt) {
|
||||
if (jg != -1 && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
if (jg != npos && (jg + 2 < firstPoint() || jg > lastPoint() + 2)) return;
|
||||
|
||||
// start of local part of global arrays
|
||||
doublereal* x = xg + loc();
|
||||
|
|
|
|||
|
|
@ -285,8 +285,7 @@ namespace Cantera {
|
|||
//! of the solution and the reference pressure for the species.
|
||||
const array_fp& expGibbs_RT() const {
|
||||
_updateThermo();
|
||||
int k;
|
||||
for (k = 0; k != m_kk; k++) m_expg0_RT[k] = std::exp(m_g0_RT[k]);
|
||||
for (size_t k = 0; k != m_kk; k++) m_expg0_RT[k] = std::exp(m_g0_RT[k]);
|
||||
return m_expg0_RT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ namespace Cantera {
|
|||
const vector_fp &aw = m_Elements->atomicWeights();
|
||||
if (charge != 0.0) {
|
||||
size_t eindex = m_Elements->elementIndex("E");
|
||||
if (eindex != -1) {
|
||||
if (eindex != npos) {
|
||||
doublereal ecomp = compNew[eindex];
|
||||
if (fabs (charge + ecomp) > 0.001) {
|
||||
if (ecomp != 0.0) {
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (m_indexSolvent == -1) {
|
||||
if (m_indexSolvent == npos) {
|
||||
cout << "DebyeHuckel::initThermoXML: Solvent Name not found"
|
||||
<< endl;
|
||||
throw CanteraError("DebyeHuckel::initThermoXML",
|
||||
|
|
@ -1484,7 +1484,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (jmap != -1) {
|
||||
if (jmap != npos) {
|
||||
const XML_Node& sp = *xspecies[jmap];
|
||||
if (sp.hasChild("stoichIsMods")) {
|
||||
double val = getFloat(sp, "stoichIsMods");
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ namespace Cantera {
|
|||
* value applies only to the species with that index.
|
||||
*/
|
||||
doublereal GeneralSpeciesThermo::minTemp(size_t k) const {
|
||||
if (k == -1)
|
||||
if (k == npos)
|
||||
return m_tlow_max;
|
||||
else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
@ -321,7 +321,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::maxTemp(size_t k) const {
|
||||
if (k == -1) {
|
||||
if (k == npos) {
|
||||
return m_thigh_min;
|
||||
} else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
@ -333,7 +333,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::refPressure(size_t k) const {
|
||||
if (k == -1) {
|
||||
if (k == npos) {
|
||||
return m_p0;
|
||||
} else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
string ispName = speciesName(iSpecies);
|
||||
|
|
@ -91,7 +91,7 @@ namespace Cantera {
|
|||
throw CanteraError("HMWSoln::readXMLBinarySalt", "cation charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
string jspName = speciesName(jSpecies);
|
||||
|
|
@ -289,14 +289,14 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaAnion", "anion1 charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] >= 0) {
|
||||
|
|
@ -376,14 +376,14 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaCation", "cation1 charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0) {
|
||||
|
|
@ -467,7 +467,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
if (kSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] <= 0) {
|
||||
|
|
@ -475,7 +475,7 @@ namespace Cantera {
|
|||
"cation charge problem");
|
||||
}
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] >= 0) {
|
||||
|
|
@ -483,7 +483,7 @@ namespace Cantera {
|
|||
"anion1 charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] >= 0) {
|
||||
|
|
@ -613,14 +613,14 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
if (kSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLPsiCommonAnion", "anion charge problem");
|
||||
}
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] <= 0) {
|
||||
|
|
@ -628,7 +628,7 @@ namespace Cantera {
|
|||
"cation1 charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0) {
|
||||
|
|
@ -759,7 +759,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0) {
|
||||
|
|
@ -767,7 +767,7 @@ namespace Cantera {
|
|||
"neutral charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -842,7 +842,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0) {
|
||||
|
|
@ -928,7 +928,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0.0) {
|
||||
|
|
@ -936,7 +936,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0.0) {
|
||||
|
|
@ -944,7 +944,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
if (kSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] >= 0.0) {
|
||||
|
|
@ -1307,7 +1307,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (m_indexSolvent == -1) {
|
||||
if (m_indexSolvent == npos) {
|
||||
std::cout << "HMWSoln::initThermo: Solvent Name not found"
|
||||
<< std::endl;
|
||||
throw CanteraError("HMWSoln::initThermoXML",
|
||||
|
|
@ -1503,7 +1503,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (jmap != -1) {
|
||||
if (jmap != npos) {
|
||||
const XML_Node& sp = *xspecies[jmap];
|
||||
getOptionalFloat(sp, "stoichIsMods", m_speciesCharge_Stoich[k]);
|
||||
// if (sp.hasChild("stoichIsMods")) {
|
||||
|
|
@ -1525,7 +1525,7 @@ namespace Cantera {
|
|||
map<string,string>::const_iterator _b = msIs.begin();
|
||||
for (; _b != msIs.end(); ++_b) {
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
if (kk != -1) {
|
||||
if (kk != npos) {
|
||||
double val = fpValue(_b->second);
|
||||
m_speciesCharge_Stoich[kk] = val;
|
||||
}
|
||||
|
|
@ -1625,7 +1625,7 @@ namespace Cantera {
|
|||
map<string,string>::const_iterator _b = msEST.begin();
|
||||
for (; _b != msEST.end(); ++_b) {
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
if (kk != -1) {
|
||||
if (kk != npos) {
|
||||
string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("HMWSoln::initThermoXML",
|
||||
|
|
|
|||
|
|
@ -806,8 +806,7 @@ namespace Cantera {
|
|||
*/
|
||||
const array_fp& expGibbs_RT_ref() const {
|
||||
_updateThermo();
|
||||
int k;
|
||||
for (k = 0; k != m_kk; k++) m_expg0_RT[k] = std::exp(m_g0_RT[k]);
|
||||
for (size_t k = 0; k != m_kk; k++) m_expg0_RT[k] = std::exp(m_g0_RT[k]);
|
||||
return m_expg0_RT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1023,7 +1023,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (m_indexSolvent == -1) {
|
||||
if (m_indexSolvent == npos) {
|
||||
std::cout << "IdealMolalSoln::initThermo: Solvent Name not found"
|
||||
<< std::endl;
|
||||
throw CanteraError("IdealMolalSoln::initThermo",
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ namespace Cantera {
|
|||
*/
|
||||
void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal *hrt) const {
|
||||
_updateThermo();
|
||||
for (int k = 0; k != m_kk; k++) {
|
||||
for (size_t k = 0; k != m_kk; k++) {
|
||||
hrt[k] = m_h0_RT[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -919,7 +919,7 @@ namespace Cantera {
|
|||
*/
|
||||
void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal *grt) const {
|
||||
_updateThermo();
|
||||
for (int k = 0; k != m_kk; k++) {
|
||||
for (size_t k = 0; k != m_kk; k++) {
|
||||
grt[k] = m_g0_RT[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -933,7 +933,7 @@ namespace Cantera {
|
|||
void IdealSolidSolnPhase::getGibbs_ref(doublereal *g) const {
|
||||
_updateThermo();
|
||||
double tmp = GasConstant * temperature();
|
||||
for (int k = 0; k != m_kk; k++) {
|
||||
for (size_t k = 0; k != m_kk; k++) {
|
||||
g[k] = tmp * m_g0_RT[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -960,7 +960,7 @@ namespace Cantera {
|
|||
*/
|
||||
void IdealSolidSolnPhase::getEntropy_R_ref(doublereal *er) const {
|
||||
_updateThermo();
|
||||
for (int k = 0; k != m_kk; k++) {
|
||||
for (size_t k = 0; k != m_kk; k++) {
|
||||
er[k] = m_s0_R[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -973,7 +973,7 @@ namespace Cantera {
|
|||
*/
|
||||
void IdealSolidSolnPhase::getCp_R_ref(doublereal *cpr) const {
|
||||
_updateThermo();
|
||||
for (int k = 0; k != m_kk; k++) {
|
||||
for (size_t k = 0; k != m_kk; k++) {
|
||||
cpr[k] = m_cp0_R[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -999,8 +999,7 @@ namespace Cantera {
|
|||
*/
|
||||
const array_fp& IdealSolidSolnPhase::expGibbs_RT_ref() const {
|
||||
_updateThermo();
|
||||
int k;
|
||||
for (k = 0; k != m_kk; k++) m_expg0_RT[k] = exp(m_g0_RT[k]);
|
||||
for (size_t k = 0; k != m_kk; k++) m_expg0_RT[k] = exp(m_g0_RT[k]);
|
||||
return m_expg0_RT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ namespace Cantera {
|
|||
break;
|
||||
|
||||
case cIonSolnType_SINGLEANION:
|
||||
for (size_t k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
size_t iLiCl = speciesIndex("LiCl(L)");
|
||||
if (iLiCl == -1) {
|
||||
if (iLiCl == npos) {
|
||||
throw CanteraError("MargulesVPSSTP test1 constructor",
|
||||
"Unable to find LiCl(L)");
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
size_t iKCl = speciesIndex("KCl(L)");
|
||||
if (iKCl == -1) {
|
||||
if (iKCl == npos) {
|
||||
throw CanteraError("MargulesVPSSTP test1 constructor",
|
||||
"Unable to find KCl(L)");
|
||||
}
|
||||
|
|
@ -974,7 +974,7 @@ namespace Cantera {
|
|||
* an error to not find the species
|
||||
*/
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
if (iSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
string ispName = speciesName(iSpecies);
|
||||
|
|
@ -982,7 +982,7 @@ namespace Cantera {
|
|||
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies", "speciesA charge problem");
|
||||
}
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
if (jSpecies == npos) {
|
||||
return;
|
||||
}
|
||||
string jspName = speciesName(jSpecies);
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ namespace Cantera {
|
|||
return -1.0;
|
||||
#else
|
||||
size_t iE = elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
if (iE == npos) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = entropyElement298(iE);
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
// We have failed if we can't find the Cl element index
|
||||
if (eCl == -1) {
|
||||
if (eCl == npos) {
|
||||
return -1;
|
||||
}
|
||||
for (size_t e = 0; e < ne; e++) {
|
||||
|
|
@ -711,8 +711,8 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
// We have failed if we can't find the E element index
|
||||
if (eE == -1) {
|
||||
return -1;
|
||||
if (eE == npos) {
|
||||
return npos;
|
||||
}
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
doublereal nCl = nAtoms(k, eCl);
|
||||
|
|
@ -816,7 +816,7 @@ namespace Cantera {
|
|||
getActivities(&actMolal[0]);
|
||||
|
||||
size_t iHp = speciesIndex("H+");
|
||||
if (iHp != -1) {
|
||||
if (iHp != npos) {
|
||||
double pH = -log(actMolal[iHp]) / log(10.0);
|
||||
sprintf(p, " pH %12.4g \n", pH);
|
||||
s += p;
|
||||
|
|
@ -964,7 +964,7 @@ namespace Cantera {
|
|||
pNames.push_back("Molal Activity");
|
||||
data.push_back(temp);
|
||||
size_t iHp = speciesIndex("H+");
|
||||
if (iHp != -1) {
|
||||
if (iHp != npos) {
|
||||
double pH = -log(temp[iHp]) / log(10.0);
|
||||
csvFile << setw(tabL) << "pH = " << setw(tabS) << pH << endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* Currently the index of the solvent is hard-coded to the value 0
|
||||
*/
|
||||
int m_indexSolvent;
|
||||
size_t m_indexSolvent;
|
||||
|
||||
//! Scaling to be used for output of single-ion species activity
|
||||
//! coefficients.
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ namespace Cantera {
|
|||
h298 = getFloat(Mu0Node, "H298", "actEnergy");
|
||||
}
|
||||
|
||||
int numPoints = 1;
|
||||
size_t numPoints = 1;
|
||||
if (Mu0Node.hasChild("numPoints")) {
|
||||
numPoints = getInteger(Mu0Node, "numPoints");
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@ namespace Cantera {
|
|||
* Fix up dimensionless Mu0 values if input
|
||||
*/
|
||||
if (dimensionlessMu0Values) {
|
||||
for (int i = 0; i < numPoints; i++) {
|
||||
for (size_t i = 0; i < numPoints; i++) {
|
||||
cValues[i] *= cTemperatures[i] / 273.15;
|
||||
}
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ namespace Cantera {
|
|||
|
||||
c[0] = numPoints;
|
||||
c[1] = h298;
|
||||
for (int i = 0; i < numPoints; i++) {
|
||||
for (size_t i = 0; i < numPoints; i++) {
|
||||
c[2+i*2] = cTemperatures[i];
|
||||
c[2+i*2+1] = cValues[i];
|
||||
}
|
||||
|
|
@ -365,7 +365,7 @@ namespace Cantera {
|
|||
mu2 = m_mu0_R_int[iT298];
|
||||
m_h0_R_int[iT298] = m_H298;
|
||||
m_s0_R_int[iT298] = - (mu2 - m_h0_R_int[iT298]) / T2;
|
||||
for (i = iT298 - 1; i != -1; i--) {
|
||||
for (i = iT298 - 1; i != npos; i--) {
|
||||
T1 = m_t0_int[i];
|
||||
mu1 = m_mu0_R_int[i];
|
||||
T2 = m_t0_int[i+1];
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace Cantera {
|
|||
|
||||
if (tlow > m_tlow_max) m_tlow_max = tlow;
|
||||
if (thigh < m_thigh_min) m_thigh_min = thigh;
|
||||
if ((int) m_tlow.size() < index + 1) {
|
||||
if (m_tlow.size() < index + 1) {
|
||||
m_tlow.resize(index + 1, tlow);
|
||||
m_thigh.resize(index + 1, thigh);
|
||||
}
|
||||
|
|
@ -313,8 +313,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal minTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_tlow_max;
|
||||
else
|
||||
return m_tlow[k];
|
||||
|
|
@ -330,8 +330,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal maxTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal maxTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_thigh_min;
|
||||
else
|
||||
return m_thigh[k];
|
||||
|
|
@ -350,7 +350,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal refPressure(size_t k = -1) const {
|
||||
virtual doublereal refPressure(size_t k=npos) const {
|
||||
return m_p0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ namespace Cantera {
|
|||
return -1.0;
|
||||
#else
|
||||
size_t iE = m_tp->elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
if (iE == npos) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = m_tp->entropyElement298(iE);
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void Phase::restoreState(size_t lenstate, const doublereal* state) {
|
||||
if (int(lenstate) >= nSpecies() + 2) {
|
||||
if (lenstate >= nSpecies() + 2) {
|
||||
setMassFractions_NoNorm(state + 2);
|
||||
setTemperature(state[0]);
|
||||
setDensity(state[1]);
|
||||
|
|
@ -312,7 +312,7 @@ namespace Cantera {
|
|||
|
||||
doublereal Phase::moleFraction(std::string name) const {
|
||||
size_t iloc = speciesIndex(name);
|
||||
if (iloc != -1) return State::moleFraction(iloc);
|
||||
if (iloc != npos) return State::moleFraction(iloc);
|
||||
else return 0.0;
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ namespace Cantera {
|
|||
|
||||
doublereal Phase::massFraction(std::string name) const {
|
||||
size_t iloc = speciesIndex(name);
|
||||
if (iloc != -1) return massFractions()[iloc];
|
||||
if (iloc != npos) return massFractions()[iloc];
|
||||
else return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ namespace Cantera {
|
|||
for (k = 0; k < m_kk; k++) {
|
||||
moleFractionsTmp_[k] = moleFractions_[k];
|
||||
}
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (k = 0; k < cationList_.size(); k++) {
|
||||
sumCat += moleFractions_[cationList_[k]];
|
||||
}
|
||||
sumAnion = moleFractions_[anionList_[k]];
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ namespace Cantera {
|
|||
if (tlow > m_tlow_max) m_tlow_max = tlow;
|
||||
if (thigh < m_thigh_min) m_thigh_min = thigh;
|
||||
|
||||
if ((int) m_tlow.size() < index + 1) {
|
||||
if (m_tlow.size() < index + 1) {
|
||||
m_tlow.resize(index + 1, tlow);
|
||||
m_thigh.resize(index + 1, thigh);
|
||||
}
|
||||
|
|
@ -311,8 +311,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal minTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_tlow_max;
|
||||
else
|
||||
return m_tlow[k];
|
||||
|
|
@ -328,8 +328,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal maxTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal maxTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_thigh_min;
|
||||
else
|
||||
return m_thigh[k];
|
||||
|
|
@ -348,7 +348,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal refPressure(size_t k=-1) const {
|
||||
virtual doublereal refPressure(size_t k=npos) const {
|
||||
return m_p0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace Cantera {
|
|||
if (tlow > m_tlow_max) m_tlow_max = tlow;
|
||||
if (thigh < m_thigh_min) m_thigh_min = thigh;
|
||||
|
||||
if ((int) m_tlow.size() < index + 1) {
|
||||
if (m_tlow.size() < index + 1) {
|
||||
m_tlow.resize(index + 1, tlow);
|
||||
m_thigh.resize(index + 1, thigh);
|
||||
}
|
||||
|
|
@ -253,8 +253,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal minTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_tlow_max;
|
||||
else
|
||||
return m_tlow[m_loc[k]];
|
||||
|
|
@ -270,8 +270,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species Index
|
||||
*/
|
||||
virtual doublereal maxTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
virtual doublereal maxTemp(size_t k=npos) const {
|
||||
if (k == npos)
|
||||
return m_thigh_min;
|
||||
else
|
||||
return m_thigh[m_loc[k]];
|
||||
|
|
@ -290,7 +290,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species Index
|
||||
*/
|
||||
virtual doublereal refPressure(size_t k=-1) const {return m_p0;}
|
||||
virtual doublereal refPressure(size_t k=npos) const {return m_p0;}
|
||||
|
||||
//! This utility function reports the type of parameterization
|
||||
//! used for the species with index number index.
|
||||
|
|
@ -344,7 +344,7 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void modifyParams(size_t index, doublereal *c) {
|
||||
size_t loc = m_loc[index];
|
||||
if (loc == -1) {
|
||||
if (loc == npos) {
|
||||
throw CanteraError("SimpleThermo::modifyParams",
|
||||
"modifying parameters for species which hasn't been set yet");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ namespace Cantera {
|
|||
return -1.0;
|
||||
#else
|
||||
size_t iE = th_ptr->elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
if (iE == npos) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = th_ptr->entropyElement298(iE);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
void STITbyPDSS::initAllPtrs(int speciesIndex, VPSSMgr *vpssmgr_ptr, PDSS *PDSS_ptr) {
|
||||
void STITbyPDSS::initAllPtrs(size_t speciesIndex, VPSSMgr *vpssmgr_ptr, PDSS *PDSS_ptr) {
|
||||
AssertThrow(speciesIndex == m_speciesIndex, "STITbyPDSS::initAllPtrs internal confusion");
|
||||
m_vpssmgr_ptr = vpssmgr_ptr;
|
||||
m_PDSS_ptr = PDSS_ptr;
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ namespace Cantera {
|
|||
* @param PDSS_ptr Pointer to the PDSS object that handles calls for this object
|
||||
*
|
||||
*/
|
||||
void initAllPtrs(int speciesIndex, VPSSMgr *vpssmgr_ptr, PDSS *PDSS_ptr);
|
||||
void initAllPtrs(size_t speciesIndex, VPSSMgr *vpssmgr_ptr, PDSS *PDSS_ptr);
|
||||
|
||||
//! Returns the minimum temperature that the thermo
|
||||
//! parameterization is valid
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ namespace Cantera {
|
|||
template<class SPM>
|
||||
doublereal
|
||||
SpeciesThermo1<SPM>::minTemp(size_t k) const {
|
||||
if (k == -1)
|
||||
if (k == npos)
|
||||
return _minTemp(m_thermo.begin(), m_thermo.end());
|
||||
else
|
||||
return m_thermo[k].minTemp();
|
||||
|
|
@ -724,7 +724,7 @@ namespace Cantera {
|
|||
template<class SPM>
|
||||
doublereal
|
||||
SpeciesThermo1<SPM>::maxTemp(size_t k) const {
|
||||
if (k == -1)
|
||||
if (k == npos)
|
||||
return _maxTemp(m_thermo.begin(), m_thermo.end());
|
||||
else
|
||||
return m_thermo[k].maxTemp();
|
||||
|
|
|
|||
|
|
@ -193,16 +193,15 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void State::setConcentrations(const doublereal* const conc) {
|
||||
int k;
|
||||
doublereal sum = 0.0, norm = 0.0;
|
||||
for (k = 0; k != m_kk; ++k) {
|
||||
for (size_t k = 0; k != m_kk; ++k) {
|
||||
sum += conc[k]*m_molwts[k];
|
||||
norm += conc[k];
|
||||
}
|
||||
m_mmw = sum/norm;
|
||||
setDensity(sum);
|
||||
doublereal rsum = 1.0/sum;
|
||||
for (k = 0; k != m_kk; ++k) {
|
||||
for (size_t k = 0; k != m_kk; ++k) {
|
||||
m_ym[k] = conc[k] * rsum;
|
||||
m_y[k] = m_ym[k] * m_molwts[k];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ namespace Cantera {
|
|||
|
||||
/*****************************************************************/
|
||||
doublereal VPSSMgr::minTemp(size_t k) const {
|
||||
if (k != -1) {
|
||||
if (k != npos) {
|
||||
const PDSS *kPDSS = m_vptp_ptr->providePDSS(k);
|
||||
return kPDSS->minTemp();
|
||||
}
|
||||
|
|
@ -437,7 +437,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
doublereal VPSSMgr::maxTemp(size_t k) const {
|
||||
if (k != -1) {
|
||||
if (k != npos) {
|
||||
const PDSS *kPDSS = m_vptp_ptr->providePDSS(k);
|
||||
return kPDSS->maxTemp();
|
||||
}
|
||||
|
|
@ -445,7 +445,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
doublereal VPSSMgr::refPressure(size_t k) const {
|
||||
if (k != -1) {
|
||||
if (k != npos) {
|
||||
const PDSS *kPDSS = m_vptp_ptr->providePDSS(k);
|
||||
return kPDSS->refPressure();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Cantera {
|
|||
"ideal_gas: " + speciesNode.name());
|
||||
}
|
||||
}
|
||||
if ((int) m_Vss.size() < k+1) {
|
||||
if (m_Vss.size() < k+1) {
|
||||
m_Vss.resize(k+1, 0.0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ namespace Cantera {
|
|||
"standardState model for species isn't "
|
||||
"constant_incompressible: " + speciesNode.name());
|
||||
}
|
||||
if ((int) m_Vss.size() < k+1) {
|
||||
if (m_Vss.size() < k+1) {
|
||||
m_Vss.resize(k+1, 0.0);
|
||||
}
|
||||
m_Vss[k] = getFloat(*ss, "molarVolume", "toSI");
|
||||
|
|
|
|||
|
|
@ -213,13 +213,13 @@ namespace Cantera {
|
|||
* a consistent H2O molecular weight based on that.
|
||||
*/
|
||||
size_t nH = elementIndex("H");
|
||||
if (nH == -1) {
|
||||
if (nH == npos) {
|
||||
throw CanteraError("WaterSSTP::initThermo",
|
||||
"H not an element");
|
||||
}
|
||||
double mw_H = atomicWeight(nH);
|
||||
size_t nO = elementIndex("O");
|
||||
if (nO == -1) {
|
||||
if (nO == npos) {
|
||||
throw CanteraError("WaterSSTP::initThermo",
|
||||
"O not an element");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1116,7 +1116,7 @@ namespace Cantera {
|
|||
char s[100];
|
||||
#endif
|
||||
// number of points to use in generating fit data
|
||||
const int np = 50;
|
||||
const size_t np = 50;
|
||||
|
||||
int mode = tr.mode_;
|
||||
int degree = (mode == CK_Mode ? 3 : 4);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ namespace CanteraZeroD {
|
|||
if (nm == "V") return 1;
|
||||
// check for a gas species name
|
||||
size_t k = m_thermo->speciesIndex(nm);
|
||||
if (k != -1) return k + 2;
|
||||
if (k != npos) return k + 2;
|
||||
|
||||
// check for a wall species
|
||||
size_t walloffset = 0, kp = 0;
|
||||
|
|
@ -291,7 +291,7 @@ namespace CanteraZeroD {
|
|||
kp = m_wall[m]->kinetics(m_lr[m])->reactionPhaseIndex();
|
||||
th = &m_wall[m]->kinetics(m_lr[m])->thermo(kp);
|
||||
k = th->speciesIndex(nm);
|
||||
if (k != -1) {
|
||||
if (k != npos) {
|
||||
return k + 2 + m_nsp + walloffset;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace CanteraZeroD {
|
|||
if (nm == "U") return 1;
|
||||
// check for a gas species name
|
||||
size_t k = m_thermo->speciesIndex(nm);
|
||||
if (k != -1) return k + 2;
|
||||
if (k != npos) return k + 2;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace CanteraZeroD {
|
|||
}
|
||||
|
||||
size_t Reactor::nSensParams() {
|
||||
if (m_nsens == -1) {
|
||||
if (m_nsens == npos) {
|
||||
// determine the number of sensitivity parameters
|
||||
size_t m, ns;
|
||||
m_nsens = m_pnum.size();
|
||||
|
|
@ -347,7 +347,7 @@ namespace CanteraZeroD {
|
|||
if (nm == "V") return 1;
|
||||
// check for a gas species name
|
||||
size_t k = m_thermo->speciesIndex(nm);
|
||||
if (k != -1) return k + 2;
|
||||
if (k != npos) return k + 2;
|
||||
|
||||
// check for a wall species
|
||||
size_t walloffset = 0, kp = 0;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace CanteraZeroD {
|
|||
size_t ileft = 0, iright = 0;
|
||||
if (left) {
|
||||
ileft = left->surfacePhaseIndex();
|
||||
if (ileft != -1) {
|
||||
if (ileft != npos) {
|
||||
m_surf[0] = (SurfPhase*)&left->thermo(ileft);
|
||||
m_nsp[0] = m_surf[0]->nSpecies();
|
||||
m_leftcov.resize(m_nsp[0]);
|
||||
|
|
@ -52,14 +52,14 @@ namespace CanteraZeroD {
|
|||
}
|
||||
if (right) {
|
||||
iright = right->surfacePhaseIndex();
|
||||
if (iright != -1) {
|
||||
if (iright != npos) {
|
||||
m_surf[1] = (SurfPhase*)&right->thermo(iright);
|
||||
m_nsp[1] = m_surf[1]->nSpecies();
|
||||
m_rightcov.resize(m_nsp[1]);
|
||||
m_surf[1]->getCoverages(DATA_PTR(m_rightcov));
|
||||
}
|
||||
}
|
||||
if (ileft == -1 || iright == -1) {
|
||||
if (ileft == npos || iright == npos) {
|
||||
throw CanteraError("Wall::setKinetics",
|
||||
"specified surface kinetics manager does not "
|
||||
"represent a surface reaction mechanism.");
|
||||
|
|
|
|||
|
|
@ -1539,7 +1539,7 @@ void strip_item_from_token(int iword, TOKEN *tok)
|
|||
size_t i = ioffset;
|
||||
size_t j = ioffset + ilength;
|
||||
#endif
|
||||
if (j <= (int) strlen(tok->orig_str)) {
|
||||
if (j <= strlen(tok->orig_str)) {
|
||||
while(tok->orig_str[j] != '\0') {
|
||||
tok->orig_str[i] = tok->orig_str[j];
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue