Fixed some problems with the tests caused by the int to size_t conversion
This commit is contained in:
parent
9470103bb2
commit
f2bf17e1b7
10 changed files with 15 additions and 15 deletions
|
|
@ -1038,7 +1038,7 @@ next:
|
|||
}
|
||||
}
|
||||
|
||||
else if (eqloc >= 0 && eqloc < int(s.size())) {
|
||||
else if (eqloc != string::npos && eqloc < s.size()) {
|
||||
if (nRxns > 0) {
|
||||
rxn.number = nRxns;
|
||||
reactions.push_back(rxn);
|
||||
|
|
@ -1062,17 +1062,17 @@ next:
|
|||
// irreversible, and separate it into strings for
|
||||
// each side.
|
||||
|
||||
if (eqloc = int(s.find("<=>")), eqloc >= 0) {
|
||||
if (eqloc = s.find("<=>"), eqloc != string::npos) {
|
||||
rxn.isReversible = true;
|
||||
sleft = s.substr(0, eqloc);
|
||||
sright = s.substr(eqloc+3,1000);
|
||||
}
|
||||
else if (eqloc = int(s.find("=>")), eqloc >= 0) {
|
||||
else if (eqloc = s.find("=>"), eqloc != string::npos) {
|
||||
rxn.isReversible = false;
|
||||
sleft = s.substr(0, eqloc);
|
||||
sright = s.substr(eqloc+2,1000);
|
||||
}
|
||||
else if (eqloc = int(s.find("=")), eqloc >= 0) {
|
||||
else if (eqloc = s.find("="), eqloc != string::npos) {
|
||||
rxn.isReversible = true;
|
||||
sleft = s.substr(0, eqloc);
|
||||
sright = s.substr(eqloc+1,1000);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <vector>
|
||||
|
||||
namespace VCSnonideal {
|
||||
|
||||
using std::size_t;
|
||||
//! A class for 2D double arrays storred in column-major
|
||||
//! (Fortran-compatible) form.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <vector>
|
||||
|
||||
namespace VCSnonideal {
|
||||
|
||||
using std::size_t;
|
||||
//! A class for 2D int arrays storred in column-major
|
||||
//! (Fortran-compatible) form.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1336,7 +1336,7 @@ namespace VCSnonideal {
|
|||
|
||||
kT++;
|
||||
}
|
||||
if (volPhase->phiVarIndex() >= 0) {
|
||||
if (volPhase->phiVarIndex() != -1) {
|
||||
size_t kphi = volPhase->phiVarIndex();
|
||||
size_t kglob = volPhase->spGlobalIndexVCS(kphi);
|
||||
vprob->w[kglob] = tPhase->electricPotential();
|
||||
|
|
|
|||
|
|
@ -1569,7 +1569,7 @@ namespace VCSnonideal {
|
|||
fm[e][k] = tPhase->nAtoms(k, eT);
|
||||
e++;
|
||||
}
|
||||
if (eFound >= 0) {
|
||||
if (eFound != -2) {
|
||||
fm[eFound][k] = - tPhase->charge(k);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3623,7 +3623,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
|
||||
size_t iph = m_phaseID[kspec];
|
||||
size_t irxn = kspec - m_numComponents;
|
||||
int irxn = int(kspec) - int(m_numComponents);
|
||||
vcs_VolPhase *VPhase = m_VolPhaseList[iph];
|
||||
int phaseExist = VPhase->exists();
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace Cantera {
|
|||
* ThermoPhase object to find a match.
|
||||
*/
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k >= 0) return k + m_start[n];
|
||||
if (k != -1) return k + m_start[n];
|
||||
}
|
||||
}
|
||||
return -2;
|
||||
|
|
|
|||
|
|
@ -1107,7 +1107,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) < 0) {
|
||||
if (kin.phaseIndex(phase_id) == -1) {
|
||||
kin.addPhase(*th[m]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace Cantera {
|
|||
* Resize the arrays if necessary, filling the empty
|
||||
* slots with the zero pointer.
|
||||
*/
|
||||
if (index > m_kk - 1) {
|
||||
if (index >= m_kk) {
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ namespace Cantera {
|
|||
"zero pointer");
|
||||
}
|
||||
size_t index = stit_ptr->speciesIndex();
|
||||
if (index > m_kk - 1) {
|
||||
if (index >= m_kk) {
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ int main(int argc, char **argv) {
|
|||
mphase.addPhase(&g, 10.0);
|
||||
mphase.init();
|
||||
int usedZeroedSpecies = 0;
|
||||
vector_int orderVectorSpecies;
|
||||
vector_int orderVectorElements;
|
||||
std::vector<size_t> orderVectorSpecies;
|
||||
std::vector<size_t> orderVectorElements;
|
||||
|
||||
bool doFormMatrix = true;
|
||||
vector_fp formRxnMatrix;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue