Fixed erroneous inequality comparisons between size_t and 0
This commit is contained in:
parent
db2b9636bb
commit
4e2a48c4e5
21 changed files with 34 additions and 38 deletions
|
|
@ -999,7 +999,7 @@ namespace Cantera {
|
||||||
addLogEntry("element "+ s.elementName(m), fp2str(x[m]));
|
addLogEntry("element "+ s.elementName(m), fp2str(x[m]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_eloc >= 0) {
|
if (m_eloc != npos) {
|
||||||
adjustEloc(s, elMolesGoal);
|
adjustEloc(s, elMolesGoal);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
@ -1780,7 +1780,7 @@ namespace Cantera {
|
||||||
if (ChemEquil_print_lvl > 0) {
|
if (ChemEquil_print_lvl > 0) {
|
||||||
if (lumpSum[m]) {
|
if (lumpSum[m]) {
|
||||||
writelogf("Lump summing row %d, due to rank deficiency analysis\n", m);
|
writelogf("Lump summing row %d, due to rank deficiency analysis\n", m);
|
||||||
} else if (sameAsRow >= 0) {
|
} else if (sameAsRow != npos) {
|
||||||
writelogf("Identified that rows %d and %d are the same\n", m, sameAsRow);
|
writelogf("Identified that rows %d and %d are the same\n", m, sameAsRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,7 @@ namespace VCSnonideal {
|
||||||
for (eVP = 0; eVP < volPhase->nElemConstraints(); eVP++) {
|
for (eVP = 0; eVP < volPhase->nElemConstraints(); eVP++) {
|
||||||
e = volPhase->elemGlobalIndex(eVP);
|
e = volPhase->elemGlobalIndex(eVP);
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (e < 0) {
|
if (e == npos) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ namespace VCSnonideal {
|
||||||
iprintTime = m_timing_print_lvl ;
|
iprintTime = m_timing_print_lvl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifunc < 0 || ifunc > 2) {
|
if (ifunc > 2) {
|
||||||
plogf("vcs: Unrecognized value of ifunc, %d: bailing!\n",
|
plogf("vcs: Unrecognized value of ifunc, %d: bailing!\n",
|
||||||
ifunc);
|
ifunc);
|
||||||
return VCS_PUB_BAD;
|
return VCS_PUB_BAD;
|
||||||
|
|
@ -649,7 +649,7 @@ namespace VCSnonideal {
|
||||||
std::vector<size_t> numPhSp(nph, 0);
|
std::vector<size_t> numPhSp(nph, 0);
|
||||||
for (size_t kspec = 0; kspec < nspecies; kspec++) {
|
for (size_t kspec = 0; kspec < nspecies; kspec++) {
|
||||||
size_t iph = pub->PhaseID[kspec];
|
size_t iph = pub->PhaseID[kspec];
|
||||||
if (iph < 0 || iph >= nph) {
|
if (iph >= nph) {
|
||||||
plogf("%sSpecies to Phase Mapping, PhaseID, has a bad value\n",
|
plogf("%sSpecies to Phase Mapping, PhaseID, has a bad value\n",
|
||||||
ser);
|
ser);
|
||||||
plogf("\tPhaseID[%d] = %d\n", kspec, iph);
|
plogf("\tPhaseID[%d] = %d\n", kspec, iph);
|
||||||
|
|
|
||||||
|
|
@ -2062,7 +2062,7 @@ namespace VCSnonideal {
|
||||||
double tmp;
|
double tmp;
|
||||||
double delta = *delta_ptr;
|
double delta = *delta_ptr;
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (irxn < 0) {
|
if (kspec < m_numComponents) {
|
||||||
plogf(" --- delete_species() ERROR: called for a component %d", kspec);
|
plogf(" --- delete_species() ERROR: called for a component %d", kspec);
|
||||||
plogendl();
|
plogendl();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
@ -3173,7 +3173,7 @@ namespace VCSnonideal {
|
||||||
}
|
}
|
||||||
if ((maxConcPossKspec >= maxConcPoss) || (maxConcPossKspec > 1.0E-5)) {
|
if ((maxConcPossKspec >= maxConcPoss) || (maxConcPossKspec > 1.0E-5)) {
|
||||||
if (nonZeroesKspec <= minNonZeroes) {
|
if (nonZeroesKspec <= minNonZeroes) {
|
||||||
if (kfound < 0 || nonZeroesKspec < minNonZeroes) {
|
if (kfound == npos || nonZeroesKspec < minNonZeroes) {
|
||||||
kfound = kspec;
|
kfound = kspec;
|
||||||
} else {
|
} else {
|
||||||
// ok we are sitting pretty equal here decide on the raw ss Gibbs energy
|
// ok we are sitting pretty equal here decide on the raw ss Gibbs energy
|
||||||
|
|
@ -5073,8 +5073,8 @@ namespace VCSnonideal {
|
||||||
VCS_SPECIES_THERMO *st_tmp;
|
VCS_SPECIES_THERMO *st_tmp;
|
||||||
if (k1 == k2) return;
|
if (k1 == k2) return;
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (k1 < 0 || k1 > (m_numSpeciesTot - 1) ||
|
if (k1 > (m_numSpeciesTot - 1) ||
|
||||||
k2 < 0 || k2 > (m_numSpeciesTot - 1) ) {
|
k2 > (m_numSpeciesTot - 1) ) {
|
||||||
plogf("vcs_switch_pos: ifunc = 0: inappropriate args: %d %d\n",
|
plogf("vcs_switch_pos: ifunc = 0: inappropriate args: %d %d\n",
|
||||||
k1, k2);
|
k1, k2);
|
||||||
}
|
}
|
||||||
|
|
@ -5143,8 +5143,8 @@ namespace VCSnonideal {
|
||||||
i1 = k1 - m_numComponents;
|
i1 = k1 - m_numComponents;
|
||||||
i2 = k2 - m_numComponents;
|
i2 = k2 - m_numComponents;
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (i1 < 0 || i1 > (m_numRxnTot - 1) ||
|
if (i1 > (m_numRxnTot - 1) ||
|
||||||
i2 < 0 || i2 > (m_numRxnTot - 1) ) {
|
i2 > (m_numRxnTot - 1) ) {
|
||||||
plogf("switch_pos: ifunc = 1: inappropriate noncomp values: %d %d\n",
|
plogf("switch_pos: ifunc = 1: inappropriate noncomp values: %d %d\n",
|
||||||
i1 , i2);
|
i1 , i2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Cantera {
|
||||||
InterfaceKinetics *kinPtr = k[n];
|
InterfaceKinetics *kinPtr = k[n];
|
||||||
m_vecKinPtrs.push_back(kinPtr);
|
m_vecKinPtrs.push_back(kinPtr);
|
||||||
ns = k[n]->surfacePhaseIndex();
|
ns = k[n]->surfacePhaseIndex();
|
||||||
if (ns < 0)
|
if (ns == npos)
|
||||||
throw CanteraError("ImplicitSurfChem",
|
throw CanteraError("ImplicitSurfChem",
|
||||||
"kinetics manager contains no surface phase");
|
"kinetics manager contains no surface phase");
|
||||||
m_surfindex.push_back(ns);
|
m_surfindex.push_back(ns);
|
||||||
|
|
|
||||||
|
|
@ -1212,7 +1212,7 @@ namespace Cantera {
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
|
||||||
void InterfaceKinetics::setPhaseExistence(const size_t iphase, const bool exists) {
|
void InterfaceKinetics::setPhaseExistence(const size_t iphase, const bool exists) {
|
||||||
if (iphase < 0 || iphase >= m_thermo.size()) {
|
if (iphase >= m_thermo.size()) {
|
||||||
throw CanteraError("InterfaceKinetics:setPhaseExistence", "out of bounds");
|
throw CanteraError("InterfaceKinetics:setPhaseExistence", "out of bounds");
|
||||||
}
|
}
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Cantera {
|
||||||
* "<unknown>" is returned.
|
* "<unknown>" is returned.
|
||||||
*/
|
*/
|
||||||
string Kinetics::kineticsSpeciesName(size_t k) const {
|
string Kinetics::kineticsSpeciesName(size_t k) const {
|
||||||
for (size_t n = m_start.size()-1; n >= 0; n--) {
|
for (size_t n = m_start.size()-1; n != npos; n--) {
|
||||||
if (k >= m_start[n]) {
|
if (k >= m_start[n]) {
|
||||||
return thermo(n).speciesName(k - m_start[n]);
|
return thermo(n).speciesName(k - m_start[n]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -845,7 +845,7 @@ namespace Cantera {
|
||||||
size_t m = m_enamemap[element]-1; //ph.elementIndex(element);
|
size_t m = m_enamemap[element]-1; //ph.elementIndex(element);
|
||||||
|
|
||||||
r.element = element;
|
r.element = element;
|
||||||
if (m < 0) return -1;
|
if (m == npos) return -1;
|
||||||
|
|
||||||
s.getFwdRatesOfProgress(DATA_PTR(m_ropf));
|
s.getFwdRatesOfProgress(DATA_PTR(m_ropf));
|
||||||
s.getRevRatesOfProgress(DATA_PTR(m_ropr));
|
s.getRevRatesOfProgress(DATA_PTR(m_ropr));
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Cantera {
|
||||||
for (size_t n = 0; n < numPossibleSurfPhases; n++) {
|
for (size_t n = 0; n < numPossibleSurfPhases; n++) {
|
||||||
InterfaceKinetics *m_kin = m_objects[n];
|
InterfaceKinetics *m_kin = m_objects[n];
|
||||||
size_t surfPhaseIndex = m_kin->surfacePhaseIndex();
|
size_t surfPhaseIndex = m_kin->surfacePhaseIndex();
|
||||||
if (surfPhaseIndex >= 0) {
|
if (surfPhaseIndex != npos) {
|
||||||
m_numSurfPhases++;
|
m_numSurfPhases++;
|
||||||
m_indexKinObjSurfPhase.push_back(n);
|
m_indexKinObjSurfPhase.push_back(n);
|
||||||
m_kinObjPhaseIDSurfPhase.push_back(surfPhaseIndex);
|
m_kinObjPhaseIDSurfPhase.push_back(surfPhaseIndex);
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace Cantera {
|
||||||
for (m = 0; m < nr; m++) {
|
for (m = 0; m < nr; m++) {
|
||||||
sum = 0.0;
|
sum = 0.0;
|
||||||
for (j = m - m_kl; j <= m + m_ku; j++) {
|
for (j = m - m_kl; j <= m + m_ku; j++) {
|
||||||
if (j >= 0 && j < m_n)
|
if (j < m_n)
|
||||||
sum += _value(m,j)*b[j];
|
sum += _value(m,j)*b[j];
|
||||||
}
|
}
|
||||||
prod[m] = sum;
|
prod[m] = sum;
|
||||||
|
|
@ -105,7 +105,7 @@ namespace Cantera {
|
||||||
for (n = 0; n < nc; n++) {
|
for (n = 0; n < nc; n++) {
|
||||||
sum = 0.0;
|
sum = 0.0;
|
||||||
for (i = n - m_ku; i <= n + m_kl; i++) {
|
for (i = n - m_ku; i <= n + m_kl; i++) {
|
||||||
if (i >= 0 && i < m_n)
|
if (i < m_n)
|
||||||
sum += _value(i,n)*b[i];
|
sum += _value(i,n)*b[i];
|
||||||
}
|
}
|
||||||
prod[n] = sum;
|
prod[n] = sum;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace Cantera {
|
||||||
knew = newmech.speciesIndex(nm);
|
knew = newmech.speciesIndex(nm);
|
||||||
|
|
||||||
// copy this species from the old to the new solution vectors
|
// copy this species from the old to the new solution vectors
|
||||||
if (knew >= 0) {
|
if (knew != npos) {
|
||||||
for (j = 0; j < points; j++) {
|
for (j = 0; j < points; j++) {
|
||||||
newSoln[nv_new*j + 4 + knew] = oldSoln[nv_old*j + 4 + k];
|
newSoln[nv_new*j + 4 + knew] = oldSoln[nv_old*j + 4 + k];
|
||||||
}
|
}
|
||||||
|
|
@ -364,7 +364,7 @@ namespace Cantera {
|
||||||
|
|
||||||
// update thermodynamic properties only if a Jacobian is not
|
// update thermodynamic properties only if a Jacobian is not
|
||||||
// being evaluated
|
// being evaluated
|
||||||
if (jpt < 0) { //if (jpt < 0 || (m_transport_option == c_Multi_Transport)) {
|
if (jpt == npos) { //if (jpt < 0 || (m_transport_option == c_Multi_Transport)) {
|
||||||
updateThermo(x, j0, j1);
|
updateThermo(x, j0, j1);
|
||||||
|
|
||||||
// update transport properties only if a Jacobian is not being
|
// update transport properties only if a Jacobian is not being
|
||||||
|
|
@ -668,7 +668,7 @@ namespace Cantera {
|
||||||
|
|
||||||
// update thermodynamic properties only if a Jacobian is not
|
// update thermodynamic properties only if a Jacobian is not
|
||||||
// being evaluated
|
// being evaluated
|
||||||
if (jpt < 0) {
|
if (jpt == npos) {
|
||||||
updateThermo(x, j0, j1);
|
updateThermo(x, j0, j1);
|
||||||
updateTransport(x, j0, j1);
|
updateTransport(x, j0, j1);
|
||||||
}
|
}
|
||||||
|
|
@ -1097,7 +1097,7 @@ namespace Cantera {
|
||||||
}
|
}
|
||||||
else goto error;
|
else goto error;
|
||||||
}
|
}
|
||||||
else if (m_thermo->speciesIndex(nm) >= 0) {
|
else if (m_thermo->speciesIndex(nm) != npos) {
|
||||||
writelog(nm+" ");
|
writelog(nm+" ");
|
||||||
if (x.size() == np) {
|
if (x.size() == np) {
|
||||||
k = m_thermo->speciesIndex(nm);
|
k = m_thermo->speciesIndex(nm);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Cantera {
|
||||||
|
|
||||||
void Bdry1D::
|
void Bdry1D::
|
||||||
_init(size_t n) {
|
_init(size_t n) {
|
||||||
if (m_index < 0) {
|
if (m_index == npos) {
|
||||||
throw CanteraError("Bdry1D",
|
throw CanteraError("Bdry1D",
|
||||||
"install in container before calling init.");
|
"install in container before calling init.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ namespace Cantera {
|
||||||
* Name of the species with index k
|
* Name of the species with index k
|
||||||
*/
|
*/
|
||||||
string Constituents::speciesName(size_t k) const {
|
string Constituents::speciesName(size_t k) const {
|
||||||
if (k < 0 || k >= nSpecies())
|
if (k >= nSpecies())
|
||||||
throw SpeciesRangeError("Constituents::speciesName",
|
throw SpeciesRangeError("Constituents::speciesName",
|
||||||
k, nSpecies());
|
k, nSpecies());
|
||||||
return m_speciesNames[k];
|
return m_speciesNames[k];
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ namespace Cantera {
|
||||||
AssertThrowMsg(m_entropy298[m] != ENTROPY298_UNKNOWN,
|
AssertThrowMsg(m_entropy298[m] != ENTROPY298_UNKNOWN,
|
||||||
"Elements::entropy298",
|
"Elements::entropy298",
|
||||||
"Entropy at 298 K of element is unknown");
|
"Entropy at 298 K of element is unknown");
|
||||||
AssertTrace(m >= 0 && m < m_mm);
|
AssertTrace(m < m_mm);
|
||||||
return (m_entropy298[m]);
|
return (m_entropy298[m]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -772,7 +772,7 @@ namespace Cantera {
|
||||||
//! Get the id for the next cation
|
//! Get the id for the next cation
|
||||||
icat = cationList_[k];
|
icat = cationList_[k];
|
||||||
jNeut = fm_invert_ionForNeutral[icat];
|
jNeut = fm_invert_ionForNeutral[icat];
|
||||||
if (jNeut >= 0) {
|
if (jNeut != npos) {
|
||||||
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
|
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
|
||||||
AssertTrace(fmij != 0.0);
|
AssertTrace(fmij != 0.0);
|
||||||
NeutralMolecMoleFractions_[jNeut] += moleFractions_[icat] / fmij;
|
NeutralMolecMoleFractions_[jNeut] += moleFractions_[icat] / fmij;
|
||||||
|
|
@ -885,7 +885,7 @@ namespace Cantera {
|
||||||
//! Get the id for the next cation
|
//! Get the id for the next cation
|
||||||
icat = cationList_[k];
|
icat = cationList_[k];
|
||||||
jNeut = fm_invert_ionForNeutral[icat];
|
jNeut = fm_invert_ionForNeutral[icat];
|
||||||
if (jNeut >= 0) {
|
if (jNeut != npos) {
|
||||||
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
|
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
|
||||||
AssertTrace(fmij != 0.0);
|
AssertTrace(fmij != 0.0);
|
||||||
dy[jNeut] += dx[icat] / fmij;
|
dy[jNeut] += dx[icat] / fmij;
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Cantera {
|
||||||
doublereal* s_R) const {
|
doublereal* s_R) const {
|
||||||
//m_vpssmgr_ptr->setState_T(temp);
|
//m_vpssmgr_ptr->setState_T(temp);
|
||||||
m_PDSS_ptr->setTemperature(temp);
|
m_PDSS_ptr->setTemperature(temp);
|
||||||
AssertThrowMsg(m_speciesIndex >= 0, "STITbyPDSS::updatePropertiesTemp",
|
AssertThrowMsg(m_speciesIndex != npos, "STITbyPDSS::updatePropertiesTemp",
|
||||||
"object was probably not installed correctly");
|
"object was probably not installed correctly");
|
||||||
h_RT[m_speciesIndex] = m_PDSS_ptr->enthalpy_RT_ref();
|
h_RT[m_speciesIndex] = m_PDSS_ptr->enthalpy_RT_ref();
|
||||||
cp_R[m_speciesIndex] = m_PDSS_ptr->cp_R_ref();
|
cp_R[m_speciesIndex] = m_PDSS_ptr->cp_R_ref();
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,7 @@ namespace Cantera {
|
||||||
// otherwise, throw an exception
|
// otherwise, throw an exception
|
||||||
map<string,string>::const_iterator _b = comp.begin();
|
map<string,string>::const_iterator _b = comp.begin();
|
||||||
for (; _b != comp.end(); ++_b) {
|
for (; _b != comp.end(); ++_b) {
|
||||||
if (th.elementIndex(_b->first) < 0) {
|
if (th.elementIndex(_b->first) == npos) {
|
||||||
if (rule == 0) {
|
if (rule == 0) {
|
||||||
throw CanteraError("installSpecies",
|
throw CanteraError("installSpecies",
|
||||||
"Species " + s["name"] +
|
"Species " + s["name"] +
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ namespace CanteraZeroD {
|
||||||
* species is not present in the upstream mixture.
|
* species is not present in the upstream mixture.
|
||||||
*/
|
*/
|
||||||
doublereal FlowDevice::outletSpeciesMassFlowRate(size_t k) {
|
doublereal FlowDevice::outletSpeciesMassFlowRate(size_t k) {
|
||||||
if (k < 0 || k >= m_nspout) return 0.0;
|
if (k >= m_nspout) return 0.0;
|
||||||
size_t ki = m_out2in[k];
|
size_t ki = m_out2in[k];
|
||||||
if (ki < 0) return 0.0;
|
if (ki == npos) return 0.0;
|
||||||
return m_mdot * m_in->massFraction(ki);
|
return m_mdot * m_in->massFraction(ki);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ namespace CanteraZeroD {
|
||||||
kp = m_wall[m]->kinetics(m_lr[m])->reactionPhaseIndex();
|
kp = m_wall[m]->kinetics(m_lr[m])->reactionPhaseIndex();
|
||||||
th = &m_wall[m]->kinetics(m_lr[m])->thermo(kp);
|
th = &m_wall[m]->kinetics(m_lr[m])->thermo(kp);
|
||||||
k = th->speciesIndex(nm);
|
k = th->speciesIndex(nm);
|
||||||
if (k >= 0) {
|
if (k != npos) {
|
||||||
return k + 2 + m_nsp + walloffset;
|
return k + 2 + m_nsp + walloffset;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1043,7 +1043,7 @@ AxiStagnBVP::AxiStagnBVP(igthermo_t* ph, int nsp, int points) :
|
||||||
}
|
}
|
||||||
else goto error;
|
else goto error;
|
||||||
}
|
}
|
||||||
else if (m_thermo->speciesIndex(nm) >= 0) {
|
else if (m_thermo->speciesIndex(nm) != npos) {
|
||||||
writelog(nm+" ");
|
writelog(nm+" ");
|
||||||
if ((int) x.size() == np) {
|
if ((int) x.size() == np) {
|
||||||
k = m_thermo->speciesIndex(nm);
|
k = m_thermo->speciesIndex(nm);
|
||||||
|
|
|
||||||
|
|
@ -315,11 +315,7 @@ static double *smalloc(size_t n)
|
||||||
FILE *file;
|
FILE *file;
|
||||||
#endif
|
#endif
|
||||||
double *pntr;
|
double *pntr;
|
||||||
if (n < 0) {
|
if (n == 0) pntr = NULL;
|
||||||
Fprintf(stderr, "smalloc ERROR: Non-positive argument. (%d)\n", int(n));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else if (n == 0) pntr = NULL;
|
|
||||||
else {
|
else {
|
||||||
n = ((n - 1) / 8);
|
n = ((n - 1) / 8);
|
||||||
n = (n + 1) * 8;
|
n = (n + 1) * 8;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue