Fixing compiler warnings, part 3

This commit is contained in:
Ray Speth 2012-01-17 04:10:43 +00:00
parent 69bffa3800
commit 255f1f9b9f
146 changed files with 1135 additions and 1213 deletions

View file

@ -213,7 +213,7 @@ namespace Cantera {
/*! /*!
* A group of species is a subset of the species in a phase. * A group of species is a subset of the species in a phase.
*/ */
typedef vector_int group_t; typedef std::vector<size_t> group_t;
//! typedef for a vector of groups of species. //! typedef for a vector of groups of species.
/*! /*!
* A grouplist of species is a vector of groups. * A grouplist of species is a vector of groups.

View file

@ -173,11 +173,11 @@ namespace ckr {
removeWhiteSpace(s); removeWhiteSpace(s);
// break string into substrings at the '+' characters separating // break string into substrings at the '+' characters separating
// species symbols // species symbols
int i, nn;
bool inplus = true; bool inplus = true;
vector<int> pluses; vector<int> pluses;
vector<string> sp; vector<string> sp;
for (i = n-1; i >= 0; i--) { for (int i = n-1; i >= 0; i--) {
if (!inplus && s[i] == '+') { if (!inplus && s[i] == '+') {
pluses.push_back(i); pluses.push_back(i);
inplus = true; inplus = true;
@ -187,9 +187,9 @@ namespace ckr {
} }
} }
pluses.push_back(-1); pluses.push_back(-1);
int np = pluses.size(); size_t np = pluses.size();
int loc, nxt; size_t loc, nxt;
for (nn = 0; nn < np; nn++) { for (size_t nn = 0; nn < np; nn++) {
loc = pluses.back(); loc = pluses.back();
pluses.pop_back(); pluses.pop_back();
if (nn == np-1) nxt = s.size(); if (nn == np-1) nxt = s.size();
@ -197,11 +197,10 @@ namespace ckr {
sp.push_back(s.substr(loc+1,nxt-loc-1)); sp.push_back(s.substr(loc+1,nxt-loc-1));
} }
int ns = sp.size();
string r, num; string r, num;
int sz, j, strt=0; size_t sz, j, strt=0;
RxnSpecies ss; RxnSpecies ss;
for (nn = 0; nn < ns; nn++) { for (size_t nn = 0; nn < sp.size(); nn++) {
r = sp[nn]; r = sp[nn];
sz = r.size(); sz = r.size();
for (j = 0; j < sz; j++) { for (j = 0; j < sz; j++) {
@ -633,10 +632,10 @@ next:
// t1 t2 t3 t4 date // t1 t2 t3 t4 date
// when there are 3 temperature regions // when there are 3 temperature regions
// //
int nreg = toks.size() - 2; size_t nreg = toks.size() - 2;
if (nreg >= 1) { if (nreg >= 1) {
temp.resize(nreg+1); temp.resize(nreg+1);
for (int i = 0; i <= nreg; i++) { for (size_t i = 0; i <= nreg; i++) {
temp[i] = de_atof(toks[i]); temp[i] = de_atof(toks[i]);
} }
string defaultDate = toks[nreg+1]; string defaultDate = toks[nreg+1];
@ -984,7 +983,6 @@ next:
// rxn line // rxn line
//string::size_type eqloc; //string::size_type eqloc;
int eqloc;
string sleft, sright; string sleft, sright;
bool auxDataLine, metaDataLine; bool auxDataLine, metaDataLine;
@ -994,14 +992,14 @@ next:
// increment the number of reactions, and start processing the // increment the number of reactions, and start processing the
// new reaction. // new reaction.
eqloc = s.find_first_of("="); size_t eqloc = s.find_first_of("=");
metaDataLine = false; metaDataLine = false;
auxDataLine = false; auxDataLine = false;
// look for a metadata line // look for a metadata line
if (s[0] == '%') { if (s[0] == '%') {
metaDataLine = true; metaDataLine = true;
if (eqloc > 0 && eqloc < int(s.size())) { if (eqloc > 0 && eqloc < s.size()) {
int ierr, ierp; int ierr, ierp;
vector<grouplist_t> rg, pg; vector<grouplist_t> rg, pg;
s[eqloc] = ' '; s[eqloc] = ' ';

View file

@ -354,7 +354,7 @@ bool CKReader::writeReactions(std::ostream& log) {
bool CKReader::validateSpecies(std::ostream& log) { bool CKReader::validateSpecies(std::ostream& log) {
int nel = static_cast<int>(elements.size()); int nel = static_cast<int>(elements.size());
int nsp = static_cast<int>(species.size()); int nsp = static_cast<int>(species.size());
double nm, tol; double tol;
int j, k, m; int j, k, m;
log << newTask("validating species"); log << newTask("validating species");
@ -382,7 +382,7 @@ bool CKReader::validateSpecies(std::ostream& log) {
Species& s = species[k]; Species& s = species[k];
getMapKeys(s.comp, esyms); getMapKeys(s.comp, esyms);
nm = esyms.size(); size_t nm = esyms.size();
for (m = 0; m < nm; m++) { for (m = 0; m < nm; m++) {
for (j = 0; j < nel; j++) { for (j = 0; j < nel; j++) {

View file

@ -192,8 +192,7 @@ namespace ckr {
string s; string s;
vector<string> toks; vector<string> toks;
string defaultDate=""; string defaultDate="";
int nreg = 2; size_t nreg = 2;
int i;
int nsp = static_cast<int>(names.size()); int nsp = static_cast<int>(names.size());
@ -210,10 +209,10 @@ namespace ckr {
if (optionFlag == NoThermoDatabase || optionFlag == HasTempRange) { if (optionFlag == NoThermoDatabase || optionFlag == HasTempRange) {
getCKLine(s, comment); getCKLine(s, comment);
getTokens(s, static_cast<int>(s.size()), toks); getTokens(s, static_cast<int>(s.size()), toks);
nreg = toks.size(); size_t nreg = toks.size();
if (nreg >= 1) { if (nreg >= 1) {
temp.resize(nreg+1); temp.resize(nreg+1);
for (i = 0; i <= nreg; i++) { for (size_t i = 0; i <= nreg; i++) {
temp[i] = de_atof(toks[i]); temp[i] = de_atof(toks[i]);
} }
defaultDate = toks[nreg+1]; defaultDate = toks[nreg+1];
@ -224,7 +223,7 @@ namespace ckr {
log.precision(2); log.precision(2);
log << endl << " Default # of temperature regions: " << nreg << endl; log << endl << " Default # of temperature regions: " << nreg << endl;
log << " "; log << " ";
for (i = 0; i <= nreg; i++) { for (size_t i = 0; i <= nreg; i++) {
log << temp[i] << " "; log << temp[i] << " ";
} }
log << endl; log << endl;
@ -324,7 +323,7 @@ namespace ckr {
// Name of the species // Name of the species
string nameid; string nameid;
vector<string> toks; vector<string> toks;
int nToks = 0; size_t nToks = 0;
// Loop forward until we get to the next nonempty line. // Loop forward until we get to the next nonempty line.
do { do {
@ -343,7 +342,7 @@ namespace ckr {
//------------- line 1 --------------------------- //------------- line 1 ---------------------------
// Everything after the first 18 spaces is a comment. // Everything after the first 18 spaces is a comment.
int nt = s.size(); size_t nt = s.size();
sp.m_commentsRef = s.substr(18, nt-18); sp.m_commentsRef = s.substr(18, nt-18);
// Parse the species name // Parse the species name

View file

@ -33,8 +33,7 @@ namespace ckr {
} }
void Species::delR() { void Species::delR() {
int iReg = region_coeffs.size(); for (size_t i = 0; i < region_coeffs.size(); i++) {
for (int i = 0; i < iReg; i++) {
if (region_coeffs[i]) { if (region_coeffs[i]) {
delete region_coeffs[i]; delete region_coeffs[i];
region_coeffs[i] = 0; region_coeffs[i] = 0;
@ -68,8 +67,7 @@ namespace ckr {
lowCoeffs = s.lowCoeffs; lowCoeffs = s.lowCoeffs;
highCoeffs = s.highCoeffs; highCoeffs = s.highCoeffs;
delR(); delR();
int iReg = s.region_coeffs.size(); for (size_t i = 0; i < s.region_coeffs.size(); i++) {
for (int i = 0; i < iReg; i++) {
region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i]))); region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i])));
} }
minTemps = s.minTemps; minTemps = s.minTemps;

View file

@ -139,16 +139,16 @@ namespace pip {
const std::vector<vector_fp *> &region_coeffs, const std::vector<vector_fp *> &region_coeffs,
const vector_fp &minTemps, const vector_fp &maxTemps) const vector_fp &minTemps, const vector_fp &maxTemps)
{ {
int nReg = region_coeffs.size(); size_t nReg = region_coeffs.size();
if ((int) minTemps.size() != nReg) { if (minTemps.size() != nReg) {
throw CanteraError("addNASA9", "incompat"); throw CanteraError("addNASA9", "incompat");
} }
if ((int) maxTemps.size() != nReg) { if (maxTemps.size() != nReg) {
throw CanteraError("addNASA9", "incompat"); throw CanteraError("addNASA9", "incompat");
} }
fprintf(f," thermo = (\n"); fprintf(f," thermo = (\n");
for (int i = 0; i < nReg; i++) { for (size_t i = 0; i < nReg; i++) {
double minT = minTemps[i]; double minT = minTemps[i];
double maxT = maxTemps[i]; double maxT = maxTemps[i];
const vector_fp &coeffs = *(region_coeffs[i]); const vector_fp &coeffs = *(region_coeffs[i]);
@ -403,11 +403,10 @@ namespace pip {
if (rxn.isDuplicate) { if (rxn.isDuplicate) {
options.push_back("duplicate"); options.push_back("duplicate");
} }
int nopt = options.size(); size_t nopt = options.size();
if (nopt > 0) { if (nopt > 0) {
fprintf(f, ",\n options = ["); fprintf(f, ",\n options = [");
int n; for (size_t n = 0; n < nopt; n++) {
for (n = 0; n < nopt; n++) {
fprintf(f, "\"%s\"", options[n].c_str()); fprintf(f, "\"%s\"", options[n].c_str());
if (n < nopt-1) fprintf(f, ", "); if (n < nopt-1) fprintf(f, ", ");
} }

View file

@ -83,14 +83,12 @@ namespace ckr {
/// print the rate coefficient parameters /// print the rate coefficient parameters
bool writeRateCoeff(const RateCoeff& k, std::ostream& log) { bool writeRateCoeff(const RateCoeff& k, std::ostream& log) {
log.precision(10); log.precision(10);
log.width(0); log.width(0);
log.flags(ios::uppercase); log.flags(ios::uppercase);
int n;
bool ok = true; bool ok = true;
int nb; size_t nb;
switch (k.type) { switch (k.type) {
@ -109,7 +107,7 @@ namespace ckr {
log <<" A, n, E = (" << k.A << ", " << k.n log <<" A, n, E = (" << k.A << ", " << k.n
<< ", " << k.E << ") *** JAN *** " << endl; << ", " << k.E << ") *** JAN *** " << endl;
nb = k.b.size(); nb = k.b.size();
for (n = 0; n < nb; n++) { for (size_t n = 0; n < nb; n++) {
log << " b" << n+1 << ": " << k.b[n] << endl; log << " b" << n+1 << ": " << k.b[n] << endl;
} }
if (nb != 9) log if (nb != 9) log
@ -121,7 +119,7 @@ namespace ckr {
log <<" A, n, E = (" << k.A << ", " << k.n log <<" A, n, E = (" << k.A << ", " << k.n
<< ", " << k.E << ") *** FIT1 *** " << endl; << ", " << k.E << ") *** FIT1 *** " << endl;
nb = k.b.size(); nb = k.b.size();
for (n = 0; n < nb; n++) { for (size_t n = 0; n < nb; n++) {
log << " b" << n+1 << ": " << k.b[n] << endl; log << " b" << n+1 << ": " << k.b[n] << endl;
} }
if (nb != 9) log if (nb != 9) log

View file

@ -20,9 +20,9 @@ namespace Cantera {
static void print_stringTrunc(const char *str, int space, int alignment); static void print_stringTrunc(const char *str, int space, int alignment);
#endif #endif
static int amax(double *x, int j, int n); static size_t amax(double *x, size_t j, size_t n);
static void switch_pos(vector_int &orderVector, int jr, int kspec); static void switch_pos(std::vector<size_t>& orderVector, size_t jr, size_t kspec);
static int mlequ(double *c, int idem, int n, double *b, int m); static int mlequ(double *c, size_t idem, size_t n, double *b, size_t m);
//@{ //@{
#ifndef MIN #ifndef MIN
@ -75,30 +75,30 @@ static int mlequ(double *c, int idem, int n, double *b, int m);
* *
* *
*/ */
int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn, size_t Cantera::BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
MultiPhase *mphase, vector_int & orderVectorSpecies, MultiPhase* mphase, std::vector<size_t>& orderVectorSpecies,
vector_int & orderVectorElements, std::vector<size_t>& orderVectorElements,
vector_fp & formRxnMatrix) { vector_fp& formRxnMatrix) {
int j, jj, k=0, kk, l, i, jl, ml; size_t j, jj, k=0, kk, l, i, jl, ml;
bool lindep; bool lindep;
std::string ename; std::string ename;
std::string sname; std::string sname;
/* /*
* Get the total number of elements defined in the multiphase object * Get the total number of elements defined in the multiphase object
*/ */
int ne = mphase->nElements(); size_t ne = mphase->nElements();
/* /*
* Get the total number of species in the multiphase object * Get the total number of species in the multiphase object
*/ */
int nspecies = mphase->nSpecies(); size_t nspecies = mphase->nSpecies();
doublereal tmp; doublereal tmp;
doublereal const USEDBEFORE = -1; doublereal const USEDBEFORE = -1;
/* /*
* Perhaps, initialize the element ordering * Perhaps, initialize the element ordering
*/ */
if ((int) orderVectorElements.size() < ne) { if (orderVectorElements.size() < ne) {
orderVectorElements.resize(ne); orderVectorElements.resize(ne);
for (j = 0; j < ne; j++) { for (j = 0; j < ne; j++) {
orderVectorElements[j] = j; orderVectorElements[j] = j;
@ -108,7 +108,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
/* /*
* Perhaps, initialize the species ordering * Perhaps, initialize the species ordering
*/ */
if ((int) orderVectorSpecies.size() != nspecies) { if (orderVectorSpecies.size() != nspecies) {
orderVectorSpecies.resize(nspecies); orderVectorSpecies.resize(nspecies);
for (k = 0; k < nspecies; k++) { for (k = 0; k < nspecies; k++) {
orderVectorSpecies[k] = k; orderVectorSpecies[k] = k;
@ -158,8 +158,8 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
* It's equal to the minimum of the number of elements and the * It's equal to the minimum of the number of elements and the
* number of total species. * number of total species.
*/ */
int nComponents = MIN(ne, nspecies); size_t nComponents = MIN(ne, nspecies);
int nNonComponents = nspecies - nComponents; size_t nNonComponents = nspecies - nComponents;
/* /*
* Set this return variable to false * Set this return variable to false
*/ */
@ -177,7 +177,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
vector_fp sm(ne*ne, 0.0); vector_fp sm(ne*ne, 0.0);
vector_fp ss(ne, 0.0); vector_fp ss(ne, 0.0);
vector_fp sa(ne, 0.0); vector_fp sa(ne, 0.0);
if ((int) formRxnMatrix.size() < nspecies*ne) { if (formRxnMatrix.size() < nspecies*ne) {
formRxnMatrix.resize(nspecies*ne, 0.0); formRxnMatrix.resize(nspecies*ne, 0.0);
} }
@ -189,7 +189,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
#endif #endif
int jr = -1; size_t jr = -1;
/* /*
* Top of a loop of some sort based on the index JR. JR is the * Top of a loop of some sort based on the index JR. JR is the
* current number of component species found. * current number of component species found.
@ -367,8 +367,8 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
* Use Gauss-Jordon block elimination to calculate * Use Gauss-Jordon block elimination to calculate
* the reaction matrix * the reaction matrix
*/ */
j = mlequ(DATA_PTR(sm), ne, nComponents, DATA_PTR(formRxnMatrix), nNonComponents); int ierr = mlequ(DATA_PTR(sm), ne, nComponents, DATA_PTR(formRxnMatrix), nNonComponents);
if (j == 1) { if (ierr == 1) {
writelog("ERROR: mlequ returned an error condition\n"); writelog("ERROR: mlequ returned an error condition\n");
throw CanteraError("basopt", "mlequ returned an error condition"); throw CanteraError("basopt", "mlequ returned an error condition");
} }
@ -467,16 +467,15 @@ static void print_stringTrunc(const char *str, int space, int alignment)
* Finds the location of the maximum component in a double vector * Finds the location of the maximum component in a double vector
* INPUT * INPUT
* x(*) - Vector to search * x(*) - Vector to search
* j <= i < n : i is the range of indecises to search in X(*) * j <= i < n : i is the range of indices to search in X(*)
* *
* RETURN * RETURN
* return index of the greatest value on X(*) searched * return index of the greatest value on X(*) searched
*/ */
static int amax(double *x, int j, int n) { static size_t amax(double *x, size_t j, size_t n) {
int i; size_t largest = j;
int largest = j;
double big = x[j]; double big = x[j];
for (i = j + 1; i < n; ++i) { for (size_t i = j + 1; i < n; ++i) {
if (x[i] > big) { if (x[i] > big) {
largest = i; largest = i;
big = x[i]; big = x[i];
@ -486,8 +485,8 @@ static int amax(double *x, int j, int n) {
} }
static void switch_pos(vector_int &orderVector, int jr, int kspec) { static void switch_pos(std::vector<size_t>& orderVector, size_t jr, size_t kspec) {
int kcurr = orderVector[jr]; size_t kcurr = orderVector[jr];
orderVector[jr] = orderVector[kspec]; orderVector[jr] = orderVector[kspec];
orderVector[kspec] = kcurr; orderVector[kspec] = kcurr;
} }
@ -520,8 +519,8 @@ static int amax(double *x, int j, int n) {
* *
* The solution is returned in the matrix b. * The solution is returned in the matrix b.
*/ */
static int mlequ(double *c, int idem, int n, double *b, int m) { static int mlequ(double *c, size_t idem, size_t n, double *b, size_t m) {
int i, j, k, l; size_t i, j, k, l;
double R; double R;
/* /*
@ -603,20 +602,20 @@ static int amax(double *x, int j, int n) {
* formular matrix. This guarrantees that BasisOptimize has a * formular matrix. This guarrantees that BasisOptimize has a
* nonsingular matrix to invert. * nonsingular matrix to invert.
*/ */
int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances, size_t Cantera::ElemRearrange(size_t nComponents, const vector_fp & elementAbundances,
MultiPhase *mphase, MultiPhase *mphase,
vector_int & orderVectorSpecies, std::vector<size_t>& orderVectorSpecies,
vector_int & orderVectorElements) { std::vector<size_t>& orderVectorElements) {
int j, k, l, i, jl, ml, jr, ielem, jj, kk=0; size_t j, k, l, i, jl, ml, jr, ielem, jj, kk=0;
bool lindep = false; bool lindep = false;
int nelements = mphase->nElements(); size_t nelements = mphase->nElements();
std::string ename; std::string ename;
/* /*
* Get the total number of species in the multiphase object * Get the total number of species in the multiphase object
*/ */
int nspecies = mphase->nSpecies(); size_t nspecies = mphase->nSpecies();
double test = -1.0E10; double test = -1.0E10;
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
@ -631,7 +630,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
/* /*
* Perhaps, initialize the element ordering * Perhaps, initialize the element ordering
*/ */
if ((int) orderVectorElements.size() < nelements) { if (orderVectorElements.size() < nelements) {
orderVectorElements.resize(nelements); orderVectorElements.resize(nelements);
for (j = 0; j < nelements; j++) { for (j = 0; j < nelements; j++) {
orderVectorElements[j] = j; orderVectorElements[j] = j;
@ -643,7 +642,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
* dangerous, as this ordering is assumed to yield the * dangerous, as this ordering is assumed to yield the
* component species for the problem * component species for the problem
*/ */
if ((int) orderVectorSpecies.size() != nspecies) { if (orderVectorSpecies.size() != nspecies) {
orderVectorSpecies.resize(nspecies); orderVectorSpecies.resize(nspecies);
for (k = 0; k < nspecies; k++) { for (k = 0; k < nspecies; k++) {
orderVectorSpecies[k] = k; orderVectorSpecies[k] = k;
@ -657,7 +656,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
* end of the element ordering. * end of the element ordering.
*/ */
vector_fp eAbund(nelements,0.0); vector_fp eAbund(nelements,0.0);
if ((int) elementAbundances.size() != nelements) { if (elementAbundances.size() != nelements) {
for (j = 0; j < nelements; j++) { for (j = 0; j < nelements; j++) {
eAbund[j] = 0.0; eAbund[j] = 0.0;
for (k = 0; k < nspecies; k++) { for (k = 0; k < nspecies; k++) {

View file

@ -350,7 +350,7 @@ namespace Cantera {
m_orderVectorElements, formRxnMatrix); m_orderVectorElements, formRxnMatrix);
for (size_t m = 0; m < m_nComponents; m++) { for (size_t m = 0; m < m_nComponents; m++) {
int k = m_orderVectorSpecies[m]; size_t k = m_orderVectorSpecies[m];
m_component[m] = k; m_component[m] = k;
if (xMF_est[k] < 1.0E-8) { if (xMF_est[k] < 1.0E-8) {
xMF_est[k] = 1.0E-8; xMF_est[k] = 1.0E-8;
@ -359,8 +359,8 @@ namespace Cantera {
s.setMoleFractions(DATA_PTR(xMF_est)); s.setMoleFractions(DATA_PTR(xMF_est));
s.getMoleFractions(DATA_PTR(xMF_est)); s.getMoleFractions(DATA_PTR(xMF_est));
int nct = Cantera::ElemRearrange(m_nComponents, elMolesGoal, mp, size_t nct = Cantera::ElemRearrange(m_nComponents, elMolesGoal, mp,
m_orderVectorSpecies, m_orderVectorElements); m_orderVectorSpecies, m_orderVectorElements);
if (nct != m_nComponents) { if (nct != m_nComponents) {
throw CanteraError("ChemEquil::estimateElementPotentials", throw CanteraError("ChemEquil::estimateElementPotentials",
"confused"); "confused");
@ -494,7 +494,6 @@ namespace Cantera {
{ {
doublereal xval, yval, tmp; doublereal xval, yval, tmp;
int fail = 0; int fail = 0;
int m, im;
if (m_p1) delete m_p1; if (m_p1) delete m_p1;
if (m_p2) delete m_p2; if (m_p2) delete m_p2;
@ -581,8 +580,8 @@ namespace Cantera {
xval = m_p1->value(s); xval = m_p1->value(s);
yval = m_p2->value(s); yval = m_p2->value(s);
int mm = m_mm; size_t mm = m_mm;
int nvar = mm + 1; size_t nvar = mm + 1;
DenseMatrix jac(nvar, nvar); // jacobian DenseMatrix jac(nvar, nvar); // jacobian
vector_fp x(nvar, -102.0); // solution vector vector_fp x(nvar, -102.0); // solution vector
vector_fp res_trial(nvar, 0.0); // residual vector_fp res_trial(nvar, 0.0); // residual
@ -594,8 +593,9 @@ namespace Cantera {
* We choose the equation of the element with the highest element * We choose the equation of the element with the highest element
* abundance. * abundance.
*/ */
size_t m;
tmp = -1.0; tmp = -1.0;
for (im = 0; im < m_nComponents; im++) { for (size_t im = 0; im < m_nComponents; im++) {
m = m_orderVectorElements[im]; m = m_orderVectorElements[im];
if (elMolesGoal[m] > tmp ) { if (elMolesGoal[m] > tmp ) {
m_skip = m; m_skip = m;
@ -612,7 +612,7 @@ namespace Cantera {
// changing the composition at this point only affects the // changing the composition at this point only affects the
// starting point, not the final solution. // starting point, not the final solution.
vector_fp xmm(m_kk, 0.0); vector_fp xmm(m_kk, 0.0);
for (int k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
xmm[k] = s.moleFraction(k) + 1.0E-32; xmm[k] = s.moleFraction(k) + 1.0E-32;
} }
s.setMoleFractions(DATA_PTR(xmm)); s.setMoleFractions(DATA_PTR(xmm));
@ -1115,15 +1115,14 @@ namespace Cantera {
if (loglevel > 0) { if (loglevel > 0) {
beginLogGroup("ChemEquil::equilResidual"); beginLogGroup("ChemEquil::equilResidual");
} }
int n, m;
doublereal xx, yy; doublereal xx, yy;
doublereal temp = exp(x[m_mm]); doublereal temp = exp(x[m_mm]);
setToEquilState(s, x, temp); setToEquilState(s, x, temp);
// residuals are the total element moles // residuals are the total element moles
vector_fp& elmFrac = m_elementmolefracs; vector_fp& elmFrac = m_elementmolefracs;
for (n = 0; n < m_mm; n++) { for (size_t n = 0; n < m_mm; n++) {
m = m_orderVectorElements[n]; size_t m = m_orderVectorElements[n];
// drive element potential for absent elements to -1000 // drive element potential for absent elements to -1000
if (elmFracGoal[m] < m_elemFracCutoff && m != m_eloc) { if (elmFracGoal[m] < m_elemFracCutoff && m != m_eloc) {
resid[m] = x[m] + 1000.0; resid[m] = x[m] + 1000.0;
@ -1320,9 +1319,9 @@ namespace Cantera {
s.saveState(state); s.saveState(state);
double tmp, sum; double tmp, sum;
bool modifiedMatrix = false; bool modifiedMatrix = false;
int neq = m_mm+1; size_t neq = m_mm+1;
int retn = 1; int retn = 1;
int m, n, k, info, im; size_t m, n, k, im;
DenseMatrix a1(neq, neq, 0.0); DenseMatrix a1(neq, neq, 0.0);
vector_fp b(neq, 0.0); vector_fp b(neq, 0.0);
vector_fp n_i(m_kk,0.0); vector_fp n_i(m_kk,0.0);
@ -1484,7 +1483,7 @@ namespace Cantera {
/* /*
* Decide if we are to do a normal step or a modified step * Decide if we are to do a normal step or a modified step
*/ */
int iM = -1; size_t iM = -1;
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
if (elMoles[m] > 0.001 * elMolesTotal) { if (elMoles[m] > 0.001 * elMolesTotal) {
if (eMolesCalc[m] > 1000. * elMoles[m]) { if (eMolesCalc[m] > 1000. * elMoles[m]) {
@ -1571,8 +1570,8 @@ namespace Cantera {
} }
#endif #endif
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
int kMSp = -1; size_t kMSp = -1;
int kMSp2 = -1; size_t kMSp2 = -1;
int nSpeciesWithElem = 0; int nSpeciesWithElem = 0;
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {
if (n_i_calc[k] > nCutoff) { if (n_i_calc[k] > nCutoff) {
@ -1815,7 +1814,7 @@ namespace Cantera {
#endif #endif
try { try {
info = solve(a1, DATA_PTR(resid)); int info = solve(a1, DATA_PTR(resid));
} }
catch (CanteraError) { catch (CanteraError) {
addLogEntry("estimateEP_Brinkley:Jacobian is singular."); addLogEntry("estimateEP_Brinkley:Jacobian is singular.");
@ -1904,7 +1903,7 @@ namespace Cantera {
* *
*/ */
void ChemEquil::adjustEloc(thermo_t &s, vector_fp & elMolesGoal) { void ChemEquil::adjustEloc(thermo_t &s, vector_fp & elMolesGoal) {
if (m_eloc < 0) return; if (m_eloc == -1) return;
if (fabs(elMolesGoal[m_eloc]) > 1.0E-20) return; if (fabs(elMolesGoal[m_eloc]) > 1.0E-20) return;
s.getMoleFractions(DATA_PTR(m_molefractions)); s.getMoleFractions(DATA_PTR(m_molefractions));
int k; int k;

View file

@ -176,7 +176,7 @@ namespace Cantera {
* This is equal to the rank of the stoichiometric coefficient * This is equal to the rank of the stoichiometric coefficient
* matrix when it is computed. It's initialized to m_mm. * matrix when it is computed. It's initialized to m_mm.
*/ */
int m_nComponents; size_t m_nComponents;
PropertyCalculator<thermo_t> *m_p1, *m_p2; PropertyCalculator<thermo_t> *m_p1, *m_p2;
@ -237,8 +237,8 @@ namespace Cantera {
bool m_doResPerturb; bool m_doResPerturb;
vector_int m_orderVectorElements; std::vector<size_t> m_orderVectorElements;
vector_int m_orderVectorSpecies; std::vector<size_t> m_orderVectorSpecies;
}; };

View file

@ -124,7 +124,7 @@ namespace Cantera {
void MultiPhase::init() { void MultiPhase::init() {
if (m_init) return; if (m_init) return;
index_t ip, kp, k = 0, nsp, m; index_t ip, kp, k = 0, nsp, m;
int mlocal; size_t mlocal;
string sym; string sym;
// allocate space for the atomic composition matrix // allocate space for the atomic composition matrix
@ -144,7 +144,7 @@ namespace Cantera {
nsp = p->nSpecies(); nsp = p->nSpecies();
mlocal = p->elementIndex(sym); mlocal = p->elementIndex(sym);
for (kp = 0; kp < nsp; kp++) { for (kp = 0; kp < nsp; kp++) {
if (mlocal >= 0) { if (mlocal != -1) {
m_atoms(m, k) = p->nAtoms(kp, mlocal); m_atoms(m, k) = p->nAtoms(kp, mlocal);
} }
if (m == 0) { if (m == 0) {
@ -224,13 +224,13 @@ namespace Cantera {
return sum; return sum;
} }
int MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) { size_t MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) {
int p = phaseIndex(phaseName); size_t p = phaseIndex(phaseName);
if (p < 0) { if (p == -1) {
throw CanteraError("MultiPhase::speciesIndex", "phase not found: " + phaseName); throw CanteraError("MultiPhase::speciesIndex", "phase not found: " + phaseName);
} }
int k = m_phase[p]->speciesIndex(speciesName); size_t k = m_phase[p]->speciesIndex(speciesName);
if (k < 0) { if (k == -1) {
throw CanteraError("MultiPhase::speciesIndex", "species not found: " + speciesName); throw CanteraError("MultiPhase::speciesIndex", "species not found: " + speciesName);
} }
return m_spstart[p] + k; return m_spstart[p] + k;
@ -374,9 +374,8 @@ namespace Cantera {
void MultiPhase::setPhaseMoleFractions(const index_t n, const doublereal* const x) { void MultiPhase::setPhaseMoleFractions(const index_t n, const doublereal* const x) {
phase_t* p = m_phase[n]; phase_t* p = m_phase[n];
p->setState_TPX(m_temp, m_press, x); p->setState_TPX(m_temp, m_press, x);
int nsp = p->nSpecies(); size_t istart = m_spstart[n];
int istart = m_spstart[n]; for (int k = 0; k < p->nSpecies(); k++) {
for (int k = 0; k < nsp; k++) {
m_moleFractions[istart+k] = x[k]; m_moleFractions[istart+k] = x[k];
} }
} }
@ -385,7 +384,7 @@ namespace Cantera {
// species name strings to mole numbers. Mole numbers that are // species name strings to mole numbers. Mole numbers that are
// less than or equal to zero will be set to zero. // less than or equal to zero will be set to zero.
void MultiPhase::setMolesByName(compositionMap& xMap) { void MultiPhase::setMolesByName(compositionMap& xMap) {
int kk = nSpecies(); size_t kk = nSpecies();
doublereal x; doublereal x;
vector_fp moles(kk, 0.0); vector_fp moles(kk, 0.0);
for (int k = 0; k < kk; k++) { for (int k = 0; k < kk; k++) {
@ -403,8 +402,7 @@ namespace Cantera {
// add an entry in the map for every species, with value -1.0. // add an entry in the map for every species, with value -1.0.
// Function parseCompString (stringUtils.cpp) uses the names // Function parseCompString (stringUtils.cpp) uses the names
// in the map to specify the allowed species. // in the map to specify the allowed species.
int kk = nSpecies(); for (int k = 0; k < nSpecies(); k++) {
for (int k = 0; k < kk; k++) {
xx[speciesName(k)] = -1.0; xx[speciesName(k)] = -1.0;
} }
@ -904,7 +902,7 @@ namespace Cantera {
m_moles[n] = moles; m_moles[n] = moles;
} }
int MultiPhase::speciesPhaseIndex(const index_t kGlob) const { size_t MultiPhase::speciesPhaseIndex(const index_t kGlob) const {
return m_spphase[kGlob]; return m_spphase[kGlob];
} }

View file

@ -238,7 +238,7 @@ namespace Cantera {
* If the species or phase name is not recognized, this routine throws * If the species or phase name is not recognized, this routine throws
* a CanteraError. * a CanteraError.
*/ */
int speciesIndex(std::string speciesName, std::string phaseName); size_t speciesIndex(std::string speciesName, std::string phaseName);
/// Minimum temperature for which all solution phases have /// Minimum temperature for which all solution phases have
/// valid thermo data. Stoichiometric phases are not /// valid thermo data. Stoichiometric phases are not
@ -426,7 +426,7 @@ namespace Cantera {
* @return * @return
* Returns the index of the owning phase. * Returns the index of the owning phase.
*/ */
int speciesPhaseIndex(const index_t kGlob) const; size_t speciesPhaseIndex(const index_t kGlob) const;
//! Returns the mole fraction of global species k //! Returns the mole fraction of global species k
/*! /*!
@ -758,10 +758,10 @@ namespace Cantera {
* *
* @ingroup equilfunctions * @ingroup equilfunctions
*/ */
int BasisOptimize( int *usedZeroedSpecies, bool doFormRxn, size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
MultiPhase *mphase, vector_int & orderVectorSpecies, MultiPhase* mphase, std::vector<size_t>& orderVectorSpecies,
vector_int & orderVectorElements, std::vector<size_t>& orderVectorElements,
vector_fp & formRxnMatrix); vector_fp& formRxnMatrix);
//! This subroutine handles the potential rearrangement of the constraint //! This subroutine handles the potential rearrangement of the constraint
//! equations represented by the Formula Matrix. //! equations represented by the Formula Matrix.
@ -813,10 +813,10 @@ namespace Cantera {
* *
* @ingroup equilfunctions * @ingroup equilfunctions
*/ */
int ElemRearrange(int nComponents, const vector_fp & elementAbundances, size_t ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
MultiPhase *mphase, MultiPhase* mphase,
vector_int & orderVectorSpecies, std::vector<size_t>& orderVectorSpecies,
vector_int & orderVectorElements); std::vector<size_t>& orderVectorElements);
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
//! External int that is used to turn on debug printing for the //! External int that is used to turn on debug printing for the

View file

@ -460,7 +460,7 @@ namespace Cantera {
// The left m_nel columns of A are now upper-diagonal. Now // The left m_nel columns of A are now upper-diagonal. Now
// reduce the m_nel columns to diagonal form by back-solving // reduce the m_nel columns to diagonal form by back-solving
for (m = nRows-1; m > 0; m--) { for (m = nRows-1; m > 0; m--) {
for (int n = m-1; n>= 0; n--) { for (size_t n = m-1; n != -1; n--) {
if (m_A(n,m) != 0.0) { if (m_A(n,m) != 0.0) {
fctr = m_A(n,m); fctr = m_A(n,m);
for (k = m; k < m_nsp; k++) { for (k = m; k < m_nsp; k++) {
@ -770,7 +770,7 @@ namespace Cantera {
psum = 0.0; psum = 0.0;
for (k = 0; k < m_nsp; k++) { for (k = 0; k < m_nsp; k++) {
kc = m_species[k]; kc = m_species[k];
if (m_mix->speciesPhaseIndex(kc) == (int) ip) { if (m_mix->speciesPhaseIndex(kc) == ip) {
// bug fixed 7/12/06 DGG // bug fixed 7/12/06 DGG
stoich = nu[k]; // nu[kc]; stoich = nu[k]; // nu[kc];
psum += stoich * stoich; psum += stoich * stoich;

View file

@ -40,7 +40,7 @@ namespace Cantera {
virtual ~MultiPhaseEquil() {} virtual ~MultiPhaseEquil() {}
int constituent(index_t m) { size_t constituent(index_t m) {
if (m < m_nel) return m_order[m]; if (m < m_nel) return m_order[m];
else return -1; else return -1;
} }

View file

@ -20,14 +20,14 @@ DoubleStarStar::DoubleStarStar() :
* Constructor. Create an \c m by \c n array, and initialize * Constructor. Create an \c m by \c n array, and initialize
* all elements to \c v. * all elements to \c v.
*/ */
DoubleStarStar::DoubleStarStar(int m, int n, double v) : DoubleStarStar::DoubleStarStar(size_t m, size_t n, double v) :
m_nrows(n), m_nrows(n),
m_ncols(m) m_ncols(m)
{ {
m_data.resize(n*m); m_data.resize(n*m);
std::fill(m_data.begin(), m_data.end(), v); std::fill(m_data.begin(), m_data.end(), v);
m_colAddr.resize(m); m_colAddr.resize(m);
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
m_colAddr[jcol] = &(m_data[jcol*m_nrows]); m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
} }
} }
@ -39,7 +39,7 @@ DoubleStarStar::DoubleStarStar(const DoubleStarStar& y) {
m_data.resize(m_nrows*m_ncols); m_data.resize(m_nrows*m_ncols);
m_data = y.m_data; m_data = y.m_data;
m_colAddr.resize(m_ncols); m_colAddr.resize(m_ncols);
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
m_colAddr[jcol] = &(m_data[jcol*m_nrows]); m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
} }
} }
@ -52,7 +52,7 @@ DoubleStarStar& DoubleStarStar::operator=(const DoubleStarStar& y) {
m_data.resize(m_nrows*m_ncols); m_data.resize(m_nrows*m_ncols);
m_data = y.m_data; m_data = y.m_data;
m_colAddr.resize(m_ncols); m_colAddr.resize(m_ncols);
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
m_colAddr[jcol] = &(m_data[jcol*m_nrows]); m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
} }
return *this; return *this;
@ -65,7 +65,7 @@ DoubleStarStar& DoubleStarStar::operator=(const DoubleStarStar& y) {
* @param m This is the number of columns in the new matrix * @param m This is the number of columns in the new matrix
* @param v Default fill value -> defaults to zero. * @param v Default fill value -> defaults to zero.
*/ */
void DoubleStarStar::resize(int m, int n, double v) { void DoubleStarStar::resize(size_t m, size_t n, double v) {
std::vector<double> old_data; std::vector<double> old_data;
bool doCopy = false; bool doCopy = false;
if (m_nrows > 0 && m_ncols > 0) { if (m_nrows > 0 && m_ncols > 0) {
@ -77,23 +77,23 @@ void DoubleStarStar::resize(int m, int n, double v) {
m_data.resize(n*m, v); m_data.resize(n*m, v);
if (doCopy) { if (doCopy) {
if (n >= m_nrows && m >= m_ncols) { if (n >= m_nrows && m >= m_ncols) {
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
for (int irow = 0; irow < m_nrows; irow++) { for (size_t irow = 0; irow < m_nrows; irow++) {
m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow]; m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow];
} }
for (int irow = m_nrows; irow < n; irow++) { for (size_t irow = m_nrows; irow < n; irow++) {
m_data[jcol*n + irow] = v; m_data[jcol*n + irow] = v;
} }
} }
for (int jcol = m_ncols; jcol < m; jcol++) { for (size_t jcol = m_ncols; jcol < m; jcol++) {
for (int irow = 0; irow < n; irow++) { for (size_t irow = 0; irow < n; irow++) {
m_data[jcol*n + irow] = v; m_data[jcol*n + irow] = v;
} }
} }
} else { } else {
std::fill(m_data.begin(), m_data.end(), v); std::fill(m_data.begin(), m_data.end(), v);
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
for (int irow = 0; irow < m_nrows; irow++) { for (size_t irow = 0; irow < m_nrows; irow++) {
m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow]; m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow];
} }
} }
@ -102,16 +102,16 @@ void DoubleStarStar::resize(int m, int n, double v) {
m_nrows = n; m_nrows = n;
m_ncols = m; m_ncols = m;
m_colAddr.resize(m_ncols); m_colAddr.resize(m_ncols);
for (int jcol = 0; jcol < m_ncols; jcol++) { for (size_t jcol = 0; jcol < m_ncols; jcol++) {
m_colAddr[jcol] = &(m_data[jcol*m_nrows]); m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
} }
} }
double * const DoubleStarStar::operator[](int jcol) { double * const DoubleStarStar::operator[](size_t jcol) {
return m_colAddr[jcol]; return m_colAddr[jcol];
} }
const double * const DoubleStarStar::operator[](int jcol) const { const double * const DoubleStarStar::operator[](size_t jcol) const {
return (const double * const) m_colAddr[jcol]; return (const double * const) m_colAddr[jcol];
} }
@ -124,12 +124,12 @@ double const * const * const DoubleStarStar::constBaseDataAddr() const {
} }
// Number of rows // Number of rows
int DoubleStarStar::nRows() const { size_t DoubleStarStar::nRows() const {
return m_nrows; return m_nrows;
} }
// Number of columns // Number of columns
int DoubleStarStar::nColumns() const { size_t DoubleStarStar::nColumns() const {
return m_ncols; return m_ncols;
} }

View file

@ -41,7 +41,7 @@ public:
* @param mcol Number of columns * @param mcol Number of columns
* @param nrow Number of rows * @param nrow Number of rows
*/ */
DoubleStarStar(int mcol, int nrow, double v = 0.0); DoubleStarStar(size_t mcol, size_t nrow, double v = 0.0);
//! copy constructor //! copy constructor
/*! /*!
@ -61,7 +61,7 @@ public:
* @param ncol This is the number of rows * @param ncol This is the number of rows
* @param v Default fill value -> defaults to zero. * @param v Default fill value -> defaults to zero.
*/ */
void resize(int mcol, int nrow, double v = 0.0); void resize(size_t mcol, size_t nrow, double v = 0.0);
//! Pointer to the top of the column //! Pointer to the top of the column
/*! /*!
@ -69,7 +69,7 @@ public:
* *
* @return returns the pointer to the top of the jth column * @return returns the pointer to the top of the jth column
*/ */
double * const operator[](int jcol); double * const operator[](size_t jcol);
//! Returns a const Pointer to the top of the jth column //! Returns a const Pointer to the top of the jth column
/*! /*!
@ -77,7 +77,7 @@ public:
* *
* @return returns the pointer to the top of the jth column * @return returns the pointer to the top of the jth column
*/ */
const double * const operator[](int jcol) const; const double * const operator[](size_t jcol) const;
//! Returns a double ** pointer to the base address //! Returns a double ** pointer to the base address
/*! /*!
@ -96,10 +96,10 @@ public:
double const * const * const constBaseDataAddr() const; double const * const * const constBaseDataAddr() const;
//! Number of rows //! Number of rows
int nRows() const; size_t nRows() const;
//! Number of columns //! Number of columns
int nColumns() const; size_t nColumns() const;
private: private:
//! Storage area //! Storage area
@ -112,10 +112,10 @@ private:
std::vector<double *> m_colAddr; std::vector<double *> m_colAddr;
//! number of rows //! number of rows
int m_nrows; size_t m_nrows;
//! number of columns //! number of columns
int m_ncols; size_t m_ncols;
}; };
} }

View file

@ -55,17 +55,13 @@ namespace VCSnonideal {
m_printLvl(printLvl), m_printLvl(printLvl),
m_vsolvePtr(0) m_vsolvePtr(0)
{ {
// Debugging level
int nsp = mix->nSpecies();
int nel = mix->nElements();
int nph = mix->nPhases();
/* /*
* Create a VCS_PROB object that describes the equilibrium problem. * Create a VCS_PROB object that describes the equilibrium problem.
* The constructor just mallocs the necessary objects and sizes them. * The constructor just mallocs the necessary objects and sizes them.
*/ */
m_vprob = new VCS_PROB(nsp, nel, nph); m_vprob = new VCS_PROB(mix->nSpecies(),
mix->nElements(),
mix->nPhases());
m_mix = mix; m_mix = mix;
m_vprob->m_printLvl = m_printLvl; m_vprob->m_printLvl = m_printLvl;
/* /*
@ -574,11 +570,11 @@ namespace VCSnonideal {
int maxit = maxsteps;; int maxit = maxsteps;;
clockWC tickTock; clockWC tickTock;
int nsp = m_mix->nSpecies();
int nel = m_mix->nElements();
int nph = m_mix->nPhases();
if (m_vprob == 0) { if (m_vprob == 0) {
m_vprob = new VCS_PROB(nsp, nel, nph); m_vprob = new VCS_PROB(m_mix->nSpecies(),
m_mix->nElements(),
m_mix->nPhases());
} }
m_printLvl = printLvl; m_printLvl = printLvl;
m_vprob->m_printLvl = printLvl; m_vprob->m_printLvl = printLvl;
@ -652,12 +648,11 @@ namespace VCSnonideal {
* states. * states.
*/ */
m_mix->uploadMoleFractionsFromPhases(); m_mix->uploadMoleFractionsFromPhases();
int kGlob = 0; size_t kGlob = 0;
for (int ip = 0; ip < m_vprob->NPhase; ip++) { for (int ip = 0; ip < m_vprob->NPhase; ip++) {
double phaseMole = 0.0; double phaseMole = 0.0;
Cantera::ThermoPhase &tref = m_mix->phase(ip); Cantera::ThermoPhase &tref = m_mix->phase(ip);
int nspPhase = tref.nSpecies(); for (size_t k = 0; k < tref.nSpecies(); k++, kGlob++) {
for (int k = 0; k < nspPhase; k++, kGlob++) {
phaseMole += m_vprob->w[kGlob]; phaseMole += m_vprob->w[kGlob];
} }
//phaseMole *= 1.0E-3; //phaseMole *= 1.0E-3;
@ -913,8 +908,8 @@ namespace VCSnonideal {
/* /*
* Calculate the total number of species and phases in the problem * Calculate the total number of species and phases in the problem
*/ */
int totNumPhases = mphase->nPhases(); size_t totNumPhases = mphase->nPhases();
int totNumSpecies = mphase->nSpecies(); size_t totNumSpecies = mphase->nSpecies();
// Problem type has yet to be worked out. // Problem type has yet to be worked out.
vprob->prob_type = 0; vprob->prob_type = 0;
@ -947,7 +942,7 @@ namespace VCSnonideal {
*/ */
iSurPhase = -1; iSurPhase = -1;
tPhase = &(mphase->phase(iphase)); tPhase = &(mphase->phase(iphase));
int nelem = tPhase->nElements(); size_t nelem = tPhase->nElements();
/* /*
* Query Cantera for the equation of state type of the * Query Cantera for the equation of state type of the
@ -960,7 +955,7 @@ namespace VCSnonideal {
/* /*
* Find out the number of species in the phase * Find out the number of species in the phase
*/ */
int nSpPhase = tPhase->nSpecies(); size_t nSpPhase = tPhase->nSpecies();
/* /*
* Find out the name of the phase * Find out the name of the phase
*/ */
@ -1299,8 +1294,8 @@ namespace VCSnonideal {
*/ */
int vcs_Cantera_update_vprob(Cantera::MultiPhase *mphase, int vcs_Cantera_update_vprob(Cantera::MultiPhase *mphase,
VCSnonideal::VCS_PROB *vprob) { VCSnonideal::VCS_PROB *vprob) {
int totNumPhases = mphase->nPhases(); size_t totNumPhases = mphase->nPhases();
int kT = 0; size_t kT = 0;
std::vector<double> tmpMoles; std::vector<double> tmpMoles;
// Problem type has yet to be worked out. // Problem type has yet to be worked out.
vprob->prob_type = 0; vprob->prob_type = 0;
@ -1312,7 +1307,7 @@ namespace VCSnonideal {
vprob->Vol = mphase->volume(); vprob->Vol = mphase->volume();
Cantera::ThermoPhase *tPhase = 0; Cantera::ThermoPhase *tPhase = 0;
for (int iphase = 0; iphase < totNumPhases; iphase++) { for (size_t iphase = 0; iphase < totNumPhases; iphase++) {
tPhase = &(mphase->phase(iphase)); tPhase = &(mphase->phase(iphase));
vcs_VolPhase *volPhase = vprob->VPhaseList[iphase]; vcs_VolPhase *volPhase = vprob->VPhaseList[iphase];
/* /*
@ -1327,10 +1322,10 @@ namespace VCSnonideal {
/* /*
* Loop through each species in the current phase * Loop through each species in the current phase
*/ */
int nSpPhase = tPhase->nSpecies(); size_t nSpPhase = tPhase->nSpecies();
// volPhase->TMoles = 0.0; // volPhase->TMoles = 0.0;
tmpMoles.resize(nSpPhase); tmpMoles.resize(nSpPhase);
for (int k = 0; k < nSpPhase; k++) { for (size_t k = 0; k < nSpPhase; k++) {
tmpMoles[k] = mphase->speciesMoles(kT); tmpMoles[k] = mphase->speciesMoles(kT);
vprob->w[kT] = mphase->speciesMoles(kT); vprob->w[kT] = mphase->speciesMoles(kT);
vprob->mf[kT] = mphase->moleFraction(kT); vprob->mf[kT] = mphase->moleFraction(kT);

View file

@ -19,8 +19,8 @@ namespace VCSnonideal {
* *
* constructor(): * constructor():
*/ */
vcs_SpeciesProperties::vcs_SpeciesProperties(int indexPhase, vcs_SpeciesProperties::vcs_SpeciesProperties(size_t indexPhase,
int indexSpeciesPhase, size_t indexSpeciesPhase,
vcs_VolPhase *owning) : vcs_VolPhase *owning) :
IndexPhase(indexPhase), IndexPhase(indexPhase),
IndexSpeciesPhase(indexSpeciesPhase), IndexSpeciesPhase(indexSpeciesPhase),

View file

@ -48,7 +48,7 @@ public:
/* /*
* constructor and destructor * constructor and destructor
*/ */
vcs_SpeciesProperties(int indexPhase, int indexSpeciesPhase, vcs_SpeciesProperties(size_t indexPhase, size_t indexSpeciesPhase,
vcs_VolPhase *owning); vcs_VolPhase *owning);
virtual ~vcs_SpeciesProperties(); virtual ~vcs_SpeciesProperties();

View file

@ -156,7 +156,7 @@ namespace VCSnonideal {
m_elementNames.resize(b.m_numElemConstraints); m_elementNames.resize(b.m_numElemConstraints);
for (int e = 0; e < b.m_numElemConstraints; e++) { for (size_t e = 0; e < b.m_numElemConstraints; e++) {
m_elementNames[e] = b.m_elementNames[e]; m_elementNames[e] = b.m_elementNames[e];
} }
@ -164,7 +164,7 @@ namespace VCSnonideal {
m_elementType = b.m_elementType; m_elementType = b.m_elementType;
m_formulaMatrix.resize(m_numElemConstraints, m_numSpecies, 0.0); m_formulaMatrix.resize(m_numElemConstraints, m_numSpecies, 0.0);
for (int e = 0; e < m_numElemConstraints; e++) { for (size_t e = 0; e < m_numElemConstraints; e++) {
for (int k = 0; k < m_numSpecies; k++) { for (int k = 0; k < m_numSpecies; k++) {
m_formulaMatrix[e][k] = b.m_formulaMatrix[e][k]; m_formulaMatrix[e][k] = b.m_formulaMatrix[e][k];
} }
@ -241,8 +241,8 @@ namespace VCSnonideal {
} }
/***************************************************************************/ /***************************************************************************/
void vcs_VolPhase::resize(const int phaseNum, const int nspecies, void vcs_VolPhase::resize(const size_t phaseNum, const size_t nspecies,
const int numElem, const char * const phaseName, const size_t numElem, const char * const phaseName,
const double molesInert) { const double molesInert) {
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
if (nspecies <= 0) { if (nspecies <= 0) {
@ -301,7 +301,7 @@ namespace VCSnonideal {
} }
} }
ListSpeciesPtr.resize(nspecies, 0); ListSpeciesPtr.resize(nspecies, 0);
for (int i = 0; i < nspecies; i++) { for (size_t i = 0; i < nspecies; i++) {
ListSpeciesPtr[i] = new vcs_SpeciesProperties(phaseNum, i, this); ListSpeciesPtr[i] = new vcs_SpeciesProperties(phaseNum, i, this);
} }
@ -335,7 +335,7 @@ namespace VCSnonideal {
} }
/***************************************************************************/ /***************************************************************************/
void vcs_VolPhase::elemResize(const int numElemConstraints) { void vcs_VolPhase::elemResize(const size_t numElemConstraints) {
m_elementNames.resize(numElemConstraints); m_elementNames.resize(numElemConstraints);
@ -376,7 +376,7 @@ namespace VCSnonideal {
* return one activity coefficient. Have to recalculate them all to get * return one activity coefficient. Have to recalculate them all to get
* one. * one.
*/ */
double vcs_VolPhase::AC_calc_one(int kspec) const { double vcs_VolPhase::AC_calc_one(size_t kspec) const {
if (! m_UpToDate_AC) { if (! m_UpToDate_AC) {
_updateActCoeff(); _updateActCoeff();
} }
@ -647,7 +647,7 @@ namespace VCSnonideal {
* Update the electric potential if it is a solution variable * Update the electric potential if it is a solution variable
* in the equation system * in the equation system
*/ */
if (m_phiVarIndex >= 0) { if (m_phiVarIndex != -1) {
kglob = IndSpecies[m_phiVarIndex]; kglob = IndSpecies[m_phiVarIndex];
if (m_numSpecies == 1) { if (m_numSpecies == 1) {
Xmol[m_phiVarIndex] = 1.0; Xmol[m_phiVarIndex] = 1.0;
@ -1095,8 +1095,8 @@ namespace VCSnonideal {
setState_TP(Temp, Pres); setState_TP(Temp, Pres);
p_VCS_UnitsFormat = VCS_UNITS_MKS; p_VCS_UnitsFormat = VCS_UNITS_MKS;
m_phi = TP_ptr->electricPotential(); m_phi = TP_ptr->electricPotential();
int nsp = TP_ptr->nSpecies(); size_t nsp = TP_ptr->nSpecies();
int nelem = TP_ptr->nElements(); size_t nelem = TP_ptr->nElements();
if (nsp != m_numSpecies) { if (nsp != m_numSpecies) {
if (m_numSpecies != 0) { if (m_numSpecies != 0) {
plogf("Warning Nsp != NVolSpeces: %d %d \n", nsp, m_numSpecies); plogf("Warning Nsp != NVolSpeces: %d %d \n", nsp, m_numSpecies);
@ -1279,13 +1279,13 @@ namespace VCSnonideal {
} }
/***************************************************************************/ /***************************************************************************/
int vcs_VolPhase::phiVarIndex() const { size_t vcs_VolPhase::phiVarIndex() const {
return m_phiVarIndex; return m_phiVarIndex;
} }
/***************************************************************************/ /***************************************************************************/
void vcs_VolPhase::setPhiVarIndex(int phiVarIndex) { void vcs_VolPhase::setPhiVarIndex(size_t phiVarIndex) {
m_phiVarIndex = phiVarIndex; m_phiVarIndex = phiVarIndex;
m_speciesUnknownType[m_phiVarIndex] = VCS_SPECIES_TYPE_INTERFACIALVOLTAGE; m_speciesUnknownType[m_phiVarIndex] = VCS_SPECIES_TYPE_INTERFACIALVOLTAGE;
if (m_singleSpecies) { if (m_singleSpecies) {
@ -1302,7 +1302,7 @@ namespace VCSnonideal {
* *
* @param kindex kth species index. * @param kindex kth species index.
*/ */
vcs_SpeciesProperties * vcs_VolPhase::speciesProperty(const int kindex) { vcs_SpeciesProperties * vcs_VolPhase::speciesProperty(const size_t kindex) {
return ListSpeciesPtr[kindex]; return ListSpeciesPtr[kindex];
} }
/***************************************************************************/ /***************************************************************************/
@ -1362,7 +1362,7 @@ namespace VCSnonideal {
* @return Returns the VCS_SOLVE species index of the that species * @return Returns the VCS_SOLVE species index of the that species
* This changes as rearrangements are carried out. * This changes as rearrangements are carried out.
*/ */
int vcs_VolPhase::spGlobalIndexVCS(const int spIndex) const { size_t vcs_VolPhase::spGlobalIndexVCS(const size_t spIndex) const {
return IndSpecies[spIndex]; return IndSpecies[spIndex];
} }
/**********************************************************************/ /**********************************************************************/
@ -1375,8 +1375,8 @@ namespace VCSnonideal {
* @return Returns the VCS_SOLVE species index of the that species * @return Returns the VCS_SOLVE species index of the that species
* This changes as rearrangements are carried out. * This changes as rearrangements are carried out.
*/ */
void vcs_VolPhase::setSpGlobalIndexVCS(const int spIndex, void vcs_VolPhase::setSpGlobalIndexVCS(const size_t spIndex,
const int spGlobalIndex) { const size_t spGlobalIndex) {
IndSpecies[spIndex] = spGlobalIndex; IndSpecies[spIndex] = spGlobalIndex;
} }
/**********************************************************************/ /**********************************************************************/
@ -1426,7 +1426,7 @@ namespace VCSnonideal {
/**********************************************************************/ /**********************************************************************/
// Returns the global index of the local element index for the phase // Returns the global index of the local element index for the phase
void vcs_VolPhase::setElemGlobalIndex(const int eLocal, const int eGlobal) { void vcs_VolPhase::setElemGlobalIndex(const size_t eLocal, const size_t eGlobal) {
DebugAssertThrowVCS(eLocal >= 0, "vcs_VolPhase::setElemGlobalIndex"); DebugAssertThrowVCS(eLocal >= 0, "vcs_VolPhase::setElemGlobalIndex");
DebugAssertThrowVCS(eLocal < m_numElemConstraints, DebugAssertThrowVCS(eLocal < m_numElemConstraints,
"vcs_VolPhase::setElemGlobalIndex"); "vcs_VolPhase::setElemGlobalIndex");
@ -1434,12 +1434,12 @@ namespace VCSnonideal {
} }
/**********************************************************************/ /**********************************************************************/
int vcs_VolPhase::nElemConstraints() const { size_t vcs_VolPhase::nElemConstraints() const {
return m_numElemConstraints; return m_numElemConstraints;
} }
/**********************************************************************/ /**********************************************************************/
std::string vcs_VolPhase::elementName(const int e) const { std::string vcs_VolPhase::elementName(const size_t e) const {
return m_elementNames[e]; return m_elementNames[e];
} }
/**********************************************************************/ /**********************************************************************/
@ -1449,8 +1449,7 @@ namespace VCSnonideal {
* or not. * or not.
*/ */
static bool hasChargedSpecies(const Cantera::ThermoPhase * const tPhase) { static bool hasChargedSpecies(const Cantera::ThermoPhase * const tPhase) {
int nSpPhase = tPhase->nSpecies(); for (size_t k = 0; k < tPhase->nSpecies(); k++) {
for (int k = 0; k < nSpPhase; k++) {
if (tPhase->charge(k) != 0.0) { if (tPhase->charge(k) != 0.0) {
return true; return true;
} }
@ -1477,15 +1476,15 @@ namespace VCSnonideal {
} }
int vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) { int vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) {
int e, k, eT; size_t e, k, eT;
std::string ename; std::string ename;
int eFound = -2; size_t eFound = -2;
/* /*
* *
*/ */
int nebase = tPhase->nElements(); size_t nebase = tPhase->nElements();
int ne = nebase; size_t ne = nebase;
int ns = tPhase->nSpecies(); size_t ns = tPhase->nSpecies();
/* /*
* Decide whether we need an extra element constraint for charge * Decide whether we need an extra element constraint for charge
@ -1503,7 +1502,7 @@ namespace VCSnonideal {
elemResize(ne); elemResize(ne);
if (ChargeNeutralityElement >= 0) { if (ChargeNeutralityElement != -1) {
m_elementType[ChargeNeutralityElement] = VCS_ELEM_TYPE_CHARGENEUTRALITY; m_elementType[ChargeNeutralityElement] = VCS_ELEM_TYPE_CHARGENEUTRALITY;
} }
@ -1611,7 +1610,7 @@ namespace VCSnonideal {
/* /*
* @param e Element index. * @param e Element index.
*/ */
int vcs_VolPhase::elementType(const int e) const { int vcs_VolPhase::elementType(const size_t e) const {
return m_elementType[e]; return m_elementType[e];
} }
/***************************************************************************/ /***************************************************************************/
@ -1621,7 +1620,7 @@ namespace VCSnonideal {
* @param e Element index * @param e Element index
* @param eType type of the element. * @param eType type of the element.
*/ */
void vcs_VolPhase::setElementType(const int e, const int eType) { void vcs_VolPhase::setElementType(const size_t e, const int eType) {
m_elementType[e] = eType; m_elementType[e] = eType;
} }
/***************************************************************************/ /***************************************************************************/
@ -1632,12 +1631,12 @@ namespace VCSnonideal {
} }
/***************************************************************************/ /***************************************************************************/
int vcs_VolPhase::speciesUnknownType(const int k) const { int vcs_VolPhase::speciesUnknownType(const size_t k) const {
return m_speciesUnknownType[k]; return m_speciesUnknownType[k];
} }
/***************************************************************************/ /***************************************************************************/
int vcs_VolPhase::elementActive(const int e) const { int vcs_VolPhase::elementActive(const size_t e) const {
return m_elementActive[e]; return m_elementActive[e];
} }
/***************************************************************************/ /***************************************************************************/

View file

@ -140,11 +140,11 @@ namespace VCSnonideal {
* @param phaseName String name for the phase * @param phaseName String name for the phase
* @param molesInert kmoles of inert in the phase (defaults to zero) * @param molesInert kmoles of inert in the phase (defaults to zero)
*/ */
void resize(const int phaseNum, const int numSpecies, void resize(const size_t phaseNum, const size_t numSpecies,
const int numElem, const char * const phaseName, const size_t numElem, const char * const phaseName,
const double molesInert = 0.0); const double molesInert = 0.0);
void elemResize(const int numElemConstraints); void elemResize(const size_t numElemConstraints);
//! Evaluate activity coefficients and return the kspec coefficient //! Evaluate activity coefficients and return the kspec coefficient
/*! /*!
@ -153,7 +153,7 @@ namespace VCSnonideal {
* *
* @param kspec species number * @param kspec species number
*/ */
double AC_calc_one(int kspec) const; double AC_calc_one(size_t kspec) const;
//! Set the moles and/or mole fractions within the phase //! Set the moles and/or mole fractions within the phase
@ -434,9 +434,9 @@ namespace VCSnonideal {
//! Return the index of the species that represents the //! Return the index of the species that represents the
//! the voltage of the phase //! the voltage of the phase
int phiVarIndex() const; size_t phiVarIndex() const;
void setPhiVarIndex(int phiVarIndex); void setPhiVarIndex(size_t phiVarIndex);
//! Retrieve the kth Species structure for the species belonging to this phase //! Retrieve the kth Species structure for the species belonging to this phase
/*! /*!
@ -444,7 +444,7 @@ namespace VCSnonideal {
* *
* @param kindex kth species index. * @param kindex kth species index.
*/ */
vcs_SpeciesProperties * speciesProperty(const int kindex); vcs_SpeciesProperties * speciesProperty(const size_t kindex);
//! int indicating whether the phase exists or not //! int indicating whether the phase exists or not
/*! /*!
@ -485,7 +485,7 @@ namespace VCSnonideal {
* @return Returns the VCS_SOLVE species index of the species. * @return Returns the VCS_SOLVE species index of the species.
* This changes as rearrangements are carried out. * This changes as rearrangements are carried out.
*/ */
int spGlobalIndexVCS(const int spIndex) const; size_t spGlobalIndexVCS(const size_t spIndex) const;
//! set the Global VCS index of the kth species in the phase //! set the Global VCS index of the kth species in the phase
@ -496,7 +496,7 @@ namespace VCSnonideal {
* @return Returns the VCS_SOLVE species index of the that species * @return Returns the VCS_SOLVE species index of the that species
* This changes as rearrangements are carried out. * This changes as rearrangements are carried out.
*/ */
void setSpGlobalIndexVCS(const int spIndex, const int spGlobalIndex); void setSpGlobalIndexVCS(const size_t spIndex, const size_t spGlobalIndex);
//! Sets the total moles of inert in the phase //! Sets the total moles of inert in the phase
/*! /*!
@ -519,29 +519,29 @@ namespace VCSnonideal {
* @param eLocal Local phase element index * @param eLocal Local phase element index
* @param eGlobal Global phase element index * @param eGlobal Global phase element index
*/ */
void setElemGlobalIndex(const int eLocal, const int eGlobal); void setElemGlobalIndex(const size_t eLocal, const size_t eGlobal);
//! Returns the number of element constraints //! Returns the number of element constraints
int nElemConstraints() const; size_t nElemConstraints() const;
//! Name of the element constraint with index \c e. //! Name of the element constraint with index \c e.
/*! /*!
* @param e Element index. * @param e Element index.
*/ */
std::string elementName(const int e) const; std::string elementName(const size_t e) const;
//! Type of the element constraint with index \c e. //! Type of the element constraint with index \c e.
/*! /*!
* @param e Element index. * @param e Element index.
*/ */
int elementType(const int e) const; int elementType(const size_t e) const;
//! Set the element Type of the element constraint with index \c e. //! Set the element Type of the element constraint with index \c e.
/*! /*!
* @param e Element index * @param e Element index
* @param eType type of the element. * @param eType type of the element.
*/ */
void setElementType(const int e, const int eType); void setElementType(const size_t e, const int eType);
//! Transfer all of the element information from the //! Transfer all of the element information from the
//! ThermoPhase object to the vcs_VolPhase object. //! ThermoPhase object to the vcs_VolPhase object.
@ -572,10 +572,10 @@ namespace VCSnonideal {
* metal electron -> VCS_SPECIES_INTERFACIALVOLTAGE * metal electron -> VCS_SPECIES_INTERFACIALVOLTAGE
* ( unknown is the interfacial voltage (volts) * ( unknown is the interfacial voltage (volts)
*/ */
int speciesUnknownType(const int k) const; int speciesUnknownType(const size_t k) const;
int elementActive(const int e) const; int elementActive(const size_t e) const;
//! Return the number of species in the phase //! Return the number of species in the phase
@ -670,7 +670,7 @@ namespace VCSnonideal {
* miscibility gap, these numbers will stay the * miscibility gap, these numbers will stay the
* same after the split. * same after the split.
*/ */
int VP_ID; size_t VP_ID;
//! ID of the surface or volume domain in which the //! ID of the surface or volume domain in which the
//! this phase exists //! this phase exists
@ -703,7 +703,7 @@ namespace VCSnonideal {
* If it has one. If it does not have a charge neutrality * If it has one. If it does not have a charge neutrality
* constraint, then this value is equal to -1 * constraint, then this value is equal to -1
*/ */
int ChargeNeutralityElement; size_t ChargeNeutralityElement;
//! Units for the chemical potential data, pressure data, volume, //! Units for the chemical potential data, pressure data, volume,
//! and species amounts //! and species amounts
@ -745,7 +745,7 @@ namespace VCSnonideal {
/*! /*!
* This is usually equal to the number of elements. * This is usually equal to the number of elements.
*/ */
int m_numElemConstraints; size_t m_numElemConstraints;
//! vector of strings containing the element constraint names //! vector of strings containing the element constraint names
/*! /*!
@ -791,10 +791,10 @@ namespace VCSnonideal {
//! Index of the element number in the global list of elements //! Index of the element number in the global list of elements
//! storred in VCS_PROB or VCS_SOLVE //! storred in VCS_PROB or VCS_SOLVE
std::vector<int> m_elemGlobalIndex; std::vector<size_t> m_elemGlobalIndex;
//! Number of species in the phase //! Number of species in the phase
int m_numSpecies; size_t m_numSpecies;
public: public:
//! String name for the phase //! String name for the phase
@ -843,7 +843,7 @@ namespace VCSnonideal {
* Note, as part of the vcs algorithm, the order of the species * Note, as part of the vcs algorithm, the order of the species
* vector is changed during the algorithm * vector is changed during the algorithm
*/ */
std::vector<int> IndSpecies; std::vector<size_t> IndSpecies;
//! Vector of Species structures for the species belonging to this phase //! Vector of Species structures for the species belonging to this phase
/*! /*!
@ -879,7 +879,7 @@ namespace VCSnonideal {
//! If the potential is a solution variable in VCS, it acts as a species. //! If the potential is a solution variable in VCS, it acts as a species.
//! This is the species index in the phase for the potential //! This is the species index in the phase for the potential
int m_phiVarIndex; size_t m_phiVarIndex;
//! Total Volume of the phase //! Total Volume of the phase
/*! /*!

View file

@ -233,7 +233,7 @@ namespace VCSnonideal {
*/ */
for (int iph = 0; iph < m_numPhases; iph++) { for (int iph = 0; iph < m_numPhases; iph++) {
volPhase = m_VolPhaseList[iph]; volPhase = m_VolPhaseList[iph];
for (int e = 0; e < volPhase->nElemConstraints(); e++) { for (size_t e = 0; e < volPhase->nElemConstraints(); e++) {
if (volPhase->elemGlobalIndex(e) == ipos) { if (volPhase->elemGlobalIndex(e) == ipos) {
volPhase->setElemGlobalIndex(e, jpos); volPhase->setElemGlobalIndex(e, jpos);
} }

View file

@ -494,7 +494,7 @@ namespace VCSnonideal {
* - 1 right aligned * - 1 right aligned
* - 2 left aligned * - 2 left aligned
*/ */
void vcs_print_stringTrunc(const char *str, int space, int alignment); void vcs_print_stringTrunc(const char *str, size_t space, int alignment);
//! Simple routine to check whether two doubles are equal up to //! Simple routine to check whether two doubles are equal up to
//! roundoff error //! roundoff error

View file

@ -130,8 +130,8 @@ namespace VCSnonideal {
vcs_VolPhase *vPhase = m_VolPhaseList[pID]; vcs_VolPhase *vPhase = m_VolPhaseList[pID];
vcs_SpeciesProperties *spProp = vPhase->speciesProperty(spPhIndex); vcs_SpeciesProperties *spProp = vPhase->speciesProperty(spPhIndex);
double sz = 0.0; double sz = 0.0;
int eSize = spProp->FormulaMatrixCol.size(); size_t eSize = spProp->FormulaMatrixCol.size();
for (int e = 0; e < eSize; e++) { for (size_t e = 0; e < eSize; e++) {
sz += fabs(spProp->FormulaMatrixCol[e]); sz += fabs(spProp->FormulaMatrixCol[e]);
} }
if (sz > 0.0) { if (sz > 0.0) {

View file

@ -29,7 +29,7 @@ namespace VCSnonideal {
* We initialize the arrays in the structure to the appropriate sizes. * We initialize the arrays in the structure to the appropriate sizes.
* And, we initialize all of the elements of the arrays to defaults. * And, we initialize all of the elements of the arrays to defaults.
*/ */
VCS_PROB::VCS_PROB(int nsp, int nel, int nph) : VCS_PROB::VCS_PROB(size_t nsp, size_t nel, size_t nph) :
prob_type(VCS_PROBTYPE_TP), prob_type(VCS_PROBTYPE_TP),
nspecies(nsp), nspecies(nsp),
NSPECIES0(0), NSPECIES0(0),
@ -357,7 +357,7 @@ namespace VCSnonideal {
void VCS_PROB::addPhaseElements(vcs_VolPhase *volPhase) { void VCS_PROB::addPhaseElements(vcs_VolPhase *volPhase) {
int e, eVP; int e, eVP;
int foundPos = -1; int foundPos = -1;
int neVP = volPhase->nElemConstraints(); size_t neVP = volPhase->nElemConstraints();
std::string en; std::string en;
std::string enVP; std::string enVP;
/* /*
@ -430,7 +430,7 @@ namespace VCSnonideal {
* *
*/ */
int VCS_PROB::addOnePhaseSpecies(vcs_VolPhase *volPhase, int k, int kT) { int VCS_PROB::addOnePhaseSpecies(vcs_VolPhase *volPhase, int k, int kT) {
int e, eVP; size_t e, eVP;
if (kT > nspecies) { if (kT > nspecies) {
/* /*
* Need to expand the number of species here * Need to expand the number of species here

View file

@ -45,23 +45,23 @@ namespace VCSnonideal {
int prob_type; int prob_type;
//! Total number of species in the problems //! Total number of species in the problems
int nspecies; size_t nspecies;
//! Species number used to malloc data structures //! Species number used to malloc data structures
int NSPECIES0; size_t NSPECIES0;
//! Number of element contraints in the equilibrium problem //! Number of element contraints in the equilibrium problem
int ne; size_t ne;
//! Number of element constraints used to malloc data structures //! Number of element constraints used to malloc data structures
//! involving elements //! involving elements
int NE0; size_t NE0;
//! Number of phases in the problem //! Number of phases in the problem
int NPhase; size_t NPhase;
//! Number of phases used to malloc data structures //! Number of phases used to malloc data structures
int NPHASE0; size_t NPHASE0;
//! Vector of chemical potentials of the species //! Vector of chemical potentials of the species
/*! /*!
@ -185,7 +185,7 @@ namespace VCSnonideal {
double tolmin; double tolmin;
//! Mapping between the species and the phases //! Mapping between the species and the phases
std::vector<int> PhaseID; std::vector<size_t> PhaseID;
//! Vector of strings containing the species names //! Vector of strings containing the species names
std::vector<std::string> SpName; std::vector<std::string> SpName;
@ -250,7 +250,7 @@ namespace VCSnonideal {
* @param nel number of elements * @param nel number of elements
* @param nph number of phases * @param nph number of phases
*/ */
VCS_PROB(int nsp, int nel, int nph); VCS_PROB(size_t nsp, size_t nel, size_t nph);
//! Destructor //! Destructor
~VCS_PROB(); ~VCS_PROB();

View file

@ -110,7 +110,7 @@ namespace VCSnonideal {
#endif #endif
double vcs_l2norm(const std::vector<double> vec) { double vcs_l2norm(const std::vector<double> vec) {
int len = vec.size(); size_t len = vec.size();
if (len == 0) { if (len == 0) {
return 0.0; return 0.0;
} }
@ -483,7 +483,7 @@ namespace VCSnonideal {
/************************************************************************ **/ /************************************************************************ **/
void vcs_print_stringTrunc(const char *str, int space, int alignment) void vcs_print_stringTrunc(const char *str, size_t space, int alignment)
/*********************************************************************** /***********************************************************************
* vcs_print_stringTrunc(): * vcs_print_stringTrunc():
@ -499,8 +499,8 @@ namespace VCSnonideal {
* 2 left aligned * 2 left aligned
***********************************************************************/ ***********************************************************************/
{ {
int i, ls=0, rs=0; size_t i, ls=0, rs=0;
int len = strlen(str); size_t len = strlen(str);
if ((len) >= space) { if ((len) >= space) {
for (i = 0; i < space; i++) { for (i = 0; i < space; i++) {
plogf("%c", str[i]); plogf("%c", str[i]);

View file

@ -87,8 +87,7 @@ namespace Cantera {
thermo().getStandardChemPotentials(&m_grt[0]); thermo().getStandardChemPotentials(&m_grt[0]);
fill(m_rkc.begin(), m_rkc.end(), 0.0); fill(m_rkc.begin(), m_rkc.end(), 0.0);
int nsp = thermo().nSpecies(); for (size_t k = 0; k < thermo().nSpecies(); k++) {
for (int k = 0; k < nsp; k++) {
doublereal logStandConc_k = thermo().logStandardConc(k); doublereal logStandConc_k = thermo().logStandardConc(k);
m_grt[k] -= rt * logStandConc_k; m_grt[k] -= rt * logStandConc_k;
} }
@ -120,8 +119,7 @@ namespace Cantera {
thermo().getStandardChemPotentials(&m_grt[0]); thermo().getStandardChemPotentials(&m_grt[0]);
fill(rkc.begin(), rkc.end(), 0.0); fill(rkc.begin(), rkc.end(), 0.0);
doublereal rt = GasConstant * m_kdata->m_temp; doublereal rt = GasConstant * m_kdata->m_temp;
int nsp = thermo().nSpecies(); for (size_t k = 0; k < thermo().nSpecies(); k++) {
for (int k = 0; k < nsp; k++) {
doublereal logStandConc_k = thermo().logStandardConc(k); doublereal logStandConc_k = thermo().logStandardConc(k);
m_grt[k] -= rt * logStandConc_k; m_grt[k] -= rt * logStandConc_k;
} }
@ -445,18 +443,18 @@ namespace Cantera {
m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn
m_kdata->m_ropr.push_back(0.0); m_kdata->m_ropr.push_back(0.0);
m_kdata->m_ropnet.push_back(0.0); m_kdata->m_ropnet.push_back(0.0);
int n, ns, m; size_t n, ns, m;
doublereal nsFlt; doublereal nsFlt;
doublereal reactantGlobalOrder = 0.0; doublereal reactantGlobalOrder = 0.0;
doublereal productGlobalOrder = 0.0; doublereal productGlobalOrder = 0.0;
int rnum = reactionNumber(); int rnum = reactionNumber();
vector_int rk; std::vector<size_t> rk;
int nr = r.reactants.size(); size_t nr = r.reactants.size();
for (n = 0; n < nr; n++) { for (n = 0; n < nr; n++) {
nsFlt = r.rstoich[n]; nsFlt = r.rstoich[n];
reactantGlobalOrder += nsFlt; reactantGlobalOrder += nsFlt;
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((doublereal) ns != nsFlt) { if ((doublereal) ns != nsFlt) {
if (ns < 1) { if (ns < 1) {
ns = 1; ns = 1;
@ -470,12 +468,12 @@ namespace Cantera {
} }
m_reactants.push_back(rk); m_reactants.push_back(rk);
vector_int pk; std::vector<size_t> pk;
int np = r.products.size(); size_t np = r.products.size();
for (n = 0; n < np; n++) { for (n = 0; n < np; n++) {
nsFlt = r.pstoich[n]; nsFlt = r.pstoich[n];
productGlobalOrder += nsFlt; productGlobalOrder += nsFlt;
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((double) ns != nsFlt) { if ((double) ns != nsFlt) {
if (ns < 1) { if (ns < 1) {
ns = 1; ns = 1;
@ -506,7 +504,7 @@ namespace Cantera {
} }
void AqueousKinetics::installGroups(int irxn, void AqueousKinetics::installGroups(size_t irxn,
const vector<grouplist_t>& r, const vector<grouplist_t>& r,
const vector<grouplist_t>& p) { const vector<grouplist_t>& p) {
if (!r.empty()) { if (!r.empty()) {

View file

@ -336,7 +336,7 @@ namespace Cantera {
protected: protected:
int m_kk, m_nfall; size_t m_kk, m_nfall;
Rate1<Arrhenius> m_rates; Rate1<Arrhenius> m_rates;
@ -346,7 +346,7 @@ namespace Cantera {
ReactionStoichMgr* m_rxnstoich; ReactionStoichMgr* m_rxnstoich;
std::vector<int> m_fwdOrder; std::vector<size_t> m_fwdOrder;
int m_nirrev; int m_nirrev;
int m_nrev; int m_nrev;
@ -378,7 +378,7 @@ namespace Cantera {
private: private:
int reactionNumber(){ return m_ii;} size_t reactionNumber(){ return m_ii;}
std::vector<std::map<int, doublereal> > m_stoich; std::vector<std::map<int, doublereal> > m_stoich;
void addElementaryReaction(const ReactionData& r); void addElementaryReaction(const ReactionData& r);
@ -386,7 +386,7 @@ namespace Cantera {
void installReagents(const ReactionData& r); void installReagents(const ReactionData& r);
void installGroups(int irxn, const std::vector<grouplist_t>& r, void installGroups(size_t irxn, const std::vector<grouplist_t>& r,
const std::vector<grouplist_t>& p); const std::vector<grouplist_t>& p);
void updateKc(); void updateKc();

View file

@ -477,10 +477,10 @@ namespace Cantera {
// install high and low rate coeff calculators // install high and low rate coeff calculators
int iloc = m_falloff_high_rates.install(m_nfall, size_t iloc = m_falloff_high_rates.install(m_nfall,
r.rateCoeffType, r.rateCoeffType,
r.rateCoeffParameters.size(), r.rateCoeffParameters.size(),
&r.rateCoeffParameters[0] ); &r.rateCoeffParameters[0] );
m_falloff_low_rates.install( m_nfall, m_falloff_low_rates.install( m_nfall,
r.rateCoeffType, r.auxRateCoeffParameters.size(), r.rateCoeffType, r.auxRateCoeffParameters.size(),
@ -520,7 +520,7 @@ namespace Cantera {
void GasKinetics:: void GasKinetics::
addElementaryReaction(const ReactionData& r) { addElementaryReaction(const ReactionData& r) {
int iloc; size_t iloc;
// install rate coeff calculator // install rate coeff calculator
iloc = m_rates.install( reactionNumber(), iloc = m_rates.install( reactionNumber(),
@ -538,8 +538,7 @@ namespace Cantera {
void GasKinetics:: void GasKinetics::
addThreeBodyReaction(const ReactionData& r) { addThreeBodyReaction(const ReactionData& r) {
size_t iloc;
int iloc;
// install rate coeff calculator // install rate coeff calculator
iloc = m_rates.install( reactionNumber(), iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, r.rateCoeffParameters.size(), r.rateCoeffType, r.rateCoeffParameters.size(),
@ -562,18 +561,18 @@ namespace Cantera {
m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn
m_kdata->m_ropr.push_back(0.0); m_kdata->m_ropr.push_back(0.0);
m_kdata->m_ropnet.push_back(0.0); m_kdata->m_ropnet.push_back(0.0);
int n, ns, m; size_t n, ns, m;
doublereal nsFlt; doublereal nsFlt;
doublereal reactantGlobalOrder = 0.0; doublereal reactantGlobalOrder = 0.0;
doublereal productGlobalOrder = 0.0; doublereal productGlobalOrder = 0.0;
int rnum = reactionNumber(); size_t rnum = reactionNumber();
vector_int rk; std::vector<size_t> rk;
int nr = r.reactants.size(); size_t nr = r.reactants.size();
for (n = 0; n < nr; n++) { for (n = 0; n < nr; n++) {
nsFlt = r.rstoich[n]; nsFlt = r.rstoich[n];
reactantGlobalOrder += nsFlt; reactantGlobalOrder += nsFlt;
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((doublereal) ns != nsFlt) { if ((doublereal) ns != nsFlt) {
if (ns < 1) { if (ns < 1) {
ns = 1; ns = 1;
@ -587,12 +586,12 @@ namespace Cantera {
} }
m_reactants.push_back(rk); m_reactants.push_back(rk);
vector_int pk; std::vector<size_t> pk;
int np = r.products.size(); size_t np = r.products.size();
for (n = 0; n < np; n++) { for (n = 0; n < np; n++) {
nsFlt = r.pstoich[n]; nsFlt = r.pstoich[n];
productGlobalOrder += nsFlt; productGlobalOrder += nsFlt;
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((double) ns != nsFlt) { if ((double) ns != nsFlt) {
if (ns < 1) { if (ns < 1) {
ns = 1; ns = 1;

View file

@ -339,7 +339,7 @@ namespace Cantera {
protected: protected:
int m_kk, m_nfall; size_t m_kk, m_nfall;
array_int m_fallindx; array_int m_fallindx;
@ -347,7 +347,7 @@ namespace Cantera {
Rate1<Arrhenius> m_falloff_high_rates; Rate1<Arrhenius> m_falloff_high_rates;
Rate1<Arrhenius> m_rates; Rate1<Arrhenius> m_rates;
mutable std::map<int, std::pair<int, int> > m_index; mutable std::map<size_t, std::pair<int, size_t> > m_index;
FalloffMgr m_falloffn; FalloffMgr m_falloffn;
@ -358,7 +358,7 @@ namespace Cantera {
ReactionStoichMgr* m_rxnstoich; ReactionStoichMgr* m_rxnstoich;
std::vector<int> m_fwdOrder; std::vector<size_t> m_fwdOrder;
int m_nirrev; int m_nirrev;
int m_nrev; int m_nrev;
@ -391,7 +391,7 @@ namespace Cantera {
private: private:
int reactionNumber(){ return m_ii;} size_t reactionNumber(){ return m_ii;}
std::vector<std::map<int, doublereal> > m_stoich; std::vector<std::map<int, doublereal> > m_stoich;
void addElementaryReaction(const ReactionData& r); void addElementaryReaction(const ReactionData& r);
@ -404,8 +404,8 @@ namespace Cantera {
const std::vector<grouplist_t>& p); const std::vector<grouplist_t>& p);
void updateKc(); void updateKc();
void registerReaction(int rxnNumber, int type, int loc) { void registerReaction(size_t rxnNumber, int type, size_t loc) {
m_index[rxnNumber] = std::pair<int, int>(type, loc); m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
} }
bool m_finalized; bool m_finalized;
}; };

View file

@ -23,14 +23,14 @@ namespace Cantera {
*/ */
void Group::validate() { void Group::validate() {
int n = m_comp.size(); size_t n = m_comp.size();
// if already checked and not valid, return // if already checked and not valid, return
if (m_sign == -999) return; if (m_sign == -999) return;
m_sign = 0; m_sign = 0;
bool ok = true; bool ok = true;
for (int m = 0; m < n; m++) for (size_t m = 0; m < n; m++)
{ {
if (m_comp[m] != 0) if (m_comp[m] != 0)
{ {
@ -50,8 +50,8 @@ namespace Cantera {
s << "("; s << "(";
int nm; int nm;
bool first = true; bool first = true;
int n = m_comp.size(); size_t n = m_comp.size();
for (int m = 0; m < n; m++) { for (size_t m = 0; m < n; m++) {
nm = m_comp[m]; nm = m_comp[m];
if (nm != 0) { if (nm != 0) {
if (!first) s << "-"; if (!first) s << "-";

View file

@ -19,11 +19,18 @@ namespace Cantera {
class Group { class Group {
public: public:
Group() : m_sign(-999) { } Group() : m_sign(-999) { }
Group(int n) : m_sign(0) { m_comp.resize(n,0);} Group(size_t n) : m_sign(0) { m_comp.resize(n,0);}
Group(const vector_int& elnumbers) : Group(const std::vector<int>& elnumbers) :
m_comp(elnumbers), m_sign(0) { m_comp(elnumbers), m_sign(0) {
validate(); validate();
} }
Group(const std::vector<size_t>& elnumbers) :
m_comp(elnumbers.size()), m_sign(0) {
for (size_t i = 0; i < elnumbers.size(); i++) {
m_comp[i] = int(elnumbers[i]);
}
validate();
}
Group(const Group& g) : Group(const Group& g) :
m_comp(g.m_comp), m_sign(g.m_sign) { } m_comp(g.m_comp), m_sign(g.m_sign) { }
Group& operator=(const Group& g) { Group& operator=(const Group& g) {
@ -40,28 +47,24 @@ namespace Cantera {
*/ */
void operator-=(const Group& other) { void operator-=(const Group& other) {
verifyInputs(*this, other); verifyInputs(*this, other);
int n = m_comp.size(); for (size_t m = 0; m < m_comp.size(); m++)
for (int m = 0; m < n; m++)
m_comp[m] -= other.m_comp[m]; m_comp[m] -= other.m_comp[m];
validate(); validate();
} }
void operator+=(const Group& other) { void operator+=(const Group& other) {
verifyInputs(*this, other); verifyInputs(*this, other);
int n = m_comp.size(); for (size_t m = 0; m < m_comp.size(); m++)
for (int m = 0; m < n; m++)
m_comp[m] += other.m_comp[m]; m_comp[m] += other.m_comp[m];
validate(); validate();
} }
void operator*=(int a) { void operator*=(int a) {
int n = m_comp.size(); for (size_t m = 0; m < m_comp.size(); m++)
for (int m = 0; m < n; m++)
m_comp[m] *= a; m_comp[m] *= a;
validate(); validate();
} }
bool operator==(const Group& other) const { bool operator==(const Group& other) const {
verifyInputs(*this, other); verifyInputs(*this, other);
int n = m_comp.size(); for (size_t m = 0; m < m_comp.size(); m++) {
for (int m = 0; m < n; m++) {
if (m_comp[m] != other.m_comp[m]) return false; if (m_comp[m] != other.m_comp[m]) return false;
} }
return true; return true;
@ -96,17 +99,18 @@ namespace Cantera {
bool valid() const { return (m_sign != -999); } bool valid() const { return (m_sign != -999); }
bool operator!() const { return (m_sign == -999); } bool operator!() const { return (m_sign == -999); }
int sign() const { return m_sign; } int sign() const { return m_sign; }
int size() const { return m_comp.size(); } size_t size() const { return m_comp.size(); }
/// Number of atoms in the group (>= 0) /// Number of atoms in the group (>= 0)
int nAtoms() const { int nAtoms() const {
int n = m_comp.size();
int sum = 0; int sum = 0;
for (int m = 0; m < n; m++) sum += std::abs(m_comp[m]); for (size_t m = 0; m < m_comp.size(); m++) {
sum += std::abs(m_comp[m]);
}
return sum; return sum;
} }
/// Number of atoms of element m (positive or negative) /// Number of atoms of element m (positive or negative)
int nAtoms(int m) const { int nAtoms(size_t m) const {
if (m_comp.empty()) return 0; if (m_comp.empty()) return 0;
return m_comp[m]; return m_comp[m];
} }
@ -117,7 +121,7 @@ namespace Cantera {
const Group& g); const Group& g);
private: private:
vector_int m_comp; std::vector<int> m_comp;
int m_sign; int m_sign;
}; };

View file

@ -33,12 +33,12 @@ namespace Cantera {
m_commonTempPressForPhases(true), m_commonTempPressForPhases(true),
m_ioFlag(0) m_ioFlag(0)
{ {
m_nsurf = static_cast<int>(k.size()); m_nsurf = k.size();
int ns, nsp; size_t ns, nsp;
int nt, ntmax = 0; size_t nt, ntmax = 0;
int kinSpIndex = 0; size_t kinSpIndex = 0;
// Loop over the number of surface kinetics objects // Loop over the number of surface kinetics objects
for (int n = 0; n < m_nsurf; n++) { for (size_t n = 0; n < m_nsurf; n++) {
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();
@ -55,13 +55,13 @@ namespace Cantera {
m_specStartIndex.push_back(kinSpIndex); m_specStartIndex.push_back(kinSpIndex);
kinSpIndex += nsp; kinSpIndex += nsp;
int nPhases = kinPtr->nPhases(); size_t nPhases = kinPtr->nPhases();
vector_int pLocTmp(nPhases); vector_int pLocTmp(nPhases);
int imatch = -1; size_t imatch = -1;
for (int ip = 0; ip < nPhases; ip++) { for (size_t ip = 0; ip < nPhases; ip++) {
if (ip != ns) { if (ip != ns) {
ThermoPhase *thPtr = & kinPtr->thermo(ip); ThermoPhase *thPtr = & kinPtr->thermo(ip);
if ((imatch = checkMatch(m_bulkPhases, thPtr)) < 0) { if ((imatch = checkMatch(m_bulkPhases, thPtr)) == -1) {
m_bulkPhases.push_back(thPtr); m_bulkPhases.push_back(thPtr);
m_numBulkPhases++; m_numBulkPhases++;
nsp = thPtr->nSpecies(); nsp = thPtr->nSpecies();
@ -122,8 +122,8 @@ namespace Cantera {
void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc, void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc,
doublereal * c) doublereal * c)
{ {
int loc = 0; size_t loc = 0;
for (int n = 0; n < m_nsurf; n++) { for (size_t n = 0; n < m_nsurf; n++) {
m_surf[n]->getCoverages(c + loc); m_surf[n]->getCoverages(c + loc);
loc += m_nsp[n]; loc += m_nsp[n];
} }
@ -168,8 +168,8 @@ namespace Cantera {
} }
void ImplicitSurfChem::updateState(doublereal* c) { void ImplicitSurfChem::updateState(doublereal* c) {
int loc = 0; size_t loc = 0;
for (int n = 0; n < m_nsurf; n++) { for (size_t n = 0; n < m_nsurf; n++) {
m_surf[n]->setCoverages(c + loc); m_surf[n]->setCoverages(c + loc);
loc += m_nsp[n]; loc += m_nsp[n];
} }
@ -181,17 +181,16 @@ namespace Cantera {
void ImplicitSurfChem::eval(doublereal time, doublereal* y, void ImplicitSurfChem::eval(doublereal time, doublereal* y,
doublereal* ydot, doublereal* p) doublereal* ydot, doublereal* p)
{ {
int n;
updateState(y); // synchronize the surface state(s) with y updateState(y); // synchronize the surface state(s) with y
doublereal rs0, sum; doublereal rs0, sum;
int loc, k, kstart; size_t loc, kstart;
for (n = 0; n < m_nsurf; n++) { for (size_t n = 0; n < m_nsurf; n++) {
rs0 = 1.0/m_surf[n]->siteDensity(); rs0 = 1.0/m_surf[n]->siteDensity();
m_vecKinPtrs[n]->getNetProductionRates(DATA_PTR(m_work)); m_vecKinPtrs[n]->getNetProductionRates(DATA_PTR(m_work));
kstart = m_vecKinPtrs[n]->kineticsSpeciesIndex(0,m_surfindex[n]); kstart = m_vecKinPtrs[n]->kineticsSpeciesIndex(0,m_surfindex[n]);
sum = 0.0; sum = 0.0;
loc = 0; loc = 0;
for (k = 1; k < m_nsp[n]; k++) { for (size_t k = 1; k < m_nsp[n]; k++) {
ydot[k + loc] = m_work[kstart + k] * rs0 * m_surf[n]->size(k); ydot[k + loc] = m_work[kstart + k] * rs0 * m_surf[n]->size(k);
sum -= ydot[k]; sum -= ydot[k];
} }
@ -316,18 +315,17 @@ namespace Cantera {
* m_concSpecies[] * m_concSpecies[]
*/ */
void ImplicitSurfChem::getConcSpecies(doublereal * const vecConcSpecies) const { void ImplicitSurfChem::getConcSpecies(doublereal * const vecConcSpecies) const {
int kstart; size_t kstart;
for (int ip = 0; ip < m_nsurf; ip++) { for (size_t ip = 0; ip < m_nsurf; ip++) {
ThermoPhase * TP_ptr = m_surf[ip]; ThermoPhase * TP_ptr = m_surf[ip];
kstart = m_specStartIndex[ip]; kstart = m_specStartIndex[ip];
TP_ptr->getConcentrations(vecConcSpecies + kstart); TP_ptr->getConcentrations(vecConcSpecies + kstart);
} }
kstart = m_nv; kstart = m_nv;
for (int ip = 0; ip < m_numBulkPhases; ip++) { for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
ThermoPhase * TP_ptr = m_bulkPhases[ip]; ThermoPhase * TP_ptr = m_bulkPhases[ip];
int nsp = TP_ptr->nSpecies();
TP_ptr->getConcentrations(vecConcSpecies + kstart); TP_ptr->getConcentrations(vecConcSpecies + kstart);
kstart += nsp; kstart += TP_ptr->nSpecies();
} }
} }
@ -341,18 +339,17 @@ namespace Cantera {
* m_concSpecies[] * m_concSpecies[]
*/ */
void ImplicitSurfChem::setConcSpecies(const doublereal * const vecConcSpecies) { void ImplicitSurfChem::setConcSpecies(const doublereal * const vecConcSpecies) {
int kstart; size_t kstart;
for (int ip = 0; ip < m_nsurf; ip++) { for (size_t ip = 0; ip < m_nsurf; ip++) {
ThermoPhase * TP_ptr = m_surf[ip]; ThermoPhase * TP_ptr = m_surf[ip];
kstart = m_specStartIndex[ip]; kstart = m_specStartIndex[ip];
TP_ptr->setConcentrations(vecConcSpecies + kstart); TP_ptr->setConcentrations(vecConcSpecies + kstart);
} }
kstart = m_nv; kstart = m_nv;
for (int ip = 0; ip < m_numBulkPhases; ip++) { for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
ThermoPhase * TP_ptr = m_bulkPhases[ip]; ThermoPhase * TP_ptr = m_bulkPhases[ip];
int nsp = TP_ptr->nSpecies();
TP_ptr->setConcentrations(vecConcSpecies + kstart); TP_ptr->setConcentrations(vecConcSpecies + kstart);
kstart += nsp; kstart += TP_ptr->nSpecies();
} }
} }
@ -367,12 +364,11 @@ namespace Cantera {
*/ */
void ImplicitSurfChem:: void ImplicitSurfChem::
setCommonState_TP(doublereal TKelvin, doublereal PresPa) { setCommonState_TP(doublereal TKelvin, doublereal PresPa) {
int nphases = m_nsurf; for (size_t ip = 0; ip < m_nsurf; ip++) {
for (int ip = 0; ip < nphases; ip++) {
ThermoPhase *TP_ptr = m_surf[ip]; ThermoPhase *TP_ptr = m_surf[ip];
TP_ptr->setState_TP(TKelvin, PresPa); TP_ptr->setState_TP(TKelvin, PresPa);
} }
for (int ip = 0; ip < m_numBulkPhases; ip++) { for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
ThermoPhase *TP_ptr = m_bulkPhases[ip]; ThermoPhase *TP_ptr = m_bulkPhases[ip];
TP_ptr->setState_TP(TKelvin, PresPa); TP_ptr->setState_TP(TKelvin, PresPa);
} }

View file

@ -244,10 +244,10 @@ namespace Cantera {
std::vector<InterfaceKinetics*> m_vecKinPtrs; std::vector<InterfaceKinetics*> m_vecKinPtrs;
//! Vector of number of species in each Surface Phase //! Vector of number of species in each Surface Phase
vector_int m_nsp; std::vector<size_t> m_nsp;
//! index of the surface phase in each InterfaceKinetics object //! index of the surface phase in each InterfaceKinetics object
vector_int m_surfindex; std::vector<size_t> m_surfindex;
vector_int m_specStartIndex; vector_int m_specStartIndex;
@ -258,18 +258,18 @@ namespace Cantera {
* as there is a 1-1 correspondence between InterfaceKinetics objects * as there is a 1-1 correspondence between InterfaceKinetics objects
* and surface phases. * and surface phases.
*/ */
int m_nsurf; size_t m_nsurf;
//! Total number of surface species in all surface phases //! Total number of surface species in all surface phases
/*! /*!
* This is the total number of unknowns in m_mode 0 problem * This is the total number of unknowns in m_mode 0 problem
*/ */
int m_nv; size_t m_nv;
int m_numBulkPhases; size_t m_numBulkPhases;
vector_int m_nspBulkPhases; vector_int m_nspBulkPhases;
int m_numTotalBulkSpecies; size_t m_numTotalBulkSpecies;
int m_numTotalSpecies; size_t m_numTotalSpecies;
std::vector<vector_int> pLocVec; std::vector<vector_int> pLocVec;
//! Pointer to the cvode integrator //! Pointer to the cvode integrator

View file

@ -297,22 +297,20 @@ namespace Cantera {
* equilibrium constant set to zero. * equilibrium constant set to zero.
*/ */
void InterfaceKinetics::updateKc() { void InterfaceKinetics::updateKc() {
int i, irxn;
vector_fp& m_rkc = m_kdata->m_rkcn; vector_fp& m_rkc = m_kdata->m_rkcn;
fill(m_rkc.begin(), m_rkc.end(), 0.0); fill(m_rkc.begin(), m_rkc.end(), 0.0);
//static vector_fp mu(nTotalSpecies()); //static vector_fp mu(nTotalSpecies());
if (m_nrev > 0) { if (m_nrev > 0) {
int n, nsp, k, ik = 0; size_t nsp, ik = 0;
doublereal rt = GasConstant*thermo(0).temperature(); doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0 / rt; doublereal rrt = 1.0 / rt;
int np = nPhases(); size_t np = nPhases();
for (n = 0; n < np; n++) { for (size_t n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]); thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies(); nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
m_mu0[ik] -= rt * thermo(n).logStandardConc(k); m_mu0[ik] -= rt * thermo(n).logStandardConc(k);
m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k); m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
ik++; ik++;
@ -323,15 +321,15 @@ namespace Cantera {
m_rxnstoich.getRevReactionDelta(m_ii, DATA_PTR(m_mu0), m_rxnstoich.getRevReactionDelta(m_ii, DATA_PTR(m_mu0),
DATA_PTR(m_rkc)); DATA_PTR(m_rkc));
for (i = 0; i < m_nrev; i++) { for (size_t i = 0; i < m_nrev; i++) {
irxn = m_revindex[i]; size_t irxn = m_revindex[i];
if (irxn < 0 || irxn >= nReactions()) { if (irxn < 0 || irxn >= nReactions()) {
throw CanteraError("InterfaceKinetics", throw CanteraError("InterfaceKinetics",
"illegal value: irxn = "+int2str(irxn)); "illegal value: irxn = "+int2str(int(irxn)));
} }
m_rkc[irxn] = exp(m_rkc[irxn]*rrt); m_rkc[irxn] = exp(m_rkc[irxn]*rrt);
} }
for (i = 0; i != m_nirrev; ++i) { for (size_t i = 0; i != m_nirrev; ++i) {
m_rkc[ m_irrev[i] ] = 0.0; m_rkc[ m_irrev[i] ] = 0.0;
} }
} }
@ -350,15 +348,14 @@ namespace Cantera {
if (m_nrev > 0) { if (m_nrev > 0) {
doublereal rt = GasConstant*thermo(0).temperature(); doublereal rt = GasConstant*thermo(0).temperature();
cout << "T = " << thermo(0).temperature() << " " << rt << endl; cout << "T = " << thermo(0).temperature() << " " << rt << endl;
int n, nsp, k, ik=0; size_t nsp, ik=0;
//doublereal rt = GasConstant*thermo(0).temperature(); //doublereal rt = GasConstant*thermo(0).temperature();
// doublereal rrt = 1.0/rt; // doublereal rrt = 1.0/rt;
int np = nPhases();
doublereal delta; doublereal delta;
for (n = 0; n < np; n++) { for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getChemPotentials(DATA_PTR(dmu) + m_start[n]); thermo(n).getChemPotentials(DATA_PTR(dmu) + m_start[n]);
nsp = thermo(n).nSpecies(); nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
delta = Faraday * m_phi[n] * thermo(n).charge(k); delta = Faraday * m_phi[n] * thermo(n).charge(k);
//cout << thermo(n).speciesName(k) << " " << (delta+dmu[ik])/rt << " " << dmu[ik]/rt << endl; //cout << thermo(n).speciesName(k) << " " << (delta+dmu[ik])/rt << " " << dmu[ik]/rt << endl;
dmu[ik] += delta; dmu[ik] += delta;
@ -388,16 +385,14 @@ namespace Cantera {
* reversible or not. * reversible or not.
*/ */
void InterfaceKinetics::getEquilibriumConstants(doublereal* kc) { void InterfaceKinetics::getEquilibriumConstants(doublereal* kc) {
int i; size_t ik=0;
int n, nsp, k, ik=0;
doublereal rt = GasConstant*thermo(0).temperature(); doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt; doublereal rrt = 1.0/rt;
int np = nPhases(); int np = nPhases();
for (n = 0; n < np; n++) { for (size_t n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]); thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies(); size_t nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
m_mu0[ik] -= rt*thermo(n).logStandardConc(k); m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k); m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
ik++; ik++;
@ -408,7 +403,7 @@ namespace Cantera {
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), kc); m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), kc);
for (i = 0; i < m_ii; i++) { for (size_t i = 0; i < m_ii; i++) {
kc[i] = exp(-kc[i]*rrt); kc[i] = exp(-kc[i]*rrt);
} }
} }
@ -420,22 +415,20 @@ namespace Cantera {
* - m_mu0 * - m_mu0
* - m_logStandardConc * - m_logStandardConc
*/ */
int ik = 0; size_t ik = 0;
int np = nPhases();
for (int n = 0; n < np; n++) { for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]); thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
int nsp = thermo(n).nSpecies(); size_t nsp = thermo(n).nSpecies();
for (int k = 0; k < nsp; k++) { for (size_t k = 0; k < nsp; k++) {
m_StandardConc[ik] = thermo(n).standardConcentration(k); m_StandardConc[ik] = thermo(n).standardConcentration(k);
ik++; ik++;
} }
} }
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), DATA_PTR(m_deltaG0)); m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), DATA_PTR(m_deltaG0));
for (int i = 0; i < m_ii; i++) { for (size_t i = 0; i < m_ii; i++) {
m_ProdStanConcReac[i] = 1.0; m_ProdStanConcReac[i] = 1.0;
} }
@ -501,17 +494,11 @@ namespace Cantera {
* the correction applied * the correction applied
*/ */
void InterfaceKinetics::applyButlerVolmerCorrection(doublereal* const kf) { void InterfaceKinetics::applyButlerVolmerCorrection(doublereal* const kf) {
int i;
int n, nsp, k, ik=0;
doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt;
int np = nPhases();
// compute the electrical potential energy of each species // compute the electrical potential energy of each species
for (n = 0; n < np; n++) { size_t ik = 0;
nsp = thermo(n).nSpecies(); for (size_t n = 0; n < nPhases(); n++) {
for (k = 0; k < nsp; k++) { size_t nsp = thermo(n).nSpecies();
for (size_t k = 0; k < nsp; k++) {
m_pot[ik] = Faraday*thermo(n).charge(k)*m_phi[n]; m_pot[ik] = Faraday*thermo(n).charge(k)*m_phi[n];
ik++; ik++;
} }
@ -538,7 +525,7 @@ namespace Cantera {
#endif #endif
int nct = m_beta.size(); int nct = m_beta.size();
int irxn; int irxn;
for (i = 0; i < nct; i++) { for (size_t i = 0; i < nct; i++) {
irxn = m_ctrxn[i]; irxn = m_ctrxn[i];
eamod = m_beta[i]*m_rwork[irxn]; eamod = m_beta[i]*m_rwork[irxn];
// if (eamod != 0.0 && m_E[irxn] != 0.0) { // if (eamod != 0.0 && m_E[irxn] != 0.0) {
@ -556,6 +543,8 @@ namespace Cantera {
} }
} }
#endif #endif
doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt;
kf[irxn] *= exp(-eamod*rrt); kf[irxn] *= exp(-eamod*rrt);
} }
} }
@ -939,8 +928,8 @@ namespace Cantera {
m_rxnPhaseIsReactant.resize(m_ii, 0); m_rxnPhaseIsReactant.resize(m_ii, 0);
m_rxnPhaseIsProduct.resize(m_ii, 0); m_rxnPhaseIsProduct.resize(m_ii, 0);
int np = nPhases(); size_t np = nPhases();
int i = m_ii -1; size_t i = m_ii - 1;
m_rxnPhaseIsReactant[i] = new bool[np]; m_rxnPhaseIsReactant[i] = new bool[np];
m_rxnPhaseIsProduct[i] = new bool[np]; m_rxnPhaseIsProduct[i] = new bool[np];
@ -949,35 +938,31 @@ namespace Cantera {
m_rxnPhaseIsProduct[i][p] = false; m_rxnPhaseIsProduct[i][p] = false;
} }
const vector_int& vr = reactants(i); const std::vector<size_t>& vr = reactants(i);
for (int ik = 0; ik < (int) vr.size(); ik++) { for (size_t ik = 0; ik < vr.size(); ik++) {
int k = vr[ik]; size_t k = vr[ik];
int p = speciesPhaseIndex(k); size_t p = speciesPhaseIndex(k);
m_rxnPhaseIsReactant[i][p] = true; m_rxnPhaseIsReactant[i][p] = true;
} }
const vector_int& vp = products(i); const std::vector<size_t>& vp = products(i);
for (int ik = 0; ik < (int) vp.size(); ik++) { for (size_t ik = 0; ik < vp.size(); ik++) {
int k = vp[ik]; size_t k = vp[ik];
int p = speciesPhaseIndex(k); size_t p = speciesPhaseIndex(k);
m_rxnPhaseIsProduct[i][p] = true; m_rxnPhaseIsProduct[i][p] = true;
} }
} }
//==================================================================================================================== //====================================================================================================================
void InterfaceKinetics::addElementaryReaction(const ReactionData& r) { void InterfaceKinetics::addElementaryReaction(const ReactionData& r) {
int iloc;
// install rate coeff calculator // install rate coeff calculator
vector_fp rp = r.rateCoeffParameters; vector_fp rp = r.rateCoeffParameters;
int ncov = r.cov.size(); size_t ncov = r.cov.size();
if (ncov > 3) { if (ncov > 3) {
m_has_coverage_dependence = true; m_has_coverage_dependence = true;
} }
for (int m = 0; m < ncov; m++) { for (size_t m = 0; m < ncov; m++) {
rp.push_back(r.cov[m]); rp.push_back(r.cov[m]);
} }
// iloc = m_rates.install(reactionNumber(), r.rateCoeffType, rp.size(), DATA_PTR(rp)); size_t iloc = m_rates.install(reactionNumber(), ARRHENIUS_REACTION_RATECOEFF_TYPE, rp.size(), DATA_PTR(rp));
iloc = m_rates.install(reactionNumber(), ARRHENIUS_REACTION_RATECOEFF_TYPE, rp.size(), DATA_PTR(rp));
// store activation energy // store activation energy
m_E.push_back(r.rateCoeffParameters[2]); m_E.push_back(r.rateCoeffParameters[2]);
@ -1036,7 +1021,7 @@ namespace Cantera {
void InterfaceKinetics::installReagents(const ReactionData& r) { void InterfaceKinetics::installReagents(const ReactionData& r) {
int n, ns, m; size_t n, ns, m;
doublereal nsFlt; doublereal nsFlt;
/* /*
* extend temporary storage by one for this rxn. * extend temporary storage by one for this rxn.
@ -1059,11 +1044,11 @@ namespace Cantera {
// faster method 'multiply' can be used to compute the rate of // faster method 'multiply' can be used to compute the rate of
// progress instead of 'power'. // progress instead of 'power'.
vector_int rk; std::vector<size_t> rk;
int nr = r.reactants.size(); size_t nr = r.reactants.size();
for (n = 0; n < nr; n++) { for (n = 0; n < nr; n++) {
nsFlt = r.rstoich[n]; nsFlt = r.rstoich[n];
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((doublereal) ns != nsFlt) { if ((doublereal) ns != nsFlt) {
if (ns < 1) ns = 1; if (ns < 1) ns = 1;
} }
@ -1084,11 +1069,11 @@ namespace Cantera {
* of reactants for the rnum'th reaction * of reactants for the rnum'th reaction
*/ */
m_reactants.push_back(rk); m_reactants.push_back(rk);
vector_int pk; std::vector<size_t> pk;
int np = r.products.size(); size_t np = r.products.size();
for (n = 0; n < np; n++) { for (n = 0; n < np; n++) {
nsFlt = r.pstoich[n]; nsFlt = r.pstoich[n];
ns = (int) nsFlt; ns = (size_t) nsFlt;
if ((doublereal) ns != nsFlt) { if ((doublereal) ns != nsFlt) {
if (ns < 1) ns = 1; if (ns < 1) ns = 1;
} }

View file

@ -563,7 +563,7 @@ namespace Cantera {
* vector containing the reaction numbers of irreversible * vector containing the reaction numbers of irreversible
* reactions. * reactions.
*/ */
std::vector<int> m_irrev; std::vector<size_t> m_irrev;
//! Stoichiometric manager for the reaction mechanism //! Stoichiometric manager for the reaction mechanism
/*! /*!
@ -575,10 +575,10 @@ namespace Cantera {
ReactionStoichMgr m_rxnstoich; ReactionStoichMgr m_rxnstoich;
//! Number of irreversible reactions in the mechanism //! Number of irreversible reactions in the mechanism
int m_nirrev; size_t m_nirrev;
//! Number of reversible reactions in the mechanism //! Number of reversible reactions in the mechanism
int m_nrev; size_t m_nrev;
//! m_rrxn is a vector of maps, containing the reactant //! m_rrxn is a vector of maps, containing the reactant

View file

@ -130,10 +130,9 @@ namespace Cantera {
*/ */
void Kinetics::selectPhase(const doublereal* data, const thermo_t* phase, void Kinetics::selectPhase(const doublereal* data, const thermo_t* phase,
doublereal* phase_data) { doublereal* phase_data) {
int n, nsp, np = nPhases(); for (size_t n = 0; n < nPhases(); n++) {
for (n = 0; n < np; n++) {
if (phase == m_thermo[n]) { if (phase == m_thermo[n]) {
nsp = phase->nSpecies(); size_t nsp = phase->nSpecies();
copy(data + m_start[n], copy(data + m_start[n],
data + m_start[n] + nsp, phase_data); data + m_start[n] + nsp, phase_data);
return; return;
@ -153,9 +152,8 @@ namespace Cantera {
* the kinetics manager. If k is out of bounds, the string * the kinetics manager. If k is out of bounds, the string
* "<unknown>" is returned. * "<unknown>" is returned.
*/ */
string Kinetics::kineticsSpeciesName(int k) const { string Kinetics::kineticsSpeciesName(size_t k) const {
int np = m_start.size(); for (size_t n = m_start.size()-1; n >= 0; n--) {
for (int n = np-1; n >= 0; 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]);
} }
@ -179,15 +177,15 @@ namespace Cantera {
* the value -1 is returned. * the value -1 is returned.
* - If no match is found in any phase, the value -2 is returned. * - If no match is found in any phase, the value -2 is returned.
*/ */
int Kinetics::kineticsSpeciesIndex(std::string nm, std::string ph) const { size_t Kinetics::kineticsSpeciesIndex(std::string nm, std::string ph) const {
int np = static_cast<int>(m_thermo.size()); size_t np = m_thermo.size();
int k; size_t k;
string id; string id;
for (int n = 0; n < np; n++) { for (size_t n = 0; n < np; n++) {
id = thermo(n).id(); id = thermo(n).id();
if (ph == id) { if (ph == id) {
k = thermo(n).speciesIndex(nm); k = thermo(n).speciesIndex(nm);
if (k < 0) return -1; if (k == -1) return -1;
return k + m_start[n]; return k + m_start[n];
} }
else if (ph == "<any>") { else if (ph == "<any>") {
@ -209,12 +207,12 @@ namespace Cantera {
* Will throw an error if the species string doesn't match. * Will throw an error if the species string doesn't match.
*/ */
thermo_t& Kinetics::speciesPhase(std::string nm) { thermo_t& Kinetics::speciesPhase(std::string nm) {
int np = static_cast<int>(m_thermo.size()); size_t np = m_thermo.size();
int k; size_t k;
string id; string id;
for (int n = 0; n < np; n++) { for (size_t n = 0; n < np; n++) {
k = thermo(n).speciesIndex(nm); k = thermo(n).speciesIndex(nm);
if (k >= 0) return thermo(n); if (k != -1) return thermo(n);
} }
throw CanteraError("speciesPhase", "unknown species "+nm); throw CanteraError("speciesPhase", "unknown species "+nm);
return thermo(0); return thermo(0);

View file

@ -194,7 +194,7 @@ namespace Cantera {
virtual int type() const; virtual int type() const;
//! Number of reactions in the reaction mechanism. //! Number of reactions in the reaction mechanism.
int nReactions() const {return m_ii;} size_t nReactions() const {return m_ii;}
//@} //@}
@ -210,7 +210,7 @@ namespace Cantera {
* always return 1, but for a heterogeneous mechanism it will * always return 1, but for a heterogeneous mechanism it will
* return the total number of phases in the mechanism. * return the total number of phases in the mechanism.
*/ */
int nPhases() const { return static_cast<int>(m_thermo.size()); } size_t nPhases() const { return m_thermo.size(); }
/** /**
* Return the phase index of a phase in the list of phases * Return the phase index of a phase in the list of phases
@ -221,7 +221,7 @@ namespace Cantera {
* If a -1 is returned, then the phase is not defined in * If a -1 is returned, then the phase is not defined in
* the Kinetics object. * the Kinetics object.
*/ */
int phaseIndex(std::string ph) { size_t phaseIndex(std::string ph) {
if (m_phaseindex.find(ph) == m_phaseindex.end()) { if (m_phaseindex.find(ph) == m_phaseindex.end()) {
return -1; return -1;
} }
@ -261,8 +261,8 @@ namespace Cantera {
* *
* @param n Index of the ThermoPhase being sought. * @param n Index of the ThermoPhase being sought.
*/ */
thermo_t& thermo(int n=0) { return *m_thermo[n]; } thermo_t& thermo(size_t n=0) { return *m_thermo[n]; }
const thermo_t& thermo(int n=0) const { return *m_thermo[n]; } const thermo_t& thermo(size_t n=0) const { return *m_thermo[n]; }
/** /**
* This method returns a reference to the nth ThermoPhase * This method returns a reference to the nth ThermoPhase
@ -272,7 +272,7 @@ namespace Cantera {
* *
* @param n Index of the ThermoPhase being sought. * @param n Index of the ThermoPhase being sought.
*/ */
thermo_t& phase(int n=0) { thermo_t& phase(size_t n=0) {
deprecatedMethod("Kinetics","phase","thermo"); deprecatedMethod("Kinetics","phase","thermo");
return *m_thermo[n]; return *m_thermo[n];
} }
@ -284,7 +284,7 @@ namespace Cantera {
* *
* @param n Index of the ThermoPhase being sought. * @param n Index of the ThermoPhase being sought.
*/ */
const thermo_t& phase(int n=0) const { const thermo_t& phase(size_t n=0) const {
deprecatedMethod("Kinetics","phase","thermo"); deprecatedMethod("Kinetics","phase","thermo");
return *m_thermo[n]; return *m_thermo[n];
} }
@ -295,10 +295,10 @@ namespace Cantera {
* for use in calls to methods that return the species * for use in calls to methods that return the species
* production rates, for example. * production rates, for example.
*/ */
int nTotalSpecies() const { size_t nTotalSpecies() const {
int n=0, np; size_t n=0, np;
np = nPhases(); np = nPhases();
for (int p = 0; p < np; p++) n += thermo(p).nSpecies(); for (size_t p = 0; p < np; p++) n += thermo(p).nSpecies();
return n; return n;
} }
@ -309,7 +309,7 @@ namespace Cantera {
* @param n Return the index of first species in the nth phase * @param n Return the index of first species in the nth phase
* associated with the reaction mechanism. * associated with the reaction mechanism.
*/ */
int start(int n) { size_t start(size_t n) {
deprecatedMethod("Kinetics","start","kineticsSpeciesIndex(0,n)"); deprecatedMethod("Kinetics","start","kineticsSpeciesIndex(0,n)");
return m_start[n]; return m_start[n];
} }
@ -337,7 +337,7 @@ namespace Cantera {
* @param k species index * @param k species index
* @param n phase index for the species * @param n phase index for the species
*/ */
int kineticsSpeciesIndex(int k, int n) const { size_t kineticsSpeciesIndex(size_t k, size_t n) const {
return m_start[n] + k; return m_start[n] + k;
} }
@ -353,7 +353,7 @@ namespace Cantera {
* *
* @param k species index * @param k species index
*/ */
std::string kineticsSpeciesName(int k) const; std::string kineticsSpeciesName(size_t k) const;
/** /**
* This routine will look up a species number based on * This routine will look up a species number based on
@ -372,7 +372,7 @@ namespace Cantera {
* @param nm Input string name of the species * @param nm Input string name of the species
* @param ph Input string name of the phase. Defaults to "<any>" * @param ph Input string name of the phase. Defaults to "<any>"
*/ */
int kineticsSpeciesIndex(std::string nm, std::string ph = "<any>") const; size_t kineticsSpeciesIndex(std::string nm, std::string ph = "<any>") const;
/** /**
* This function looks up the std::string name of a species and * This function looks up the std::string name of a species and
@ -668,7 +668,7 @@ namespace Cantera {
* *
* @param i reaction index * @param i reaction index
*/ */
virtual const vector_int& reactants(int i) const { virtual const std::vector<size_t>& reactants(int i) const {
return m_reactants[i]; return m_reactants[i];
} }
@ -678,7 +678,7 @@ namespace Cantera {
* *
* @param i reaction index * @param i reaction index
*/ */
virtual const vector_int& products(int i) const { virtual const std::vector<size_t>& products(int i) const {
return m_products[i]; return m_products[i];
} }
@ -900,10 +900,10 @@ namespace Cantera {
//! Number of reactions in the mechanism //! Number of reactions in the mechanism
int m_ii; size_t m_ii;
//! Number of species in the species vector for this kinetics operator //! Number of species in the species vector for this kinetics operator
int m_nTotalSpecies; size_t m_nTotalSpecies;
/// Vector of perturbation factors for each reaction's rate of /// Vector of perturbation factors for each reaction's rate of
/// progress vector. It is initialized to one. /// progress vector. It is initialized to one.
@ -921,7 +921,7 @@ namespace Cantera {
* NOTE: These vectors will be wrong if there are real * NOTE: These vectors will be wrong if there are real
* stoichiometric coefficients in the expression. * stoichiometric coefficients in the expression.
*/ */
std::vector<vector_int> m_reactants; std::vector<std::vector<size_t> > m_reactants;
/** /**
* This is a vector of vectors containing the products for * This is a vector of vectors containing the products for
@ -934,7 +934,7 @@ namespace Cantera {
* NOTE: These vectors will be wrong if there are real * NOTE: These vectors will be wrong if there are real
* stoichiometric coefficients in the expression. * stoichiometric coefficients in the expression.
*/ */
std::vector<vector_int> m_products; std::vector<std::vector<size_t> > m_products;
//! m_thermo is a vector of pointers to ThermoPhase //! m_thermo is a vector of pointers to ThermoPhase
//! objects. //! objects.
@ -959,7 +959,7 @@ namespace Cantera {
* for the species vector for the n'th phase in the kinetics * for the species vector for the n'th phase in the kinetics
* class. * class.
*/ */
vector_int m_start; std::vector<size_t> m_start;
/** /**
* Mapping of the phase id, i.e., the id attribute in the xml * Mapping of the phase id, i.e., the id attribute in the xml
@ -971,18 +971,18 @@ namespace Cantera {
*/ */
std::map<std::string, int> m_phaseindex; std::map<std::string, int> m_phaseindex;
//! Index of the Kinetics Manager //! Index of the Kinetics Manager
int m_index; size_t m_index;
/** /**
* Index in the list of phases of the one surface phase. * Index in the list of phases of the one surface phase.
*/ */
int m_surfphase; size_t m_surfphase;
/** /**
* Index in the list of phases of the one phase where the reactions * Index in the list of phases of the one phase where the reactions
* occur. * occur.
*/ */
int m_rxnphase; size_t m_rxnphase;
/// number of spatial dimensions of lowest-dimensional phase. /// number of spatial dimensions of lowest-dimensional phase.
int m_mindim; int m_mindim;

View file

@ -35,8 +35,8 @@ namespace Cantera {
* @param m length of coefficient array * @param m length of coefficient array
* @param coefficients * @param coefficients
*/ */
int install( int rxnNumber, int rateType, int m, size_t install(size_t rxnNumber, int rateType, size_t m,
const doublereal* c ) { const doublereal* c) {
/* /*
* Check to see if the current reaction rate type * Check to see if the current reaction rate type
* is the same as the type of this class. If not, * is the same as the type of this class. If not,
@ -49,11 +49,11 @@ namespace Cantera {
// if any coefficient other than the first is non-zero, or // if any coefficient other than the first is non-zero, or
// if alwaysComputeRate() is true, install a rate // if alwaysComputeRate() is true, install a rate
// calculator and return the index of the calculator. // calculator and return the index of the calculator.
for (int i = 1; i < m; i++) { for (size_t i = 1; i < m; i++) {
if (c[i] != 0.0 || R::alwaysComputeRate() ) { if (c[i] != 0.0 || R::alwaysComputeRate() ) {
m_rxn.push_back(rxnNumber); m_rxn.push_back(rxnNumber);
m_rates.push_back(R(m, c)); m_rates.push_back(R(m, c));
return static_cast<int>(m_rates.size()) - 1; return m_rates.size() - 1;
} }
} }
return -1; return -1;
@ -111,7 +111,7 @@ namespace Cantera {
protected: protected:
std::vector<R> m_rates; std::vector<R> m_rates;
std::vector<int> m_rxn; std::vector<size_t> m_rxn;
array_fp m_const; // not used array_fp m_const; // not used
}; };
@ -128,8 +128,8 @@ namespace Cantera {
Rate2(){} Rate2(){}
virtual ~Rate2(){} virtual ~Rate2(){}
int install( int rxnNumber, int rateType, int m, int install(size_t rxnNumber, int rateType, size_t m,
const doublereal* c) { const doublereal* c) {
if (rateType == R1::type()) if (rateType == R1::type())
return m_r1.install(rxnNumber, rateType, m, c); return m_r1.install(rxnNumber, rateType, m, c);
else if (rateType == R2::type()) else if (rateType == R2::type())

View file

@ -38,8 +38,8 @@ namespace Cantera {
int number; int number;
int rxn_number; int rxn_number;
vector_int reactants; std::vector<size_t> reactants;
vector_int products; std::vector<size_t> products;
vector_fp rorder; vector_fp rorder;
vector_fp porder; vector_fp porder;
vector_fp rstoich; vector_fp rstoich;

View file

@ -480,20 +480,19 @@ namespace Cantera {
int ReactionPathBuilder::findGroups(ostream& logfile, Kinetics& s) int ReactionPathBuilder::findGroups(ostream& logfile, Kinetics& s)
{ {
m_groups.resize(m_nr); m_groups.resize(m_nr);
map<int, int> net;
for (int i = 0; i < m_nr; i++) // loop over reactions for (size_t i = 0; i < m_nr; i++) // loop over reactions
{ {
logfile << endl << "Reaction " << i+1 << ": " logfile << endl << "Reaction " << i+1 << ": "
<< s.reactionString(i); << s.reactionString(i);
int nrnet = m_reac[i].size(); size_t nrnet = m_reac[i].size();
int npnet = m_prod[i].size(); size_t npnet = m_prod[i].size();
const vector_int& r = s.reactants(i); const std::vector<size_t>& r = s.reactants(i);
const vector_int& p = s.products(i); const std::vector<size_t>& p = s.products(i);
int nr = s.reactants(i).size(); size_t nr = s.reactants(i).size();
int np = s.products(i).size(); size_t np = s.products(i).size();
Group b0, b1, bb; Group b0, b1, bb;
@ -501,7 +500,6 @@ namespace Cantera {
const vector<grouplist_t>& rgroups = s.reactantGroups(i); const vector<grouplist_t>& rgroups = s.reactantGroups(i);
const vector<grouplist_t>& pgroups = s.productGroups(i); const vector<grouplist_t>& pgroups = s.productGroups(i);
if (m_determinate[i]) { if (m_determinate[i]) {
logfile << " ... OK." << endl; logfile << " ... OK." << endl;
@ -509,27 +507,27 @@ namespace Cantera {
else if (rgroups.size() > 0) { else if (rgroups.size() > 0) {
logfile << " ... specified groups." << endl; logfile << " ... specified groups." << endl;
int nrg = static_cast<int>(rgroups.size()); size_t nrg = rgroups.size();
int npg = static_cast<int>(pgroups.size()); size_t npg = pgroups.size();
int kr, kp, ngrpr, ngrpp; size_t kr, kp, ngrpr, ngrpp;
Group gr, gp; Group gr, gp;
if (nrg != nr || npg != np) return -1; if (nrg != nr || npg != np) return -1;
// loop over reactants // loop over reactants
for (int igr = 0; igr < nrg; igr++) { for (size_t igr = 0; igr < nrg; igr++) {
kr = r[igr]; kr = r[igr];
ngrpr = static_cast<int>(rgroups[igr].size()); ngrpr = static_cast<int>(rgroups[igr].size());
// loop over products // loop over products
for (int igp = 0; igp < npg; igp++) { for (size_t igp = 0; igp < npg; igp++) {
kp = p[igp]; kp = p[igp];
ngrpp = static_cast<int>(pgroups[igp].size()); ngrpp = static_cast<int>(pgroups[igp].size());
// loop over pairs of reactant and product groups // loop over pairs of reactant and product groups
for (int kgr = 0; kgr < ngrpr; kgr++) { for (size_t kgr = 0; kgr < ngrpr; kgr++) {
gr = Group(rgroups[igr][kgr]); gr = Group(rgroups[igr][kgr]);
for (int kgp = 0; kgp < ngrpp; kgp++) { for (size_t kgp = 0; kgp < ngrpp; kgp++) {
gp = Group(pgroups[igp][kgp]); gp = Group(pgroups[igp][kgp]);
if (gr == gp) { if (gr == gp) {
m_transfer[i][kr][kp] = gr; m_transfer[i][kr][kp] = gr;
@ -543,12 +541,12 @@ namespace Cantera {
else if (nrnet == 2 && npnet == 2) else if (nrnet == 2 && npnet == 2)
{ {
// indices for the two reactants // indices for the two reactants
int kr0 = m_reac[i][0]; size_t kr0 = m_reac[i][0];
int kr1 = m_reac[i][1]; size_t kr1 = m_reac[i][1];
// indices for the two products // indices for the two products
int kp0 = m_prod[i][0]; size_t kp0 = m_prod[i][0];
int kp1 = m_prod[i][1]; size_t kp1 = m_prod[i][1];
// references to the Group objects representing the // references to the Group objects representing the
// reactants // reactants
@ -652,14 +650,13 @@ namespace Cantera {
string ename; string ename;
m_enamemap.clear(); m_enamemap.clear();
m_nel = 0; m_nel = 0;
int i, np = kin.nPhases(); size_t np = kin.nPhases();
ThermoPhase* p; ThermoPhase* p;
map<string, int> enamemap; for (size_t i = 0; i < np; i++) {
for (i = 0; i < np; i++) {
p = &kin.thermo(i); p = &kin.thermo(i);
// iterate over the elements in this phase // iterate over the elements in this phase
int m, nel = p->nElements(); size_t nel = p->nElements();
for (m = 0; m < nel; m++) { for (size_t m = 0; m < nel; m++) {
ename = p->elementName(m); ename = p->elementName(m);
// if no entry is found for this element name, then // if no entry is found for this element name, then
@ -675,18 +672,17 @@ namespace Cantera {
} }
m_atoms.resize(kin.nTotalSpecies(), m_nel, 0.0); m_atoms.resize(kin.nTotalSpecies(), m_nel, 0.0);
string sym; string sym;
int k, ip, nsp, mlocal, kp, m;
// iterate over the elements // iterate over the elements
for (m = 0; m < m_nel; m++) { for (size_t m = 0; m < m_nel; m++) {
sym = m_elementSymbols[m]; sym = m_elementSymbols[m];
k = 0; size_t k = 0;
// iterate over the phases // iterate over the phases
for (ip = 0; ip < np; ip++) { for (size_t ip = 0; ip < np; ip++) {
phase_t* p = &kin.thermo(ip); phase_t* p = &kin.thermo(ip);
nsp = p->nSpecies(); size_t nsp = p->nSpecies();
mlocal = p->elementIndex(sym); size_t mlocal = p->elementIndex(sym);
for (kp = 0; kp < nsp; kp++) { for (size_t kp = 0; kp < nsp; kp++) {
if (mlocal >= 0) { if (mlocal != -1) {
m_atoms(k, m) = p->nAtoms(kp, mlocal); m_atoms(k, m) = p->nAtoms(kp, mlocal);
} }
k++; k++;
@ -717,8 +713,8 @@ namespace Cantera {
// all reactants / products, even ones appearing on both sides // all reactants / products, even ones appearing on both sides
// of the reaction // of the reaction
// mod 8/18/01 dgg // mod 8/18/01 dgg
vector<vector_int > allProducts; vector<vector<size_t> > allProducts;
vector<vector_int > allReactants; vector<vector<size_t> > allReactants;
for (i = 0; i < m_nr; i++) { for (i = 0; i < m_nr; i++) {
allReactants.push_back(kin.reactants(i)); allReactants.push_back(kin.reactants(i));
allProducts.push_back(kin.products(i)); allProducts.push_back(kin.products(i));
@ -737,9 +733,9 @@ namespace Cantera {
m_x.resize(m_ns); // not currently used ? m_x.resize(m_ns); // not currently used ?
m_elatoms.resize(m_nel, m_nr); m_elatoms.resize(m_nel, m_nr);
int nr, np, n, k; size_t nr, np, n, k;
int nmol; size_t nmol;
map<int, int> net; map<size_t, int> net;
for (i = 0; i < m_nr; i++) { for (i = 0; i < m_nr; i++) {
@ -751,21 +747,21 @@ namespace Cantera {
net.clear(); net.clear();
nr = allReactants[i].size(); nr = allReactants[i].size();
np = allProducts[i].size(); np = allProducts[i].size();
for (int ir = 0; ir < nr; ir++) net[allReactants[i][ir]]--; for (size_t ir = 0; ir < nr; ir++) net[allReactants[i][ir]]--;
for (int ip = 0; ip < np; ip++) net[allProducts[i][ip]]++; for (size_t ip = 0; ip < np; ip++) net[allProducts[i][ip]]++;
for (k = 0; k < m_ns; k++) { for (k = 0; k < m_ns; k++) {
if (net[k] < 0) { if (net[k] < 0) {
nmol = -net[k]; nmol = -net[k];
for (int jr = 0; jr < nmol; jr++) m_reac[i].push_back(k); for (size_t jr = 0; jr < nmol; jr++) m_reac[i].push_back(k);
} }
else if (net[k] > 0) { else if (net[k] > 0) {
nmol = net[k]; nmol = net[k];
for (int jp = 0; jp < nmol; jp++) m_prod[i].push_back(k); for (size_t jp = 0; jp < nmol; jp++) m_prod[i].push_back(k);
} }
} }
int nrnet = m_reac[i].size(); size_t nrnet = m_reac[i].size();
// int npnet = m_prod[i].size(); // int npnet = m_prod[i].size();
// compute number of atoms of each element in each reaction, // compute number of atoms of each element in each reaction,
@ -775,7 +771,7 @@ namespace Cantera {
for (n = 0; n < nrnet; n++) { for (n = 0; n < nrnet; n++) {
k = m_reac[i][n]; k = m_reac[i][n];
for (int m = 0; m < m_nel; m++) { for (size_t m = 0; m < m_nel; m++) {
m_elatoms(m,i) += m_atoms(k,m); //ph.nAtoms(k,m); m_elatoms(m,i) += m_atoms(k,m); //ph.nAtoms(k,m);
} }
} }
@ -784,8 +780,7 @@ namespace Cantera {
// build species groups // build species groups
vector_int comp(m_nel); vector_int comp(m_nel);
m_sgroup.resize(m_ns); m_sgroup.resize(m_ns);
int j; for (size_t j = 0; j < m_ns; j++) {
for (j = 0; j < m_ns; j++) {
for (int m = 0; m < m_nel; m++) comp[m] = int(m_atoms(j,m)); //ph.nAtoms(j,m)); for (int m = 0; m < m_nel; m++) comp[m] = int(m_atoms(j,m)); //ph.nAtoms(j,m));
m_sgroup[j] = Group(comp); m_sgroup[j] = Group(comp);
} }
@ -807,11 +802,11 @@ namespace Cantera {
for (m = 0; m < m_nel; m++) { for (m = 0; m < m_nel; m++) {
nar = 0; nar = 0;
nap = 0; nap = 0;
for (j = 0; j < nr; j++) { for (size_t j = 0; j < nr; j++) {
// if (ph.nAtoms(m_reac[i][j],m) > 0) nar++; // if (ph.nAtoms(m_reac[i][j],m) > 0) nar++;
if (m_atoms(m_reac[i][j],m) > 0) nar++; if (m_atoms(m_reac[i][j],m) > 0) nar++;
} }
for (j = 0; j < np; j++) { for (size_t j = 0; j < np; j++) {
if (m_atoms(m_prod[i][j],m) > 0) nap++; if (m_atoms(m_prod[i][j],m) > 0) nap++;
} }
if (nar > 1 && nap > 1) { if (nar > 1 && nap > 1) {
@ -824,13 +819,12 @@ namespace Cantera {
return 1; return 1;
} }
string reactionLabel(int i, int kr, int nr, const vector_int& slist, string reactionLabel(size_t i, size_t kr, size_t nr,
const Kinetics& s) { const std::vector<size_t>& slist, const Kinetics& s) {
//int np = s.nPhases(); //int np = s.nPhases();
string label = ""; string label = "";
int l; for (size_t l = 0; l < nr; l++) {
for (l = 0; l < nr; l++) {
if (l != kr) if (l != kr)
label += " + "+ s.kineticsSpeciesName(slist[l]); label += " + "+ s.kineticsSpeciesName(slist[l]);
} }
@ -845,7 +839,6 @@ namespace Cantera {
int ReactionPathBuilder::build(Kinetics& s, int ReactionPathBuilder::build(Kinetics& s,
string element, ostream& output, ReactionPathDiagram& r, bool quiet) string element, ostream& output, ReactionPathDiagram& r, bool quiet)
{ {
int i, nr, np, kr, kp, kkr, kkp;
doublereal f, ropf, ropr, fwd, rev; doublereal f, ropf, ropr, fwd, rev;
string fwdlabel, revlabel; string fwdlabel, revlabel;
map<int, int> warn; map<int, int> warn;
@ -854,13 +847,10 @@ namespace Cantera {
bool fwd_incl, rev_incl, force_incl; bool fwd_incl, rev_incl, force_incl;
// const Kinetics::thermo_t& ph = s.thermo(); // const Kinetics::thermo_t& ph = s.thermo();
int 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 < 0) return -1;
//int k;
int kk = s.nTotalSpecies();
s.getFwdRatesOfProgress(DATA_PTR(m_ropf)); s.getFwdRatesOfProgress(DATA_PTR(m_ropf));
s.getRevRatesOfProgress(DATA_PTR(m_ropr)); s.getRevRatesOfProgress(DATA_PTR(m_ropr));
@ -876,17 +866,15 @@ namespace Cantera {
// species explicitly included or excluded // species explicitly included or excluded
vector<string>& in_nodes = r.included(); vector<string>& in_nodes = r.included();
vector<string>& out_nodes = r.excluded(); vector<string>& out_nodes = r.excluded();
int nin = static_cast<int>(in_nodes.size());
int nout = static_cast<int>(out_nodes.size());
vector_int status; vector_int status;
status.resize(kk,0); status.resize(s.nTotalSpecies(), 0);
for (int ni = 0; ni < nin; ni++) for (size_t ni = 0; ni < in_nodes.size(); ni++)
status[s.kineticsSpeciesIndex(in_nodes[ni])] = 1; status[s.kineticsSpeciesIndex(in_nodes[ni])] = 1;
for (int ne = 0; ne < nout; ne++) for (size_t ne = 0; ne < out_nodes.size(); ne++)
status[s.kineticsSpeciesIndex(out_nodes[ne])] = -1; status[s.kineticsSpeciesIndex(out_nodes[ne])] = -1;
for (i = 0; i < m_nr; i++) for (size_t i = 0; i < m_nr; i++)
{ {
ropf = m_ropf[i]; ropf = m_ropf[i];
ropr = m_ropr[i]; ropr = m_ropr[i];
@ -894,21 +882,20 @@ namespace Cantera {
// loop over reactions involving element m // loop over reactions involving element m
if (m_elatoms(m, i) > 0) if (m_elatoms(m, i) > 0)
{ {
nr = m_reac[i].size(); size_t nr = m_reac[i].size();
np = m_prod[i].size(); size_t np = m_prod[i].size();
for (kr = 0; kr < nr; kr++) for (size_t kr = 0; kr < nr; kr++)
{ {
kkr = m_reac[i][kr]; size_t kkr = m_reac[i][kr];
int l;
fwdlabel = reactionLabel(i, kr, nr, m_reac[i], s); fwdlabel = reactionLabel(i, kr, nr, m_reac[i], s);
for (kp = 0; kp < np; kp++) for (size_t kp = 0; kp < np; kp++)
{ {
kkp = m_prod[i][kp]; size_t kkp = m_prod[i][kp];
revlabel = ""; revlabel = "";
for (l = 0; l < np; l++) { for (size_t l = 0; l < np; l++) {
if (l != kp) if (l != kp)
revlabel += " + "+ s.kineticsSpeciesName(m_prod[i][l]); revlabel += " + "+ s.kineticsSpeciesName(m_prod[i][l]);
} }
@ -938,7 +925,7 @@ namespace Cantera {
if ( (m_atoms(kkp,m) < m_elatoms(m, i)) && if ( (m_atoms(kkp,m) < m_elatoms(m, i)) &&
(m_atoms(kkr,m) < m_elatoms(m, i)) ) (m_atoms(kkr,m) < m_elatoms(m, i)) )
{ {
map<int, map<int, Group> >& g = m_transfer[i]; map<size_t, map<size_t, Group> >& g = m_transfer[i];
if (g.empty()) { if (g.empty()) {
if (!warn[i]) { if (!warn[i]) {
if (!quiet) { if (!quiet) {

View file

@ -250,23 +250,23 @@ namespace Cantera {
protected: protected:
void findElements(Kinetics& kin); void findElements(Kinetics& kin);
int m_nr; size_t m_nr;
int m_ns; size_t m_ns;
int m_nel; size_t m_nel;
vector_fp m_ropf; vector_fp m_ropf;
vector_fp m_ropr; vector_fp m_ropr;
array_fp m_x; array_fp m_x;
std::vector<vector_int> m_reac; std::vector<std::vector<size_t> > m_reac;
std::vector<vector_int> m_prod; std::vector<std::vector<size_t> > m_prod;
DenseMatrix m_elatoms; DenseMatrix m_elatoms;
std::vector<std::vector<int> > m_groups; std::vector<std::vector<int> > m_groups;
std::vector<Group> m_sgroup; std::vector<Group> m_sgroup;
std::vector<std::string> m_elementSymbols; std::vector<std::string> m_elementSymbols;
// std::map<int, int> m_warn; // std::map<int, int> m_warn;
std::map<int, std::map<int, std::map<int, Group> > > m_transfer; std::map<size_t, std::map<size_t, std::map<size_t, Group> > > m_transfer;
std::vector<bool> m_determinate; std::vector<bool> m_determinate;
Array2D m_atoms; Array2D m_atoms;
std::map<std::string,int> m_enamemap; std::map<std::string, size_t> m_enamemap;
}; };
} }

View file

@ -41,7 +41,8 @@ namespace Cantera {
void ReactionStoichMgr:: void ReactionStoichMgr::
add(int rxn, const vector_int& reactants, const vector_int& products, add(int rxn, const std::vector<size_t>& reactants,
const std::vector<size_t>& products,
bool reversible) { bool reversible) {
m_reactants->add(rxn, reactants); m_reactants->add(rxn, reactants);
@ -56,15 +57,14 @@ namespace Cantera {
void ReactionStoichMgr:: void ReactionStoichMgr::
add(int rxn, const ReactionData& r) { add(int rxn, const ReactionData& r) {
vector_int rk; std::vector<size_t> rk;
doublereal frac; doublereal frac;
bool isfrac = false; bool isfrac = false;
int n, ns, m, nr = r.reactants.size(); for (size_t n = 0; n < r.reactants.size(); n++) {
for (n = 0; n < nr; n++) { size_t ns = size_t(r.rstoich[n]);
ns = int(r.rstoich[n]);
frac = r.rstoich[n] - 1.0*int(r.rstoich[n]); frac = r.rstoich[n] - 1.0*int(r.rstoich[n]);
if (frac != 0.0) isfrac = true; if (frac != 0.0) isfrac = true;
for (m = 0; m < ns; m++) { for (size_t m = 0; m < ns; m++) {
rk.push_back(r.reactants[n]); rk.push_back(r.reactants[n]);
} }
} }
@ -84,14 +84,13 @@ namespace Cantera {
#endif #endif
} }
vector_int pk; std::vector<size_t> pk;
isfrac = false; isfrac = false;
int np = r.products.size(); for (size_t n = 0; n < r.products.size(); n++) {
for (n = 0; n < np; n++) { size_t ns = size_t(r.pstoich[n]);
ns = int(r.pstoich[n]);
frac = r.pstoich[n] - 1.0*int(r.pstoich[n]); frac = r.pstoich[n] - 1.0*int(r.pstoich[n]);
if (frac != 0.0) isfrac = true; if (frac != 0.0) isfrac = true;
for (m = 0; m < ns; m++) { for (size_t m = 0; m < ns; m++) {
pk.push_back(r.products[n]); pk.push_back(r.products[n]);
} }
} }
@ -118,7 +117,7 @@ namespace Cantera {
} }
void ReactionStoichMgr:: void ReactionStoichMgr::
getCreationRates(int nsp, const doublereal* ropf, getCreationRates(size_t nsp, const doublereal* ropf,
const doublereal* ropr, doublereal* c) { const doublereal* ropr, doublereal* c) {
// zero out the output array // zero out the output array
fill(c, c + nsp, 0.0); fill(c, c + nsp, 0.0);
@ -132,7 +131,7 @@ namespace Cantera {
} }
void ReactionStoichMgr:: void ReactionStoichMgr::
getDestructionRates(int nsp, const doublereal* ropf, getDestructionRates(size_t nsp, const doublereal* ropf,
const doublereal* ropr, doublereal* d) { const doublereal* ropr, doublereal* d) {
fill(d, d + nsp, 0.0); fill(d, d + nsp, 0.0);
// the reverse direction destroys products in reversible reactions // the reverse direction destroys products in reversible reactions
@ -142,7 +141,7 @@ namespace Cantera {
} }
void ReactionStoichMgr:: void ReactionStoichMgr::
getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w) { getNetProductionRates(size_t nsp, const doublereal* ropnet, doublereal* w) {
fill(w, w + nsp, 0.0); fill(w, w + nsp, 0.0);
// products are created for positive net rate of progress // products are created for positive net rate of progress
m_revproducts->incrementSpecies(ropnet, w); m_revproducts->incrementSpecies(ropnet, w);
@ -196,11 +195,11 @@ namespace Cantera {
writeCreationRates(ostream& f) { writeCreationRates(ostream& f) {
f << " void getCreationRates(const doublereal* rf, const doublereal* rb," << endl; f << " void getCreationRates(const doublereal* rf, const doublereal* rb," << endl;
f << " doublereal* c) {" << endl; f << " doublereal* c) {" << endl;
map<int, string> out; map<size_t, string> out;
m_revproducts->writeIncrementSpecies("rf",out); m_revproducts->writeIncrementSpecies("rf",out);
m_irrevproducts->writeIncrementSpecies("rf",out); m_irrevproducts->writeIncrementSpecies("rf",out);
m_reactants->writeIncrementSpecies("rb",out); m_reactants->writeIncrementSpecies("rb",out);
map<int, string>::iterator b; map<size_t, string>::iterator b;
for (b = out.begin(); b != out.end(); ++b) { for (b = out.begin(); b != out.end(); ++b) {
string rhs = wrapString(b->second); string rhs = wrapString(b->second);
rhs[1] = '='; rhs[1] = '=';
@ -213,10 +212,10 @@ namespace Cantera {
writeDestructionRates(ostream& f) { writeDestructionRates(ostream& f) {
f << " void getDestructionRates(const doublereal* rf, const doublereal* rb," << endl; f << " void getDestructionRates(const doublereal* rf, const doublereal* rb," << endl;
f << " doublereal* d) {" << endl; f << " doublereal* d) {" << endl;
map<int, string> out; map<size_t, string> out;
m_revproducts->writeIncrementSpecies("rb",out); m_revproducts->writeIncrementSpecies("rb",out);
m_reactants->writeIncrementSpecies("rf",out); m_reactants->writeIncrementSpecies("rf",out);
map<int, string>::iterator b; map<size_t, string>::iterator b;
for (b = out.begin(); b != out.end(); ++b) { for (b = out.begin(); b != out.end(); ++b) {
string rhs = wrapString(b->second); string rhs = wrapString(b->second);
rhs[1] = '='; rhs[1] = '=';
@ -228,11 +227,11 @@ namespace Cantera {
void ReactionStoichMgr:: void ReactionStoichMgr::
writeNetProductionRates(ostream& f) { writeNetProductionRates(ostream& f) {
f << " void getNetProductionRates(const doublereal* r, doublereal* w) {" << endl; f << " void getNetProductionRates(const doublereal* r, doublereal* w) {" << endl;
map<int, string> out; map<size_t, string> out;
m_revproducts->writeIncrementSpecies("r",out); m_revproducts->writeIncrementSpecies("r",out);
m_irrevproducts->writeIncrementSpecies("r",out); m_irrevproducts->writeIncrementSpecies("r",out);
m_reactants->writeDecrementSpecies("r",out); m_reactants->writeDecrementSpecies("r",out);
map<int, string>::iterator b; map<size_t, string>::iterator b;
for (b = out.begin(); b != out.end(); ++b) { for (b = out.begin(); b != out.end(); ++b) {
string rhs = wrapString(b->second); string rhs = wrapString(b->second);
rhs[1] = '='; rhs[1] = '=';
@ -244,9 +243,9 @@ namespace Cantera {
void ReactionStoichMgr:: void ReactionStoichMgr::
writeMultiplyReactants(ostream& f) { writeMultiplyReactants(ostream& f) {
f << " void multiplyReactants(const doublereal* c, doublereal* r) {" << endl; f << " void multiplyReactants(const doublereal* c, doublereal* r) {" << endl;
map<int, string> out; map<size_t, string> out;
m_reactants->writeMultiply("c",out); m_reactants->writeMultiply("c",out);
map<int, string>::iterator b; map<size_t, string>::iterator b;
for (b = out.begin(); b != out.end(); ++b) { for (b = out.begin(); b != out.end(); ++b) {
string rhs = b->second; string rhs = b->second;
f << " r[" << b->first << "] *= " << rhs << ";" << endl; f << " r[" << b->first << "] *= " << rhs << ";" << endl;
@ -257,9 +256,9 @@ namespace Cantera {
void ReactionStoichMgr:: void ReactionStoichMgr::
writeMultiplyRevProducts(ostream& f) { writeMultiplyRevProducts(ostream& f) {
f << " void multiplyRevProducts(const doublereal* c, doublereal* r) {" << endl; f << " void multiplyRevProducts(const doublereal* c, doublereal* r) {" << endl;
map<int, string> out; map<size_t, string> out;
m_revproducts->writeMultiply("c",out); m_revproducts->writeMultiply("c",out);
map<int, string>::iterator b; map<size_t, string>::iterator b;
for (b = out.begin(); b != out.end(); ++b) { for (b = out.begin(); b != out.end(); ++b) {
string rhs = b->second; string rhs = b->second;
f << " r[" << b->first << "] *= " << rhs << ";" << endl; f << " r[" << b->first << "] *= " << rhs << ";" << endl;

View file

@ -89,8 +89,8 @@ namespace Cantera {
* @param products vector of integer product indices * @param products vector of integer product indices
* @param reversible true if the reaction is reversible, false otherwise * @param reversible true if the reaction is reversible, false otherwise
*/ */
virtual void add(int rxn, const vector_int& reactants, const vector_int& products, virtual void add(int rxn, const std::vector<size_t>& reactants,
bool reversible); const std::vector<size_t>& products, bool reversible);
/** /**
* Add a reaction with specified, possibly non-integral, reaction orders. * Add a reaction with specified, possibly non-integral, reaction orders.
@ -120,7 +120,7 @@ namespace Cantera {
* C = N_p Q_f + N_r Q_r. * C = N_p Q_f + N_r Q_r.
* \f] * \f]
*/ */
virtual void getCreationRates(int nSpecies, virtual void getCreationRates(size_t nSpecies,
const doublereal* fwdRatesOfProgress, const doublereal* fwdRatesOfProgress,
const doublereal* revRatesOfProgress, const doublereal* revRatesOfProgress,
doublereal* creationRates); doublereal* creationRates);
@ -137,7 +137,7 @@ namespace Cantera {
* Note that the stoichiometric coefficient matrices are very sparse, integer * Note that the stoichiometric coefficient matrices are very sparse, integer
* matrices. * matrices.
*/ */
virtual void getDestructionRates(int nSpecies, virtual void getDestructionRates(size_t nSpecies,
const doublereal* fwdRatesOfProgress, const doublereal* fwdRatesOfProgress,
const doublereal* revRatesOfProgress, const doublereal* revRatesOfProgress,
doublereal* destructionRates); doublereal* destructionRates);
@ -157,7 +157,7 @@ namespace Cantera {
* W = (N_r - N_p) Q_{\rm net}, * W = (N_r - N_p) Q_{\rm net},
* \f] * \f]
*/ */
virtual void getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w); virtual void getNetProductionRates(size_t nsp, const doublereal* ropnet, doublereal* w);

View file

@ -37,7 +37,7 @@ namespace Cantera {
m_A(0.0) {} m_A(0.0) {}
/// Constructor with Arrhenius parameters specified with an array. /// Constructor with Arrhenius parameters specified with an array.
Arrhenius(int csize, const doublereal* c) : Arrhenius(size_t csize, const doublereal* c) :
m_b (c[1]), m_b (c[1]),
m_E (c[2]), m_E (c[2]),
m_A (c[0]) m_A (c[0])

View file

@ -147,7 +147,7 @@ namespace Cantera {
return 0.0; return 0.0;
} }
inline static std::string fmt(std::string r, int n) { return r + "[" + int2str(n) + "]"; } inline static std::string fmt(std::string r, size_t n) { return r + "[" + int2str(int(n)) + "]"; }
/** /**
@ -159,10 +159,10 @@ namespace Cantera {
public: public:
C1( int rxn = 0, int ic0 = 0) C1(size_t rxn = 0, size_t ic0 = 0)
: m_rxn (rxn), m_ic0 (ic0) {} : m_rxn (rxn), m_ic0 (ic0) {}
int data(std::vector<int>& ic) { size_t data(std::vector<size_t>& ic) {
ic.resize(1); ic.resize(1);
ic[0] = m_ic0; ic[0] = m_ic0;
return m_rxn; return m_rxn;
@ -188,31 +188,31 @@ namespace Cantera {
R[m_rxn] -= S[m_ic0]; R[m_rxn] -= S[m_ic0];
} }
int rxnNumber() const { return m_rxn; } size_t rxnNumber() const { return m_rxn; }
int speciesIndex(int n) const { return m_ic0; } size_t speciesIndex(size_t n) const { return m_ic0; }
int nSpecies() { return 1;} size_t nSpecies() { return 1;}
void writeMultiply(std::string r, std::map<int, std::string>& out) { void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0); out[m_rxn] = fmt(r, m_ic0);
} }
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) { void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0); out[m_rxn] += " + "+fmt(r, m_ic0);
} }
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) { void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0); out[m_rxn] += " - "+fmt(r, m_ic0);
} }
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) { void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
out[m_ic0] += " + "+fmt(r, m_rxn); out[m_ic0] += " + "+fmt(r, m_rxn);
} }
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) { void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
out[m_ic0] += " - "+fmt(r, m_rxn); out[m_ic0] += " - "+fmt(r, m_rxn);
} }
private: private:
int m_rxn; size_t m_rxn;
int m_ic0; size_t m_ic0;
}; };
@ -223,10 +223,10 @@ namespace Cantera {
*/ */
class C2 { class C2 {
public: public:
C2( int rxn = 0, int ic0 = 0, int ic1 = 0) C2(size_t rxn = 0, size_t ic0 = 0, size_t ic1 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {} : m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {}
int data(std::vector<int>& ic) { int data(std::vector<size_t>& ic) {
ic.resize(2); ic.resize(2);
ic[0] = m_ic0; ic[0] = m_ic0;
ic[1] = m_ic1; ic[1] = m_ic1;
@ -255,26 +255,26 @@ namespace Cantera {
R[m_rxn] -= (S[m_ic0] + S[m_ic1]); R[m_rxn] -= (S[m_ic0] + S[m_ic1]);
} }
int rxnNumber() const { return m_rxn; } size_t rxnNumber() const { return m_rxn; }
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : m_ic1); } size_t speciesIndex(size_t n) const { return (n == 0 ? m_ic0 : m_ic1); }
int nSpecies() { return 2;} size_t nSpecies() { return 2;}
void writeMultiply(std::string r, std::map<int, std::string>& out) { void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1); out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1);
} }
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) { void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1); out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1);
} }
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) { void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1); out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1);
} }
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) { void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = " + "+fmt(r, m_rxn); std::string s = " + "+fmt(r, m_rxn);
out[m_ic0] += s; out[m_ic0] += s;
out[m_ic1] += s; out[m_ic1] += s;
} }
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) { void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = " - "+fmt(r, m_rxn); std::string s = " - "+fmt(r, m_rxn);
out[m_ic0] += s; out[m_ic0] += s;
out[m_ic1] += s; out[m_ic1] += s;
@ -285,13 +285,13 @@ namespace Cantera {
/** /**
* Reaction index -> index into the ROP vector * Reaction index -> index into the ROP vector
*/ */
int m_rxn; size_t m_rxn;
/** /**
* Species indecise -> index into the species vector for the * Species indecise -> index into the species vector for the
* two species. * two species.
*/ */
int m_ic0, m_ic1; size_t m_ic0, m_ic1;
}; };
@ -301,10 +301,10 @@ namespace Cantera {
*/ */
class C3 { class C3 {
public: public:
C3( int rxn = 0, int ic0 = 0, int ic1 = 0, int ic2 = 0) C3(size_t rxn = 0, size_t ic0 = 0, size_t ic1 = 0, size_t ic2 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1), m_ic2 (ic2) {} : m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1), m_ic2 (ic2) {}
int data(std::vector<int>& ic) { int data(std::vector<size_t>& ic) {
ic.resize(3); ic.resize(3);
ic[0] = m_ic0; ic[0] = m_ic0;
ic[1] = m_ic1; ic[1] = m_ic1;
@ -336,33 +336,33 @@ namespace Cantera {
R[m_rxn] -= (S[m_ic0] + S[m_ic1] + S[m_ic2]); R[m_rxn] -= (S[m_ic0] + S[m_ic1] + S[m_ic2]);
} }
int rxnNumber() const { return m_rxn; } size_t rxnNumber() const { return m_rxn; }
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : (n == 1 ? m_ic1 : m_ic2)); } size_t speciesIndex(size_t n) const { return (n == 0 ? m_ic0 : (n == 1 ? m_ic1 : m_ic2)); }
int nSpecies() { return 3;} size_t nSpecies() { return 3;}
void writeMultiply(std::string r, std::map<int, std::string>& out) { void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2); out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2);
} }
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) { void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2); out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2);
} }
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) { void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2); out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2);
} }
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) { void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = " + "+fmt(r, m_rxn); std::string s = " + "+fmt(r, m_rxn);
out[m_ic0] += s; out[m_ic0] += s;
out[m_ic1] += s; out[m_ic1] += s;
out[m_ic2] += s; out[m_ic2] += s;
} }
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) { void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = " - "+fmt(r, m_rxn); std::string s = " - "+fmt(r, m_rxn);
out[m_ic0] += s; out[m_ic0] += s;
out[m_ic1] += s; out[m_ic1] += s;
out[m_ic2] += s; out[m_ic2] += s;
} }
private: private:
int m_rxn, m_ic0, m_ic1, m_ic2; size_t m_rxn, m_ic0, m_ic1, m_ic2;
}; };
@ -375,34 +375,33 @@ namespace Cantera {
public: public:
C_AnyN() : m_rxn (-1) {} C_AnyN() : m_rxn (-1) {}
C_AnyN( int rxn, const vector_int& ic, const vector_fp& order, C_AnyN(size_t rxn, const std::vector<size_t>& ic, const vector_fp& order,
const vector_fp& stoich) const vector_fp& stoich)
: m_rxn (rxn) { : m_rxn (rxn) {
m_n = ic.size(); m_n = ic.size();
m_ic.resize(m_n); m_ic.resize(m_n);
m_order.resize(m_n); m_order.resize(m_n);
m_stoich.resize(m_n); m_stoich.resize(m_n);
for (int n = 0; n < m_n; n++) { for (size_t n = 0; n < m_n; n++) {
m_ic[n] = ic[n]; m_ic[n] = ic[n];
m_order[n] = order[n]; m_order[n] = order[n];
m_stoich[n] = stoich[n]; m_stoich[n] = stoich[n];
} }
} }
int data(std::vector<int>& ic) { size_t data(std::vector<size_t>& ic) {
ic.resize(m_n); ic.resize(m_n);
int n; for (size_t n = 0; n < m_n; n++) ic[n] = m_ic[n];
for (n = 0; n < m_n; n++) ic[n] = m_ic[n];
return m_rxn; return m_rxn;
} }
doublereal order(int n) const {return m_order[n];} doublereal order(size_t n) const {return m_order[n];}
doublereal stoich(int n) const {return m_stoich[n];} doublereal stoich(size_t n) const {return m_stoich[n];}
int speciesIndex(int n) const {return m_ic[n];} size_t speciesIndex(size_t n) const {return m_ic[n];}
void multiply(const doublereal* input, doublereal* output) const { void multiply(const doublereal* input, doublereal* output) const {
doublereal oo; doublereal oo;
for (int n = 0; n < m_n; n++) { for (size_t n = 0; n < m_n; n++) {
oo = m_order[n]; oo = m_order[n];
if (oo != 0.0) { if (oo != 0.0) {
output[m_rxn] *= ppow(input[m_ic[n]], oo); output[m_rxn] *= ppow(input[m_ic[n]], oo);
@ -413,31 +412,30 @@ namespace Cantera {
void incrementSpecies(const doublereal* input, void incrementSpecies(const doublereal* input,
doublereal* output) const { doublereal* output) const {
doublereal x = input[m_rxn]; doublereal x = input[m_rxn];
for (int n = 0; n < m_n; n++) output[m_ic[n]] += m_stoich[n]*x; for (size_t n = 0; n < m_n; n++) output[m_ic[n]] += m_stoich[n]*x;
} }
void decrementSpecies(const doublereal* input, void decrementSpecies(const doublereal* input,
doublereal* output) const { doublereal* output) const {
doublereal x = input[m_rxn]; doublereal x = input[m_rxn];
for (int n = 0; n < m_n; n++) output[m_ic[n]] -= m_stoich[n]*x; for (size_t n = 0; n < m_n; n++) output[m_ic[n]] -= m_stoich[n]*x;
} }
void incrementReaction(const doublereal* input, void incrementReaction(const doublereal* input,
doublereal* output) const { doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn] for (size_t n = 0; n < m_n; n++) output[m_rxn]
+= m_stoich[n]*input[m_ic[n]]; += m_stoich[n]*input[m_ic[n]];
} }
void decrementReaction(const doublereal* input, void decrementReaction(const doublereal* input,
doublereal* output) const { doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn] for (size_t n = 0; n < m_n; n++) output[m_rxn]
-= m_stoich[n]*input[m_ic[n]]; -= m_stoich[n]*input[m_ic[n]];
} }
void writeMultiply(std::string r, std::map<int, std::string>& out) { void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
int n;
out[m_rxn] = ""; out[m_rxn] = "";
for (n = 0; n < m_n; n++) { for (size_t n = 0; n < m_n; n++) {
if (m_order[n] == 1.0) if (m_order[n] == 1.0)
out[m_rxn] += fmt(r, m_ic[n]); out[m_rxn] += fmt(r, m_ic[n]);
else else
@ -446,30 +444,26 @@ namespace Cantera {
out[m_rxn] += " * "; out[m_rxn] += " * ";
} }
} }
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) { void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
int n; for (size_t n = 0; n < m_n; n++) {
for (n = 0; n < m_n; n++) {
out[m_rxn] += " + "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]); out[m_rxn] += " + "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
} }
} }
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) { void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
int n; for (size_t n = 0; n < m_n; n++) {
for (n = 0; n < m_n; n++) {
out[m_rxn] += " - "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]); out[m_rxn] += " - "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
} }
} }
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) { void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = fmt(r, m_rxn); std::string s = fmt(r, m_rxn);
int n; for (size_t n = 0; n < m_n; n++) {
for (n = 0; n < m_n; n++) {
out[m_ic[n]] += " + "+fp2str(m_stoich[n]) + "*" + s; out[m_ic[n]] += " + "+fp2str(m_stoich[n]) + "*" + s;
} }
} }
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) { void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
std::string s = fmt(r, m_rxn); std::string s = fmt(r, m_rxn);
int n; for (size_t n = 0; n < m_n; n++) {
for (n = 0; n < m_n; n++) {
out[m_ic[n]] += " - "+fp2str(m_stoich[n]) + "*" + s; out[m_ic[n]] += " - "+fp2str(m_stoich[n]) + "*" + s;
} }
} }
@ -481,13 +475,13 @@ namespace Cantera {
* This is the number of species which have non-zero entries in either the * This is the number of species which have non-zero entries in either the
* reaction order matrix or the stoichiometric order matrix for this reaction. * reaction order matrix or the stoichiometric order matrix for this reaction.
*/ */
int m_n; size_t m_n;
//! ID of the reaction corresponding to this stoichiometric manager //! ID of the reaction corresponding to this stoichiometric manager
/*! /*!
* This is used within the interface to select the * This is used within the interface to select the
*/ */
int m_rxn; size_t m_rxn;
//! Vector of species which are involved with this stoichiometric manager calculations //! Vector of species which are involved with this stoichiometric manager calculations
/*! /*!
@ -495,7 +489,7 @@ namespace Cantera {
* reaction order matrix or the stoichiometric order matrix for this reaction, m_rxn. * reaction order matrix or the stoichiometric order matrix for this reaction, m_rxn.
* It's used as the index into the arrays m_order[] and m_stoich[]. * It's used as the index into the arrays m_order[] and m_stoich[].
*/ */
vector_int m_ic; std::vector<size_t> m_ic;
vector_fp m_order; vector_fp m_order;
vector_fp m_stoich; vector_fp m_stoich;
}; };
@ -539,31 +533,31 @@ namespace Cantera {
template<class InputIter> template<class InputIter>
inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r, inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) { std::map<size_t, std::string>& out) {
for (; begin != end; ++begin) begin->writeIncrementSpecies(r, out); for (; begin != end; ++begin) begin->writeIncrementSpecies(r, out);
} }
template<class InputIter> template<class InputIter>
inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r, inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) { std::map<size_t, std::string>& out) {
for (; begin != end; ++begin) begin->writeDecrementSpecies(r, out); for (; begin != end; ++begin) begin->writeDecrementSpecies(r, out);
} }
template<class InputIter> template<class InputIter>
inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r, inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) { std::map<size_t, std::string>& out) {
for (; begin != end; ++begin) begin->writeIncrementReaction(r, out); for (; begin != end; ++begin) begin->writeIncrementReaction(r, out);
} }
template<class InputIter> template<class InputIter>
inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r, inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) { std::map<size_t, std::string>& out) {
for (; begin != end; ++begin) begin->writeDecrementReaction(r, out); for (; begin != end; ++begin) begin->writeDecrementReaction(r, out);
} }
template<class InputIter> template<class InputIter>
inline static void _writeMultiply(InputIter begin, InputIter end, std::string r, inline static void _writeMultiply(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) { std::map<size_t, std::string>& out) {
for (; begin != end; ++begin) begin->writeMultiply(r, out); for (; begin != end; ++begin) begin->writeMultiply(r, out);
} }
@ -632,13 +626,13 @@ namespace Cantera {
* the order of each species in the power list expression is * the order of each species in the power list expression is
* set to one automatically. * set to one automatically.
*/ */
void add(int rxn, const vector_int& k) { void add(size_t rxn, const std::vector<size_t>& k) {
vector_fp order(k.size(), 1.0); vector_fp order(k.size(), 1.0);
vector_fp stoich(k.size(), 1.0); vector_fp stoich(k.size(), 1.0);
add(rxn, k, order, stoich); add(rxn, k, order, stoich);
} }
void add(int rxn, const vector_int& k, const vector_fp& order) { void add(size_t rxn, const std::vector<size_t>& k, const vector_fp& order) {
vector_fp stoich(k.size(), 1.0); vector_fp stoich(k.size(), 1.0);
add(rxn, k, order, stoich); add(rxn, k, order, stoich);
} }
@ -661,35 +655,33 @@ namespace Cantera {
* @param stoich This is used to handle fractional stoichiometric coefficients * @param stoich This is used to handle fractional stoichiometric coefficients
* on the product side of irreversible reactions. * on the product side of irreversible reactions.
*/ */
void add(int rxn, const vector_int& k, const vector_fp& order, void add(size_t rxn, const std::vector<size_t>& k, const vector_fp& order,
const vector_fp& stoich) { const vector_fp& stoich) {
m_n[rxn] = static_cast<int>(k.size()); m_n[rxn] = k.size();
int ns = stoich.size();
int n;
bool frac = false; bool frac = false;
for (n = 0; n < ns; n++) { for (size_t n = 0; n < stoich.size(); n++) {
if (stoich[n] != 1.0) frac = true; if (stoich[n] != 1.0) frac = true;
} }
if (frac) { if (frac) {
m_loc[rxn] = static_cast<int>(m_cn_list.size()); m_loc[rxn] = m_cn_list.size();
m_cn_list.push_back(C_AnyN(rxn, k, order, stoich)); m_cn_list.push_back(C_AnyN(rxn, k, order, stoich));
} }
else { else {
switch (k.size()) { switch (k.size()) {
case 1: case 1:
m_loc[rxn] = static_cast<int>(m_c1_list.size()); m_loc[rxn] = m_c1_list.size();
m_c1_list.push_back(C1(rxn, k[0])); m_c1_list.push_back(C1(rxn, k[0]));
break; break;
case 2: case 2:
m_loc[rxn] = static_cast<int>(m_c2_list.size()); m_loc[rxn] = m_c2_list.size();
m_c2_list.push_back(C2(rxn, k[0], k[1])); m_c2_list.push_back(C2(rxn, k[0], k[1]));
break; break;
case 3: case 3:
m_loc[rxn] = static_cast<int>(m_c3_list.size()); m_loc[rxn] = m_c3_list.size();
m_c3_list.push_back(C3(rxn, k[0], k[1], k[2])); m_c3_list.push_back(C3(rxn, k[0], k[1], k[2]));
break; break;
default: default:
m_loc[rxn] = static_cast<int>(m_cn_list.size()); m_loc[rxn] = m_cn_list.size();
m_cn_list.push_back(C_AnyN(rxn, k, order, stoich)); m_cn_list.push_back(C_AnyN(rxn, k, order, stoich));
} }
} }
@ -730,35 +722,35 @@ namespace Cantera {
_decrementReactions(m_cn_list.begin(), m_cn_list.end(), input, output); _decrementReactions(m_cn_list.begin(), m_cn_list.end(), input, output);
} }
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) { void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
_writeIncrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out); _writeIncrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeIncrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out); _writeIncrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeIncrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out); _writeIncrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeIncrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out); _writeIncrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
} }
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) { void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
_writeDecrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out); _writeDecrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeDecrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out); _writeDecrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeDecrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out); _writeDecrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeDecrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out); _writeDecrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
} }
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) { void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
_writeIncrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out); _writeIncrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeIncrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out); _writeIncrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeIncrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out); _writeIncrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeIncrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out); _writeIncrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
} }
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) { void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
_writeDecrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out); _writeDecrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeDecrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out); _writeDecrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeDecrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out); _writeDecrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeDecrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out); _writeDecrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
} }
void writeMultiply(std::string r, std::map<int, std::string>& out) { void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
_writeMultiply(m_c1_list.begin(), m_c1_list.end(), r, out); _writeMultiply(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeMultiply(m_c2_list.begin(), m_c2_list.end(), r, out); _writeMultiply(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeMultiply(m_c3_list.begin(), m_c3_list.end(), r, out); _writeMultiply(m_c3_list.begin(), m_c3_list.end(), r, out);
@ -776,12 +768,12 @@ namespace Cantera {
* Std::Mapping with the Reaction Number as key and the Number of species * Std::Mapping with the Reaction Number as key and the Number of species
* as the value. * as the value.
*/ */
std::map<int, int> m_n; std::map<size_t, size_t> m_n;
/** /**
* Std::Mapping with the Reaction Number as key and the placement in the * Std::Mapping with the Reaction Number as key and the placement in the
* vector of reactions list( i.e., m_c1_list[]) as key * vector of reactions list( i.e., m_c1_list[]) as key
*/ */
std::map<int, int> m_loc; std::map<size_t, size_t> m_loc;
}; };
#undef INCL_STOICH_WRITER #undef INCL_STOICH_WRITER

View file

@ -84,7 +84,6 @@ namespace Cantera {
*/ */
void checkRxnElementBalance(Kinetics& kin, void checkRxnElementBalance(Kinetics& kin,
const ReactionData &rdata, doublereal errorTolerance) { const ReactionData &rdata, doublereal errorTolerance) {
int index, klocal, n, kp, kr, m, nel;
doublereal kstoich; doublereal kstoich;
map<string, double> bal, balr, balp; map<string, double> bal, balr, balp;
@ -92,17 +91,16 @@ namespace Cantera {
balp.clear(); balp.clear();
balr.clear(); balr.clear();
//cout << "checking " << rdata.equation << endl; //cout << "checking " << rdata.equation << endl;
int np = rdata.products.size(); size_t np = rdata.products.size();
// iterate over the products // iterate over the products
for (index = 0; index < np; index++) { for (size_t index = 0; index < np; index++) {
kp = rdata.products[index]; // index of the product in 'kin' size_t kp = rdata.products[index]; // index of the product in 'kin'
n = kin.speciesPhaseIndex(kp); // phase this product belongs to size_t n = kin.speciesPhaseIndex(kp); // phase this product belongs to
klocal = kp - kin.kineticsSpeciesIndex(0,n); // index within this phase size_t klocal = kp - kin.kineticsSpeciesIndex(0,n); // index within this phase
kstoich = rdata.pstoich[index]; // product stoichiometric coeff kstoich = rdata.pstoich[index]; // product stoichiometric coeff
const ThermoPhase& ph = kin.speciesPhase(kp); const ThermoPhase& ph = kin.speciesPhase(kp);
nel = ph.nElements(); for (size_t m = 0; m < ph.nElements(); m++) {
for (m = 0; m < nel; m++) {
bal[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m); bal[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
balp[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m); balp[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
//cout << "product species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m) //cout << "product species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m)
@ -110,15 +108,14 @@ namespace Cantera {
} }
} }
int nr = rdata.reactants.size(); int nr = rdata.reactants.size();
for (index = 0; index < nr; index++) { for (size_t index = 0; index < nr; index++) {
kr = rdata.reactants[index]; size_t kr = rdata.reactants[index];
n = kin.speciesPhaseIndex(kr); size_t n = kin.speciesPhaseIndex(kr);
//klocal = kr - kin.start(n); //klocal = kr - kin.start(n);
klocal = kr - kin.kineticsSpeciesIndex(0,n); size_t klocal = kr - kin.kineticsSpeciesIndex(0,n);
kstoich = rdata.rstoich[index]; kstoich = rdata.rstoich[index];
const ThermoPhase& ph = kin.speciesPhase(kr); const ThermoPhase& ph = kin.speciesPhase(kr);
nel = ph.nElements(); for (size_t m = 0; m < ph.nElements(); m++) {
for (m = 0; m < nel; m++) {
bal[ph.elementName(m)] -= kstoich*ph.nAtoms(klocal,m); bal[ph.elementName(m)] -= kstoich*ph.nAtoms(klocal,m);
balr[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m); balr[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
//cout << "reactant species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m) //cout << "reactant species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m)
@ -179,9 +176,8 @@ namespace Cantera {
* and continue. * and continue.
*/ */
bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp, bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp,
std::string default_phase, std::string default_phase, std::vector<size_t>& spnum,
vector_int& spnum, vector_fp& stoich, vector_fp& order, vector_fp& stoich, vector_fp& order, int rule) {
int rule) {
string rptype; string rptype;
@ -203,16 +199,13 @@ namespace Cantera {
vector<string> key, val; vector<string> key, val;
getPairs(rg, key, val); getPairs(rg, key, val);
int ns = static_cast<int>(key.size());
/* /*
* Loop over each of the pairs and process them * Loop over each of the pairs and process them
*/ */
int isp;
doublereal ord, stch; doublereal ord, stch;
string ph, sp; string ph, sp;
map<string, int> speciesMap; map<string, size_t> speciesMap;
for (int n = 0; n < ns; n++) { for (size_t n = 0; n < key.size(); n++) {
sp = key[n]; // sp is the string name for species sp = key[n]; // sp is the string name for species
ph = ""; ph = "";
/* /*
@ -220,8 +213,8 @@ namespace Cantera {
* member function kineticsSpeciesIndex(). We will search * member function kineticsSpeciesIndex(). We will search
* for the species in all phases defined in the kinetics operator. * for the species in all phases defined in the kinetics operator.
*/ */
isp = kin.kineticsSpeciesIndex(sp,"<any>"); size_t isp = kin.kineticsSpeciesIndex(sp,"<any>");
if (isp < 0) { if (isp == -2) {
if (rule == 1) if (rule == 1)
return false; return false;
else { else {
@ -257,13 +250,11 @@ namespace Cantera {
if (rp == 1 && rxn.hasChild("order")) { if (rp == 1 && rxn.hasChild("order")) {
vector<XML_Node*> ord; vector<XML_Node*> ord;
rxn.getChildren("order",ord); rxn.getChildren("order",ord);
int norder = static_cast<int>(ord.size());
int loc;
doublereal forder; doublereal forder;
for (int nn = 0; nn < norder; nn++) { for (size_t nn = 0; nn < ord.size(); nn++) {
const XML_Node& oo = *ord[nn]; const XML_Node& oo = *ord[nn];
string sp = oo["species"]; string sp = oo["species"];
loc = speciesMap[sp]; size_t loc = speciesMap[sp];
if (loc == 0) if (loc == 0)
throw CanteraError("getReagents", throw CanteraError("getReagents",
"reaction order specified for non-reactantt: " "reaction order specified for non-reactantt: "
@ -322,9 +313,9 @@ namespace Cantera {
*/ */
static void getStick(const XML_Node& node, Kinetics& kin, static void getStick(const XML_Node& node, Kinetics& kin,
ReactionData& r, doublereal& A, doublereal& b, doublereal& E) { ReactionData& r, doublereal& A, doublereal& b, doublereal& E) {
int nr = r.reactants.size(); size_t nr = r.reactants.size();
int k, klocal, not_surf = 0; size_t k, klocal, not_surf = 0;
int np = 0; size_t np = 0;
doublereal f = 1.0; doublereal f = 1.0;
doublereal order; doublereal order;
/* /*
@ -336,9 +327,9 @@ namespace Cantera {
*/ */
string spname = node["species"]; string spname = node["species"];
ThermoPhase& th = kin.speciesPhase(spname); ThermoPhase& th = kin.speciesPhase(spname);
int isp = th.speciesIndex(spname); size_t isp = th.speciesIndex(spname);
int ispKinetics = kin.kineticsSpeciesIndex(spname); size_t ispKinetics = kin.kineticsSpeciesIndex(spname);
int ispPhaseIndex = kin.speciesPhaseIndex(ispKinetics); size_t ispPhaseIndex = kin.speciesPhaseIndex(ispKinetics);
doublereal ispMW = th.molecularWeights()[isp]; doublereal ispMW = th.molecularWeights()[isp];
doublereal sc; doublereal sc;
@ -398,7 +389,7 @@ namespace Cantera {
thermo_t& surfphase, ReactionData& rdata) { thermo_t& surfphase, ReactionData& rdata) {
vector<XML_Node*> cov; vector<XML_Node*> cov;
node.getChildren("coverage", cov); node.getChildren("coverage", cov);
int k, nc = static_cast<int>(cov.size()); size_t k, nc = cov.size();
doublereal e; doublereal e;
string spname; string spname;
if (nc > 0) { if (nc > 0) {

View file

@ -93,8 +93,8 @@ namespace Cantera {
*/ */
bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp, bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp,
std::string default_phase, std::string default_phase,
vector_int& spnum, vector_fp& stoich, vector_fp& order, std::vector<size_t>& spnum, vector_fp& stoich,
int rule); vector_fp& order, int rule);
//! Read the rate coefficient data from the XML file. //! Read the rate coefficient data from the XML file.
/*! /*!

View file

@ -129,8 +129,8 @@ namespace Cantera {
} }
m_maxTotSpecies = 0; m_maxTotSpecies = 0;
for (int n = 0; n < m_numSurfPhases; n++) { for (size_t n = 0; n < m_numSurfPhases; n++) {
int tsp = m_objects[n]->nTotalSpecies(); size_t tsp = m_objects[n]->nTotalSpecies();
m_maxTotSpecies = MAX(m_maxTotSpecies, tsp); m_maxTotSpecies = MAX(m_maxTotSpecies, tsp);
} }
m_maxTotSpecies = MAX(m_maxTotSpecies, m_neq); m_maxTotSpecies = MAX(m_maxTotSpecies, m_neq);

View file

@ -591,7 +591,7 @@ namespace Cantera {
//! Maximum number of species in any single kinetics operator //! Maximum number of species in any single kinetics operator
//! -> also maxed wrt the total # of solution species //! -> also maxed wrt the total # of solution species
int m_maxTotSpecies; size_t m_maxTotSpecies;
//! Temporary vector with length equal to max m_maxTotSpecies //! Temporary vector with length equal to max m_maxTotSpecies
vector_fp m_netProductionRatesSave; vector_fp m_netProductionRatesSave;

View file

@ -9,12 +9,12 @@ namespace Cantera {
// sort (x,y) pairs by x // sort (x,y) pairs by x
void heapsort(vector_fp& x, std::vector<size_t>& y) { void heapsort(vector_fp& x, std::vector<size_t>& y) {
int n = x.size(); size_t n = x.size();
if (n < 2) return; if (n < 2) return;
doublereal rra; doublereal rra;
integer rrb; size_t rrb;
int ll = n/2; size_t ll = n/2;
int iret = n-1; size_t iret = n-1;
while (1 > 0) { while (1 > 0) {
if (ll > 0) { if (ll > 0) {
@ -35,8 +35,8 @@ namespace Cantera {
} }
} }
int i = ll; size_t i = ll;
int j = ll + ll + 1; size_t j = ll + ll + 1;
while (j <= iret) { while (j <= iret) {
if (j < iret) { if (j < iret) {
@ -59,12 +59,12 @@ namespace Cantera {
} }
void heapsort(vector_fp& x, vector_fp& y) { void heapsort(vector_fp& x, vector_fp& y) {
int n = x.size(); size_t n = x.size();
if (n < 2) return; if (n < 2) return;
doublereal rra; doublereal rra;
doublereal rrb; doublereal rrb;
int ll = n/2; size_t ll = n/2;
int iret = n-1; size_t iret = n-1;
while (1 > 0) { while (1 > 0) {
if (ll > 0) { if (ll > 0) {
@ -85,8 +85,8 @@ namespace Cantera {
} }
} }
int i = ll; size_t i = ll;
int j = ll + ll + 1; size_t j = ll + ll + 1;
while (j <= iret) { while (j <= iret) {
if (j < iret) { if (j < iret) {

View file

@ -743,8 +743,7 @@ namespace Cantera {
_init(m_nsp+1); _init(m_nsp+1);
m_fixed_cov.resize(m_nsp, 0.0); m_fixed_cov.resize(m_nsp, 0.0);
m_fixed_cov[0] = 1.0; m_fixed_cov[0] = 1.0;
int nt = m_kin->nTotalSpecies(); m_work.resize(m_kin->nTotalSpecies(), 0.0);
m_work.resize(nt, 0.0);
// set bounds // set bounds
vector_fp lower(m_nv), upper(m_nv); vector_fp lower(m_nv), upper(m_nv);

View file

@ -26,7 +26,7 @@ namespace Cantera {
m_index(0) { m_index(0) {
} }
ConstCpPoly::ConstCpPoly(int n, doublereal tlow, doublereal thigh, ConstCpPoly::ConstCpPoly(size_t n, doublereal tlow, doublereal thigh,
doublereal pref, doublereal pref,
const doublereal* coeffs) : const doublereal* coeffs) :
m_lowT (tlow), m_lowT (tlow),
@ -109,7 +109,7 @@ namespace Cantera {
s_R[m_index] = m_s0_R + m_cp0_R * (logt - m_logt0); s_R[m_index] = m_s0_R + m_cp0_R * (logt - m_logt0);
} }
void ConstCpPoly::reportParameters(int &n, int &type, void ConstCpPoly::reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {

View file

@ -66,7 +66,7 @@ namespace Cantera {
* - c[3] = \f$ {Cp}_k^o(T_0, p_{ref}) \f$ (J(kmol K) * - c[3] = \f$ {Cp}_k^o(T_0, p_{ref}) \f$ (J(kmol K)
* *
*/ */
ConstCpPoly(int n, doublereal tlow, doublereal thigh, ConstCpPoly(size_t n, doublereal tlow, doublereal thigh,
doublereal pref, doublereal pref,
const doublereal* coeffs); const doublereal* coeffs);
@ -97,7 +97,7 @@ namespace Cantera {
virtual int reportType() const { return CONSTANT_CP; } virtual int reportType() const { return CONSTANT_CP; }
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const { return m_index; } virtual size_t speciesIndex() const { return m_index; }
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
/*! /*!
@ -154,7 +154,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
void reportParameters(int &n, int &type, void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const; doublereal* const coeffs) const;
@ -191,7 +191,7 @@ namespace Cantera {
//! Reference pressure (Pa) //! Reference pressure (Pa)
doublereal m_Pref; doublereal m_Pref;
//! Species Index //! Species Index
int m_index; size_t m_index;
private: private:

View file

@ -100,11 +100,11 @@ namespace Cantera {
} }
} }
doublereal ConstDensityThermo::standardConcentration(int k) const { doublereal ConstDensityThermo::standardConcentration(size_t k) const {
return molarDensity(); return molarDensity();
} }
doublereal ConstDensityThermo::logStandardConc(int k) const { doublereal ConstDensityThermo::logStandardConc(size_t k) const {
return log(molarDensity()); return log(molarDensity());
} }

View file

@ -196,13 +196,13 @@ namespace Cantera {
* @return * @return
* Returns the standard Concentration in units of m3 kmol-1. * Returns the standard Concentration in units of m3 kmol-1.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Natural logarithm of the standard concentration of the kth species. //! Natural logarithm of the standard concentration of the kth species.
/*! /*!
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the Gibbs functions for the standard //! Get the Gibbs functions for the standard
//! state of the species at the current <I>T</I> and <I>P</I> of the solution //! state of the species at the current <I>T</I> and <I>P</I> of the solution

View file

@ -504,7 +504,7 @@ namespace Cantera {
* based on the molality of species proportional to the * based on the molality of species proportional to the
* molality of the species. * molality of the species.
*/ */
doublereal DebyeHuckel::standardConcentration(int k) const { doublereal DebyeHuckel::standardConcentration(size_t k) const {
double mvSolvent = m_speciesSize[m_indexSolvent]; double mvSolvent = m_speciesSize[m_indexSolvent];
return 1.0 / mvSolvent; return 1.0 / mvSolvent;
} }
@ -513,7 +513,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal DebyeHuckel::logStandardConc(int k) const { doublereal DebyeHuckel::logStandardConc(size_t k) const {
double c_solvent = standardConcentration(k); double c_solvent = standardConcentration(k);
return log(c_solvent); return log(c_solvent);
} }
@ -1566,7 +1566,7 @@ namespace Cantera {
getMap(ESTNode, msEST); getMap(ESTNode, msEST);
map<std::string,std::string>::const_iterator _b = msEST.begin(); map<std::string,std::string>::const_iterator _b = msEST.begin();
for (; _b != msEST.end(); ++_b) { for (; _b != msEST.end(); ++_b) {
int kk = speciesIndex(_b->first); size_t kk = speciesIndex(_b->first);
std::string est = _b->second; std::string est = _b->second;
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) { if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
throw CanteraError("DebyeHuckel:initThermoXML", throw CanteraError("DebyeHuckel:initThermoXML",

View file

@ -924,13 +924,13 @@ namespace Cantera {
* Returns the standard Concentration in units of * Returns the standard Concentration in units of
* m<SUP>3</SUP> kmol<SUP>-1</SUP>. * m<SUP>3</SUP> kmol<SUP>-1</SUP>.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Natural logarithm of the standard concentration of the kth species. //! Natural logarithm of the standard concentration of the kth species.
/*! /*!
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Returns the units of the standard and generalized concentrations. //! Returns the units of the standard and generalized concentrations.
/*! /*!

View file

@ -104,7 +104,7 @@ namespace Cantera {
* the parameterization. * the parameterization.
*/ */
void GeneralSpeciesThermo::install(std::string name, void GeneralSpeciesThermo::install(std::string name,
int index, size_t index,
int type, int type,
const doublereal* c, const doublereal* c,
doublereal minTemp, doublereal minTemp,
@ -187,13 +187,13 @@ namespace Cantera {
throw CanteraError("GeneralSpeciesThermo::install_STIT", throw CanteraError("GeneralSpeciesThermo::install_STIT",
"zero pointer"); "zero pointer");
} }
int index = stit_ptr->speciesIndex(); size_t index = stit_ptr->speciesIndex();
if (index > m_kk - 1) { if (index > m_kk - 1) {
m_sp.resize(index+1, 0); m_sp.resize(index+1, 0);
m_kk = index+1; m_kk = index+1;
} }
AssertThrow(m_sp[index] == 0, AssertThrow(m_sp[index] == 0,
"Index position isn't null, duplication of assignment: " + int2str(index)); "Index position isn't null, duplication of assignment: " + int2str(int(index)));
/* /*
* Now, simply assign the position * Now, simply assign the position
*/ */
@ -211,7 +211,7 @@ namespace Cantera {
void GeneralSpeciesThermo::installPDSShandler(int k, PDSS *PDSS_ptr, void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS *PDSS_ptr,
VPSSMgr *vpssmgr_ptr) { VPSSMgr *vpssmgr_ptr) {
STITbyPDSS *stit_ptr = new STITbyPDSS(k, vpssmgr_ptr, PDSS_ptr); STITbyPDSS *stit_ptr = new STITbyPDSS(k, vpssmgr_ptr, PDSS_ptr);
install_STIT(stit_ptr); install_STIT(stit_ptr);
@ -221,7 +221,7 @@ namespace Cantera {
* Update the properties for one species. * Update the properties for one species.
*/ */
void GeneralSpeciesThermo:: void GeneralSpeciesThermo::
update_one(int k, doublereal t, doublereal* cp_R, update_one(size_t k, doublereal t, doublereal* cp_R,
doublereal* h_RT, doublereal* s_R) const { doublereal* h_RT, doublereal* s_R) const {
SpeciesThermoInterpType * sp_ptr = m_sp[k]; SpeciesThermoInterpType * sp_ptr = m_sp[k];
if (sp_ptr) { if (sp_ptr) {
@ -255,7 +255,7 @@ namespace Cantera {
* This utility function reports the type of parameterization * This utility function reports the type of parameterization
* used for the species, index. * used for the species, index.
*/ */
int GeneralSpeciesThermo::reportType(int index) const { int GeneralSpeciesThermo::reportType(size_t index) const {
SpeciesThermoInterpType *sp = m_sp[index]; SpeciesThermoInterpType *sp = m_sp[index];
if (sp) { if (sp) {
return sp->reportType(); return sp->reportType();
@ -270,10 +270,10 @@ namespace Cantera {
* For the NASA object, there are 15 coefficients. * For the NASA object, there are 15 coefficients.
*/ */
void GeneralSpeciesThermo:: void GeneralSpeciesThermo::
reportParams(int index, int &type, doublereal * const c, reportParams(size_t index, int &type, doublereal * const c,
doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const { doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const {
SpeciesThermoInterpType *sp = m_sp[index]; SpeciesThermoInterpType *sp = m_sp[index];
int n; size_t n;
if (sp) { if (sp) {
sp->reportParameters(n, type, minTemp, maxTemp, sp->reportParameters(n, type, minTemp, maxTemp,
refPressure, c); refPressure, c);
@ -293,7 +293,7 @@ namespace Cantera {
* parameters for the standard state. * parameters for the standard state.
*/ */
void GeneralSpeciesThermo:: void GeneralSpeciesThermo::
modifyParams(int index, doublereal *c) { modifyParams(size_t index, doublereal *c) {
SpeciesThermoInterpType *sp = m_sp[index]; SpeciesThermoInterpType *sp = m_sp[index];
if (sp) { if (sp) {
sp->modifyParameters(c); sp->modifyParameters(c);
@ -308,8 +308,8 @@ namespace Cantera {
* are valid. Otherwise, if an integer argument is given, the * are valid. Otherwise, if an integer argument is given, the
* value applies only to the species with that index. * value applies only to the species with that index.
*/ */
doublereal GeneralSpeciesThermo::minTemp(int k) const { doublereal GeneralSpeciesThermo::minTemp(size_t k) const {
if (k < 0) if (k == -1)
return m_tlow_max; return m_tlow_max;
else { else {
SpeciesThermoInterpType *sp = m_sp[k]; SpeciesThermoInterpType *sp = m_sp[k];
@ -320,8 +320,8 @@ namespace Cantera {
return m_tlow_max; return m_tlow_max;
} }
doublereal GeneralSpeciesThermo::maxTemp(int k) const { doublereal GeneralSpeciesThermo::maxTemp(size_t k) const {
if (k < 0) { if (k == -1) {
return m_thigh_min; return m_thigh_min;
} else { } else {
SpeciesThermoInterpType *sp = m_sp[k]; SpeciesThermoInterpType *sp = m_sp[k];
@ -332,8 +332,8 @@ namespace Cantera {
return m_thigh_min; return m_thigh_min;
} }
doublereal GeneralSpeciesThermo::refPressure(int k) const { doublereal GeneralSpeciesThermo::refPressure(size_t k) const {
if (k < 0) { if (k == -1) {
return m_p0; return m_p0;
} else { } else {
SpeciesThermoInterpType *sp = m_sp[k]; SpeciesThermoInterpType *sp = m_sp[k];

View file

@ -82,7 +82,7 @@ namespace Cantera {
* @todo Create a factory method for SpeciesThermoInterpType. * @todo Create a factory method for SpeciesThermoInterpType.
* That's basically what we are doing here. * That's basically what we are doing here.
*/ */
virtual void install(std::string name, int index, int type, virtual void install(std::string name, size_t index, int type,
const doublereal* c, const doublereal* c,
doublereal minTemp, doublereal maxTemp, doublereal minTemp, doublereal maxTemp,
doublereal refPressure); doublereal refPressure);
@ -104,7 +104,7 @@ namespace Cantera {
* @param vpssmgr_ptr Pointer to the variable pressure standard state * @param vpssmgr_ptr Pointer to the variable pressure standard state
* manager that handles the PDSS object. * manager that handles the PDSS object.
*/ */
void installPDSShandler(int k, PDSS *PDSS_ptr, VPSSMgr *vpssmgr_ptr); void installPDSShandler(size_t k, PDSS *PDSS_ptr, VPSSMgr *vpssmgr_ptr);
//! Like update(), but only updates the single species k. //! Like update(), but only updates the single species k.
/*! /*!
@ -117,7 +117,7 @@ namespace Cantera {
* @param s_R Vector of Dimensionless entropies. * @param s_R Vector of Dimensionless entropies.
* (length m_kk). * (length m_kk).
*/ */
virtual void update_one(int k, doublereal T, doublereal* cp_R, virtual void update_one(size_t k, doublereal T, doublereal* cp_R,
doublereal* h_RT, doublereal* h_RT,
doublereal* s_R) const; doublereal* s_R) const;
@ -149,7 +149,7 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal minTemp(int k=-1) const; virtual doublereal minTemp(size_t k=-1) const;
//! Maximum temperature. //! Maximum temperature.
/*! /*!
@ -161,7 +161,7 @@ namespace Cantera {
* *
* @param k Species Index * @param k Species Index
*/ */
virtual doublereal maxTemp(int k=-1) const; virtual doublereal maxTemp(size_t k=-1) const;
//! The reference-state pressure for species k. //! The reference-state pressure for species k.
/*! /*!
@ -176,7 +176,7 @@ namespace Cantera {
* *
* @param k Species Index * @param k Species Index
*/ */
virtual doublereal refPressure(int k = -1) const; virtual doublereal refPressure(size_t k = -1) const;
//! This utility function reports the type of parameterization //! This utility function reports the type of parameterization
//! used for the species with index number index. //! used for the species with index number index.
@ -184,7 +184,7 @@ namespace Cantera {
* *
* @param index Species index * @param index Species index
*/ */
virtual int reportType(int index) const; virtual int reportType(size_t index) const;
//! This utility function reports back the type of //! This utility function reports back the type of
//! parameterization and all of the parameters for the species, index. //! parameterization and all of the parameters for the species, index.
@ -197,7 +197,7 @@ namespace Cantera {
* @param maxTemp output - Maximum temperature * @param maxTemp output - Maximum temperature
* @param refPressure output - reference pressure (Pa). * @param refPressure output - reference pressure (Pa).
*/ */
virtual void reportParams(int index, int &type, virtual void reportParams(size_t index, int &type,
doublereal * const c, doublereal * const c,
doublereal &minTemp, doublereal &minTemp,
doublereal &maxTemp, doublereal &maxTemp,
@ -209,7 +209,7 @@ namespace Cantera {
* @param c Vector of coefficients used to set the * @param c Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
virtual void modifyParams(int index, doublereal *c); virtual void modifyParams(size_t index, doublereal *c);
#ifdef H298MODIFY_CAPABILITY #ifdef H298MODIFY_CAPABILITY
@ -258,7 +258,7 @@ namespace Cantera {
* Internal variable indicating the length of the * Internal variable indicating the length of the
* number of species in the phase. * number of species in the phase.
*/ */
int m_kk; size_t m_kk;
//! Make the class VPSSMgr a friend because we need to access //! Make the class VPSSMgr a friend because we need to access

View file

@ -191,12 +191,12 @@ namespace Cantera {
*/ */
doublereal GibbsExcessVPSSTP::standardConcentration(int k) const { doublereal GibbsExcessVPSSTP::standardConcentration(size_t k) const {
err("standardConcentration"); err("standardConcentration");
return -1.0; return -1.0;
} }
doublereal GibbsExcessVPSSTP::logStandardConc(int k) const { doublereal GibbsExcessVPSSTP::logStandardConc(size_t k) const {
err("logStandardConc"); err("logStandardConc");
return -1.0; return -1.0;
} }

View file

@ -235,7 +235,7 @@ namespace Cantera {
* *
* @param k species index. Defaults to zero. * @param k species index. Defaults to zero.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
/** /**
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
@ -243,7 +243,7 @@ namespace Cantera {
* *
* @param k species index * @param k species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
/** /**
* Returns the units of the standard and generalized * Returns the units of the standard and generalized

View file

@ -947,7 +947,7 @@ namespace Cantera {
* all species concentrations have units of kmol/m3. * all species concentrations have units of kmol/m3.
* *
*/ */
doublereal HMWSoln::standardConcentration(int k) const { doublereal HMWSoln::standardConcentration(size_t k) const {
getStandardVolumes(DATA_PTR(m_tmpV)); getStandardVolumes(DATA_PTR(m_tmpV));
double mvSolvent = m_tmpV[m_indexSolvent]; double mvSolvent = m_tmpV[m_indexSolvent];
if (k > 0) { if (k > 0) {
@ -960,7 +960,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal HMWSoln::logStandardConc(int k) const { doublereal HMWSoln::logStandardConc(size_t k) const {
double c_solvent = standardConcentration(k); double c_solvent = standardConcentration(k);
return log(c_solvent); return log(c_solvent);
} }

View file

@ -1704,7 +1704,7 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Returns the natural logarithm of the standard //! Returns the natural logarithm of the standard
@ -1712,7 +1712,7 @@ namespace Cantera {
/*! /*!
* @param k Species index * @param k Species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Returns the units of the standard and generalized concentrations. //! Returns the units of the standard and generalized concentrations.
/*! /*!

View file

@ -155,7 +155,7 @@ namespace Cantera {
* Returns the standard concentration \f$ C^0_k \f$, which is used to normalize * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
* the generalized concentration. * the generalized concentration.
*/ */
doublereal IdealGasPhase::standardConcentration(int k) const { doublereal IdealGasPhase::standardConcentration(size_t k) const {
double p = pressure(); double p = pressure();
return p/(GasConstant * temperature()); return p/(GasConstant * temperature());
} }
@ -164,7 +164,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal IdealGasPhase::logStandardConc(int k) const { doublereal IdealGasPhase::logStandardConc(size_t k) const {
_updateThermo(); _updateThermo();
double p = pressure(); double p = pressure();
double lc = std::log (p / (GasConstant * temperature())); double lc = std::log (p / (GasConstant * temperature()));

View file

@ -548,14 +548,14 @@ namespace Cantera {
* @return * @return
* Returns the standard Concentration in units of m3 kmol-1. * Returns the standard Concentration in units of m3 kmol-1.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Returns the natural logarithm of the standard //! Returns the natural logarithm of the standard
//! concentration of the kth species //! concentration of the kth species
/*! /*!
* @param k index of the species. (defaults to zero) * @param k index of the species. (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the array of non-dimensional activity coefficients at //! Get the array of non-dimensional activity coefficients at
//! the current solution temperature, pressure, and solution concentration. //! the current solution temperature, pressure, and solution concentration.

View file

@ -421,7 +421,7 @@ namespace Cantera {
* optional parameter indicating the species. * optional parameter indicating the species.
* *
*/ */
doublereal IdealMolalSoln::standardConcentration(int k) const { doublereal IdealMolalSoln::standardConcentration(size_t k) const {
double c0 = 1.0, mvSolvent; double c0 = 1.0, mvSolvent;
switch (m_formGC) { switch (m_formGC) {
case 0: case 0:
@ -441,7 +441,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal IdealMolalSoln::logStandardConc(int k) const { doublereal IdealMolalSoln::logStandardConc(size_t k) const {
double c0 = standardConcentration(k); double c0 = standardConcentration(k);
return log(c0); return log(c0);
} }

View file

@ -459,7 +459,7 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
/*! /*!
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
@ -467,7 +467,7 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
/*! /*!
* Returns the units of the standard and generalized * Returns the units of the standard and generalized

View file

@ -487,7 +487,7 @@ namespace Cantera {
* an optional parameter. * an optional parameter.
*/ */
doublereal IdealSolidSolnPhase:: doublereal IdealSolidSolnPhase::
standardConcentration(int k) const { standardConcentration(size_t k) const {
switch (m_formGC) { switch (m_formGC) {
case 0: case 0:
return 1.0; return 1.0;
@ -522,7 +522,7 @@ namespace Cantera {
* an optional parameter. * an optional parameter.
*/ */
doublereal IdealSolidSolnPhase:: doublereal IdealSolidSolnPhase::
logStandardConc(int k) const { logStandardConc(size_t k) const {
_updateThermo(); _updateThermo();
double res; double res;
switch (m_formGC) { switch (m_formGC) {

View file

@ -475,7 +475,7 @@ namespace Cantera {
* a change from the ThermoPhase base class, where it was * a change from the ThermoPhase base class, where it was
* an optional parameter. * an optional parameter.
*/ */
virtual doublereal standardConcentration(int k) const; virtual doublereal standardConcentration(size_t k) const;
/** /**
* The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize * The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize
@ -497,7 +497,7 @@ namespace Cantera {
* a change from the ThermoPhase base class, where it was * a change from the ThermoPhase base class, where it was
* an optional parameter. * an optional parameter.
*/ */
virtual doublereal logStandardConc(int k) const; virtual doublereal logStandardConc(size_t k) const;
/** /**
* Returns the units of the standard and general concentrations * Returns the units of the standard and general concentrations

View file

@ -224,7 +224,7 @@ namespace Cantera {
* Returns the standard concentration \f$ C^0_k \f$, which is used to normalize * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
* the generalized concentration. * the generalized concentration.
*/ */
doublereal IdealSolnGasVPSS::standardConcentration(int k) const { doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const {
if (m_idealGas) { if (m_idealGas) {
double p = pressure(); double p = pressure();
return p/(GasConstant * temperature()); return p/(GasConstant * temperature());
@ -247,7 +247,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal IdealSolnGasVPSS::logStandardConc(int k) const { doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const {
double c = standardConcentration(k); double c = standardConcentration(k);
double lc = std::log(c); double lc = std::log(c);
return lc; return lc;

View file

@ -185,14 +185,14 @@ namespace Cantera {
* @return * @return
* Returns the standard Concentration in units of m3 kmol-1. * Returns the standard Concentration in units of m3 kmol-1.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Returns the natural logarithm of the standard //! Returns the natural logarithm of the standard
//! concentration of the kth species //! concentration of the kth species
/*! /*!
* @param k index of the species. (defaults to zero) * @param k index of the species. (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Returns the units of the standard and generalized concentrations. //! Returns the units of the standard and generalized concentrations.
/*! /*!

View file

@ -330,7 +330,7 @@ namespace Cantera {
getActivities(c); getActivities(c);
} }
void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,vector_fp& charges, std::vector<int>& neutMolIndex){ void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,vector_fp& charges, std::vector<size_t>& neutMolIndex){
coeffs = fm_neutralMolec_ions_; coeffs = fm_neutralMolec_ions_;
charges = m_speciesCharge; charges = m_speciesCharge;
neutMolIndex = fm_invert_ionForNeutral; neutMolIndex = fm_invert_ionForNeutral;
@ -356,7 +356,7 @@ namespace Cantera {
* Returns the standard concentration. The units are by definition * Returns the standard concentration. The units are by definition
* dependent on the ThermoPhase and kinetics manager representation. * dependent on the ThermoPhase and kinetics manager representation.
*/ */
doublereal IonsFromNeutralVPSSTP::standardConcentration(int k) const { doublereal IonsFromNeutralVPSSTP::standardConcentration(size_t k) const {
return 1.0; return 1.0;
} }
@ -364,7 +364,7 @@ namespace Cantera {
/* /*
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
doublereal IonsFromNeutralVPSSTP::logStandardConc(int k) const { doublereal IonsFromNeutralVPSSTP::logStandardConc(size_t k) const {
return 0.0; return 0.0;
} }
@ -445,7 +445,7 @@ namespace Cantera {
*/ */
void void
IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const { IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal xx, fact2; doublereal xx, fact2;
/* /*
* Transfer the mole fractions to the slave neutral molecule * Transfer the mole fractions to the slave neutral molecule
@ -472,7 +472,7 @@ namespace Cantera {
fact2 = 2.0 * RT_ * log(2.0); fact2 = 2.0 * RT_ * log(2.0);
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -487,7 +487,7 @@ namespace Cantera {
mu[icat] = RT_ * log(xx); mu[icat] = RT_ * log(xx);
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
xx = fmaxx(SmallNumber, moleFractions_[icat]); xx = fmaxx(SmallNumber, moleFractions_[icat]);
@ -735,14 +735,14 @@ namespace Cantera {
* is dumped into the anion mole number to fix the imbalance. * is dumped into the anion mole number to fix the imbalance.
*/ */
void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const { void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal sumCat; doublereal sumCat;
doublereal sumAnion; doublereal sumAnion;
doublereal fmij; doublereal fmij;
doublereal sum = 0.0; doublereal sum = 0.0;
//! Zero the vector we are trying to find. //! Zero the vector we are trying to find.
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
NeutralMolecMoleFractions_[k] = 0.0; NeutralMolecMoleFractions_[k] = 0.0;
} }
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
@ -762,7 +762,7 @@ namespace Cantera {
case cIonSolnType_PASSTHROUGH: case cIonSolnType_PASSTHROUGH:
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
NeutralMolecMoleFractions_[k] = moleFractions_[k]; NeutralMolecMoleFractions_[k] = moleFractions_[k];
} }
break; break;
@ -771,11 +771,11 @@ namespace Cantera {
sumCat = 0.0; sumCat = 0.0;
sumAnion = 0.0; sumAnion = 0.0;
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
NeutralMolecMoleFractions_[k] = 0.0; NeutralMolecMoleFractions_[k] = 0.0;
} }
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -786,7 +786,7 @@ namespace Cantera {
} }
} }
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk]; fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk];
@ -794,16 +794,16 @@ namespace Cantera {
} }
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
moleFractionsTmp_[k] = moleFractions_[k]; moleFractionsTmp_[k] = moleFractions_[k];
} }
for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) { for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
fmij = fm_neutralMolec_ions_[k + jNeut * m_kk]; fmij = fm_neutralMolec_ions_[k + jNeut * m_kk];
moleFractionsTmp_[k] -= fmij * NeutralMolecMoleFractions_[jNeut]; moleFractionsTmp_[k] -= fmij * NeutralMolecMoleFractions_[jNeut];
} }
} }
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) { if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
//! Check to see if we have in fact found the inverse. //! Check to see if we have in fact found the inverse.
if (anionList_[0] != k) { if (anionList_[0] != k) {
@ -820,10 +820,10 @@ namespace Cantera {
// Normalize the Neutral Molecule mole fractions // Normalize the Neutral Molecule mole fractions
sum = 0.0; sum = 0.0;
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
sum += NeutralMolecMoleFractions_[k]; sum += NeutralMolecMoleFractions_[k];
} }
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
NeutralMolecMoleFractions_[k] /= sum; NeutralMolecMoleFractions_[k] /= sum;
} }
@ -863,7 +863,7 @@ namespace Cantera {
* is dumped into the anion mole number to fix the imbalance. * is dumped into the anion mole number to fix the imbalance.
*/ */
void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal * const dx, doublereal *dy) const { void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal * const dx, doublereal *dy) const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal sumCat; doublereal sumCat;
doublereal sumAnion; doublereal sumAnion;
doublereal fmij; doublereal fmij;
@ -874,7 +874,7 @@ namespace Cantera {
//check sum dx = 0 //check sum dx = 0
//! Zero the vector we are trying to find. //! Zero the vector we are trying to find.
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
dy[k] = 0.0; dy[k] = 0.0;
} }
@ -885,7 +885,7 @@ namespace Cantera {
case cIonSolnType_PASSTHROUGH: case cIonSolnType_PASSTHROUGH:
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
dy[k] = dx[k]; dy[k] = dx[k];
} }
break; break;
@ -895,7 +895,7 @@ namespace Cantera {
sumCat = 0.0; sumCat = 0.0;
sumAnion = 0.0; sumAnion = 0.0;
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < (int) cationList_.size(); k++) {
//! 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];
@ -907,7 +907,7 @@ namespace Cantera {
} }
} }
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk]; fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk];
@ -916,16 +916,16 @@ namespace Cantera {
} }
#ifdef DEBUG_MODE_NOT #ifdef DEBUG_MODE_NOT
//check dy sum to zero //check dy sum to zero
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
moleFractionsTmp_[k] = dx[k]; moleFractionsTmp_[k] = dx[k];
} }
for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) { for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
fmij = fm_neutralMolec_ions_[k + jNeut * m_kk]; fmij = fm_neutralMolec_ions_[k + jNeut * m_kk];
moleFractionsTmp_[k] -= fmij * dy[jNeut]; moleFractionsTmp_[k] -= fmij * dy[jNeut];
} }
} }
for (k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) { if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
//! Check to see if we have in fact found the inverse. //! Check to see if we have in fact found the inverse.
if (anionList_[0] != k) { if (anionList_[0] != k) {
@ -942,11 +942,11 @@ namespace Cantera {
// Normalize the Neutral Molecule mole fractions // Normalize the Neutral Molecule mole fractions
sumy = 0.0; sumy = 0.0;
sumdy = 0.0; sumdy = 0.0;
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
sumy += y[k]; sumy += y[k];
sumdy += dy[k]; sumdy += dy[k];
} }
for (k = 0; k < numNeutralMoleculeSpecies_; k++) { for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
dy[k] = dy[k]/sumy - y[k]*sumdy/sumy/sumy; dy[k] = dy[k]/sumy - y[k]*sumdy/sumy/sumy;
} }
@ -1193,17 +1193,17 @@ namespace Cantera {
static double factorOverlap(const std::vector<std::string>& elnamesVN , static double factorOverlap(const std::vector<std::string>& elnamesVN ,
const std::vector<double>& elemVectorN, const std::vector<double>& elemVectorN,
const int nElementsN, const size_t nElementsN,
const std::vector<std::string>& elnamesVI , const std::vector<std::string>& elnamesVI ,
const std::vector<double>& elemVectorI, const std::vector<double>& elemVectorI,
const int nElementsI) const size_t nElementsI)
{ {
double fMax = 1.0E100; double fMax = 1.0E100;
for (int mi = 0; mi < nElementsI; mi++) { for (size_t mi = 0; mi < nElementsI; mi++) {
if (elnamesVI[mi] != "E") { if (elnamesVI[mi] != "E") {
if (elemVectorI[mi] > 1.0E-13) { if (elemVectorI[mi] > 1.0E-13) {
double eiNum = elemVectorI[mi]; double eiNum = elemVectorI[mi];
for (int mn = 0; mn < nElementsN; mn++) { for (size_t mn = 0; mn < nElementsN; mn++) {
if (elnamesVI[mi] == elnamesVN[mn]) { if (elnamesVI[mi] == elnamesVN[mn]) {
if (elemVectorN[mn] <= 1.0E-13) { if (elemVectorN[mn] <= 1.0E-13) {
return 0.0; return 0.0;
@ -1294,28 +1294,28 @@ namespace Cantera {
std::vector<double> elemVectorI(nElementsI); std::vector<double> elemVectorI(nElementsI);
vector<doublereal> fm_tmp(m_kk); vector<doublereal> fm_tmp(m_kk);
for (int k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
fm_invert_ionForNeutral[k] = -1; fm_invert_ionForNeutral[k] = -1;
} }
/* for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) { /* for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
fm_invert_ionForNeutral[jNeut] = -1; fm_invert_ionForNeutral[jNeut] = -1;
}*/ }*/
for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) { for (size_t jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
for (int m = 0; m < nElementsN; m++) { for (size_t m = 0; m < nElementsN; m++) {
elemVectorN[m] = neutralMoleculePhase_->nAtoms(jNeut, m); elemVectorN[m] = neutralMoleculePhase_->nAtoms(jNeut, m);
} }
elemVectorN_orig = elemVectorN; elemVectorN_orig = elemVectorN;
fvo_zero_dbl_1(fm_tmp, m_kk); fvo_zero_dbl_1(fm_tmp, m_kk);
for (int m = 0; m < nElementsI; m++) { for (size_t m = 0; m < nElementsI; m++) {
elemVectorI[m] = nAtoms(indexSpecialSpecies_, m); elemVectorI[m] = nAtoms(indexSpecialSpecies_, m);
} }
double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN, double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN,
elnamesVI ,elemVectorI, nElementsI); elnamesVI ,elemVectorI, nElementsI);
if (fac > 0.0) { if (fac > 0.0) {
for (int m = 0; m < nElementsN; m++) { for (size_t m = 0; m < nElementsN; m++) {
std::string mName = elnamesVN[m]; std::string mName = elnamesVN[m];
for (int mi = 0; mi < nElementsI; mi++) { for (size_t mi = 0; mi < nElementsI; mi++) {
std::string eName = elnamesVI[mi]; std::string eName = elnamesVI[mi];
if (mName == eName) { if (mName == eName) {
elemVectorN[m] -= fac * elemVectorI[mi]; elemVectorN[m] -= fac * elemVectorI[mi];
@ -1328,15 +1328,15 @@ namespace Cantera {
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {
for (int m = 0; m < nElementsI; m++) { for (size_t m = 0; m < nElementsI; m++) {
elemVectorI[m] = nAtoms(k, m); elemVectorI[m] = nAtoms(k, m);
} }
double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN, double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN,
elnamesVI ,elemVectorI, nElementsI); elnamesVI ,elemVectorI, nElementsI);
if (fac > 0.0) { if (fac > 0.0) {
for (int m = 0; m < nElementsN; m++) { for (size_t m = 0; m < nElementsN; m++) {
std::string mName = elnamesVN[m]; std::string mName = elnamesVN[m];
for (int mi = 0; mi < nElementsI; mi++) { for (size_t mi = 0; mi < nElementsI; mi++) {
std::string eName = elnamesVI[mi]; std::string eName = elnamesVI[mi];
if (mName == eName) { if (mName == eName) {
elemVectorN[m] -= fac * elemVectorI[mi]; elemVectorN[m] -= fac * elemVectorI[mi];
@ -1345,7 +1345,7 @@ namespace Cantera {
} }
} }
bool notTaken = true; bool notTaken = true;
for (int iNeut = 0; iNeut < jNeut; iNeut++) { for (size_t iNeut = 0; iNeut < jNeut; iNeut++) {
if (fm_invert_ionForNeutral[k] == iNeut) { if (fm_invert_ionForNeutral[k] == iNeut) {
notTaken = false; notTaken = false;
} }
@ -1362,7 +1362,7 @@ namespace Cantera {
} }
// Ok check the work // Ok check the work
for (int m = 0; m < nElementsN; m++) { for (size_t m = 0; m < nElementsN; m++) {
if (fabs(elemVectorN[m]) > 1.0E-13) { if (fabs(elemVectorN[m]) > 1.0E-13) {
throw CanteraError("IonsFromNeutralVPSSTP::initThermoXML", throw CanteraError("IonsFromNeutralVPSSTP::initThermoXML",
"Simple formula matrix generation failed"); "Simple formula matrix generation failed");
@ -1390,7 +1390,7 @@ namespace Cantera {
* he = X_A X_B(B + C(X_A - X_B)) * he = X_A X_B(B + C(X_A - X_B))
*/ */
void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const { void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal fmij; doublereal fmij;
/* /*
* Get the activity coefficiens of the neutral molecules * Get the activity coefficiens of the neutral molecules
@ -1403,7 +1403,7 @@ namespace Cantera {
case cIonSolnType_SINGLEANION: case cIonSolnType_SINGLEANION:
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -1417,7 +1417,7 @@ namespace Cantera {
lnActCoeff_Scaled_[icat]= 0.0; lnActCoeff_Scaled_[icat]= 0.0;
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
lnActCoeff_Scaled_[icat] = log(gammaNeutralMolecule_[jNeut]); lnActCoeff_Scaled_[icat] = log(gammaNeutralMolecule_[jNeut]);
@ -1442,14 +1442,14 @@ namespace Cantera {
// get the gradient in the activity coefficients // get the gradient in the activity coefficients
void IonsFromNeutralVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal *dlnActCoeff) const { void IonsFromNeutralVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal *dlnActCoeff) const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal fmij; doublereal fmij;
/* /*
* Get the activity coefficients of the neutral molecules * Get the activity coefficients of the neutral molecules
*/ */
GibbsExcessVPSSTP *geThermo = dynamic_cast<GibbsExcessVPSSTP *>(neutralMoleculePhase_); GibbsExcessVPSSTP *geThermo = dynamic_cast<GibbsExcessVPSSTP *>(neutralMoleculePhase_);
if (!geThermo) { if (!geThermo) {
for ( k = 0; k < m_kk; k++ ){ for (size_t k = 0; k < m_kk; k++) {
dlnActCoeff[k] = dX[k]/moleFractions_[k]; dlnActCoeff[k] = dX[k]/moleFractions_[k];
} }
return; return;
@ -1472,7 +1472,7 @@ namespace Cantera {
case cIonSolnType_SINGLEANION: case cIonSolnType_SINGLEANION:
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -1486,7 +1486,7 @@ namespace Cantera {
dlnActCoeff[icat]= 0.0; dlnActCoeff[icat]= 0.0;
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeff[icat] = dlnActCoeff_NeutralMolecule[jNeut]; dlnActCoeff[icat] = dlnActCoeff_NeutralMolecule[jNeut];
@ -1512,7 +1512,7 @@ namespace Cantera {
* temperature derivative of the natural logarithm of the activity coefficients * temperature derivative of the natural logarithm of the activity coefficients
*/ */
void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const { void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal fmij; doublereal fmij;
/* /*
* Get the activity coefficients of the neutral molecules * Get the activity coefficients of the neutral molecules
@ -1531,7 +1531,7 @@ namespace Cantera {
case cIonSolnType_SINGLEANION: case cIonSolnType_SINGLEANION:
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -1545,7 +1545,7 @@ namespace Cantera {
dlnActCoeffdT_Scaled_[icat]= 0.0; dlnActCoeffdT_Scaled_[icat]= 0.0;
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdT_Scaled_[icat] = dlnActCoeffdT_NeutralMolecule_[jNeut]; dlnActCoeffdT_Scaled_[icat] = dlnActCoeffdT_NeutralMolecule_[jNeut];
@ -1570,7 +1570,7 @@ namespace Cantera {
* temperature derivative of the natural logarithm of the activity coefficients * temperature derivative of the natural logarithm of the activity coefficients
*/ */
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX() const { void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX() const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal fmij; doublereal fmij;
/* /*
* Get the activity coefficients of the neutral molecules * Get the activity coefficients of the neutral molecules
@ -1589,7 +1589,7 @@ namespace Cantera {
case cIonSolnType_SINGLEANION: case cIonSolnType_SINGLEANION:
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -1603,7 +1603,7 @@ namespace Cantera {
dlnActCoeffdlnX_Scaled_[icat]= 0.0; dlnActCoeffdlnX_Scaled_[icat]= 0.0;
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdlnX_Scaled_[icat] = dlnActCoeffdlnX_NeutralMolecule_[jNeut]; dlnActCoeffdlnX_Scaled_[icat] = dlnActCoeffdlnX_NeutralMolecule_[jNeut];
@ -1628,7 +1628,7 @@ namespace Cantera {
* temperature derivative of the natural logarithm of the activity coefficients * temperature derivative of the natural logarithm of the activity coefficients
*/ */
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const { void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const {
int k, icat, jNeut; size_t icat, jNeut;
doublereal fmij; doublereal fmij;
/* /*
* Get the activity coefficients of the neutral molecules * Get the activity coefficients of the neutral molecules
@ -1647,7 +1647,7 @@ namespace Cantera {
case cIonSolnType_SINGLEANION: case cIonSolnType_SINGLEANION:
// Do the cation list // Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) { for (size_t k = 0; k < cationList_.size(); k++) {
//! 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];
@ -1661,7 +1661,7 @@ namespace Cantera {
dlnActCoeffdlnN_Scaled_[icat]= 0.0; dlnActCoeffdlnN_Scaled_[icat]= 0.0;
// Do the list of neutral molecules // Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) { for (size_t k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k]; icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat]; jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdlnN_Scaled_[icat] = dlnActCoeffdlnN_NeutralMolecule_[jNeut]; dlnActCoeffdlnN_Scaled_[icat] = dlnActCoeffdlnN_NeutralMolecule_[jNeut];

View file

@ -302,14 +302,14 @@ namespace Cantera {
* Returns the standard concentration. The units are by definition * Returns the standard concentration. The units are by definition
* dependent on the ThermoPhase and kinetics manager representation. * dependent on the ThermoPhase and kinetics manager representation.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Natural logarithm of the standard concentration of the kth species. //! Natural logarithm of the standard concentration of the kth species.
/*! /*!
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Returns the units of the standard and generalized concentrations. //! Returns the units of the standard and generalized concentrations.
/*! /*!
@ -459,7 +459,7 @@ namespace Cantera {
//! Get the Salt Dissociation Coefficients //! Get the Salt Dissociation Coefficients
//! Returns the vector of dissociation coefficients and vector of charges //! Returns the vector of dissociation coefficients and vector of charges
virtual void getDissociationCoeffs(vector_fp& coeffs, vector_fp& charges, std::vector<int>& neutMolIndex); virtual void getDissociationCoeffs(vector_fp& coeffs, vector_fp& charges, std::vector<size_t>& neutMolIndex);
virtual void getNeutralMolecMoleFractions(vector_fp& fracs){fracs=NeutralMolecMoleFractions_;} virtual void getNeutralMolecMoleFractions(vector_fp& fracs){fracs=NeutralMolecMoleFractions_;}
@ -479,8 +479,8 @@ namespace Cantera {
*/ */
virtual void getNeutralMoleculeMoleGrads(const doublereal * const x, doublereal *y) const; virtual void getNeutralMoleculeMoleGrads(const doublereal * const x, doublereal *y) const;
virtual void getCationList(std::vector<int>& cation){cation=cationList_;} virtual void getCationList(std::vector<size_t>& cation){cation=cationList_;}
virtual void getAnionList(std::vector<int>& anion){anion=anionList_;} virtual void getAnionList(std::vector<size_t>& anion){anion=anionList_;}
virtual void getSpeciesNames(std::vector<std::string>& names){names=m_speciesNames;} virtual void getSpeciesNames(std::vector<std::string>& names){names=m_speciesNames;}
@ -827,20 +827,20 @@ namespace Cantera {
* then we need to do a formal inversion which takes a great * then we need to do a formal inversion which takes a great
* deal of time and is not currently implemented. * deal of time and is not currently implemented.
*/ */
std::vector<int> fm_invert_ionForNeutral; std::vector<size_t> fm_invert_ionForNeutral;
//! Mole fractions using the Neutral Molecule Mole fraction basis //! Mole fractions using the Neutral Molecule Mole fraction basis
mutable std::vector<doublereal> NeutralMolecMoleFractions_; mutable std::vector<doublereal> NeutralMolecMoleFractions_;
//! List of the species in this ThermoPhase which are cation species //! List of the species in this ThermoPhase which are cation species
std::vector<int> cationList_; std::vector<size_t> cationList_;
//! Number of cation species //! Number of cation species
int numCationSpecies_; int numCationSpecies_;
//! List of the species in this ThermoPhase which are anion species //! List of the species in this ThermoPhase which are anion species
std::vector<int> anionList_; std::vector<size_t> anionList_;
//! Number of anion species //! Number of anion species
int numAnionSpecies_; int numAnionSpecies_;
@ -850,7 +850,7 @@ namespace Cantera {
/*! /*!
* These have neutral charges. * These have neutral charges.
*/ */
std::vector<int> passThroughList_; std::vector<size_t> passThroughList_;
//! Number of the species in this ThermoPhase which are passed //! Number of the species in this ThermoPhase which are passed
//! through to the neutralMoleculePhase ThermoPhase //! through to the neutralMoleculePhase ThermoPhase

View file

@ -125,11 +125,11 @@ namespace Cantera {
} }
} }
doublereal LatticePhase::standardConcentration(int k) const { doublereal LatticePhase::standardConcentration(size_t k) const {
return 1.0; return 1.0;
} }
doublereal LatticePhase::logStandardConc(int k) const { doublereal LatticePhase::logStandardConc(size_t k) const {
return 0.0; return 0.0;
} }

View file

@ -470,14 +470,14 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Returns the natural logarithm of the standard //! Returns the natural logarithm of the standard
//! concentration of the kth species //! concentration of the kth species
/*! /*!
* @param k Species index * @param k Species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the array of non-dimensional activity coefficients at //! Get the array of non-dimensional activity coefficients at
//! the current solution temperature, pressure, and solution concentration. //! the current solution temperature, pressure, and solution concentration.

View file

@ -137,11 +137,11 @@ namespace Cantera {
} }
} }
doublereal LatticeSolidPhase::standardConcentration(int k) const { doublereal LatticeSolidPhase::standardConcentration(size_t k) const {
return 1.0; return 1.0;
} }
doublereal LatticeSolidPhase::logStandardConc(int k) const { doublereal LatticeSolidPhase::logStandardConc(size_t k) const {
return 0.0; return 0.0;
} }

View file

@ -112,8 +112,8 @@ namespace Cantera {
virtual void getChemPotentials(doublereal* mu) const; virtual void getChemPotentials(doublereal* mu) const;
virtual void getStandardChemPotentials(doublereal* mu0) const; virtual void getStandardChemPotentials(doublereal* mu0) const;
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
virtual void initThermo(); virtual void initThermo();
@ -140,8 +140,8 @@ namespace Cantera {
protected: protected:
int m_mm; size_t m_mm;
int m_kk; size_t m_kk;
mutable doublereal m_tlast; mutable doublereal m_tlast;
doublereal m_press; doublereal m_press;
doublereal m_molar_density; doublereal m_molar_density;

View file

@ -335,12 +335,12 @@ namespace Cantera {
*/ */
doublereal MargulesVPSSTP::standardConcentration(int k) const { doublereal MargulesVPSSTP::standardConcentration(size_t k) const {
err("standardConcentration"); err("standardConcentration");
return -1.0; return -1.0;
} }
doublereal MargulesVPSSTP::logStandardConc(int k) const { doublereal MargulesVPSSTP::logStandardConc(size_t k) const {
err("logStandardConc"); err("logStandardConc");
return -1.0; return -1.0;
} }
@ -498,7 +498,7 @@ namespace Cantera {
*/ */
void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const { void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const {
int iA, iB, iK, delAK, delBK; size_t iA, iB, iK, delAK, delBK;
double XA, XB, XK, g0 , g1; double XA, XB, XK, g0 , g1;
double T = temperature(); double T = temperature();
@ -514,7 +514,7 @@ namespace Cantera {
delAK = 0; delAK = 0;
delBK = 0; delBK = 0;
XK = moleFractions_[iK]; XK = moleFractions_[iK];
for (int i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];
@ -651,7 +651,7 @@ namespace Cantera {
* he = X_A X_B(B + C X_B) * he = X_A X_B(B + C X_B)
*/ */
void MargulesVPSSTP::s_update_lnActCoeff() const { void MargulesVPSSTP::s_update_lnActCoeff() const {
int iA, iB, iK, delAK, delBK; size_t iA, iB, iK, delAK, delBK;
double XA, XB, XK, g0 , g1; double XA, XB, XK, g0 , g1;
double T = temperature(); double T = temperature();
double RT = GasConstant*T; double RT = GasConstant*T;
@ -662,7 +662,7 @@ namespace Cantera {
XK = moleFractions_[iK]; XK = moleFractions_[iK];
for (int i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];
@ -721,7 +721,7 @@ namespace Cantera {
* he = X_A X_B(B + C X_B) * he = X_A X_B(B + C X_B)
*/ */
void MargulesVPSSTP::s_update_dlnActCoeff_dT() const { void MargulesVPSSTP::s_update_dlnActCoeff_dT() const {
int iA, iB, iK, delAK, delBK; size_t iA, iB, iK, delAK, delBK;
double XA, XB, XK, g0 , g1; double XA, XB, XK, g0 , g1;
double T = temperature(); double T = temperature();
double RTT = GasConstant*T*T; double RTT = GasConstant*T*T;
@ -732,7 +732,7 @@ namespace Cantera {
XK = moleFractions_[iK]; XK = moleFractions_[iK];
for (int i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];
@ -795,7 +795,7 @@ namespace Cantera {
* he = X_A X_B(B + C X_B) * he = X_A X_B(B + C X_B)
*/ */
void MargulesVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal* dlnActCoeff) const { void MargulesVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal* dlnActCoeff) const {
int iA, iB, iK, delAK, delBK; size_t iA, iB, iK, delAK, delBK;
double XA, XB, XK, g0 , g1, dXA, dXB; double XA, XB, XK, g0 , g1, dXA, dXB;
double T = temperature(); double T = temperature();
double RT = GasConstant*T; double RT = GasConstant*T;
@ -808,7 +808,7 @@ namespace Cantera {
XK = moleFractions_[iK]; XK = moleFractions_[iK];
dlnActCoeff[iK] = 0.0; dlnActCoeff[iK] = 0.0;
for (int i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];
@ -842,7 +842,7 @@ namespace Cantera {
* he = X_A X_B(B + C X_B) * he = X_A X_B(B + C X_B)
*/ */
void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const { void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const {
int iA, iB, iK, delAK, delBK; size_t iA, iB, iK, delAK, delBK;
double XA, XB, XK, g0 , g1; double XA, XB, XK, g0 , g1;
double T = temperature(); double T = temperature();
double RT = GasConstant*T; double RT = GasConstant*T;
@ -853,7 +853,7 @@ namespace Cantera {
XK = moleFractions_[iK]; XK = moleFractions_[iK];
for (int i = 0; i < numBinaryInteractions_; i++) { for (size_t i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];
@ -877,18 +877,15 @@ namespace Cantera {
} }
void MargulesVPSSTP::s_update_dlnActCoeff_dlnX() const { void MargulesVPSSTP::s_update_dlnActCoeff_dlnX() const {
size_t iA, iB;
int iA, iB;
doublereal XA, XB, g0 , g1; doublereal XA, XB, g0 , g1;
doublereal T = temperature(); doublereal T = temperature();
fvo_zero_dbl_1(dlnActCoeffdlnX_Scaled_, m_kk); fvo_zero_dbl_1(dlnActCoeffdlnX_Scaled_, m_kk);
doublereal RT = GasConstant * T; doublereal RT = GasConstant * T;
for (size_t i = 0; i < numBinaryInteractions_; i++) {
for (int i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i]; iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i]; iB = m_pSpecies_B_ij[i];

View file

@ -488,7 +488,7 @@ namespace Cantera {
* *
* @param k species index. Defaults to zero. * @param k species index. Defaults to zero.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
/** /**
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
@ -496,7 +496,7 @@ namespace Cantera {
* *
* @param k species index * @param k species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the array of non-dimensional molar-based activity coefficients at //! Get the array of non-dimensional molar-based activity coefficients at
//! the current solution temperature, pressure, and solution concentration. //! the current solution temperature, pressure, and solution concentration.

View file

@ -60,35 +60,30 @@ namespace Cantera {
virtual doublereal pressure() const { return m_press; } virtual doublereal pressure() const { return m_press; }
virtual void getChemPotentials(doublereal* mu) const { virtual void getChemPotentials(doublereal* mu) const {
int n, nsp = nSpecies(); for (size_t n = 0; n < nSpecies(); n++) mu[n] = 0.0;
for (n = 0; n < nsp; n++) mu[n] = 0.0;
} }
virtual void getEnthalpy_RT(doublereal* hrt) const { virtual void getEnthalpy_RT(doublereal* hrt) const {
int n, nsp = nSpecies(); for (size_t n = 0; n < nSpecies(); n++) hrt[n] = 0.0;
for (n = 0; n < nsp; n++) hrt[n] = 0.0;
} }
virtual void getEntropy_R(doublereal* sr) const { virtual void getEntropy_R(doublereal* sr) const {
int n, nsp = nSpecies(); for (size_t n = 0; n < nSpecies(); n++) sr[n] = 0.0;
for (n = 0; n < nsp; n++) sr[n] = 0.0;
} }
virtual void getStandardChemPotentials(doublereal* mu0) const { virtual void getStandardChemPotentials(doublereal* mu0) const {
int n, nsp = nSpecies(); for (size_t n = 0; n < nSpecies(); n++) mu0[n] = 0.0;
for (n = 0; n < nsp; n++) mu0[n] = 0.0;
} }
virtual void getActivityConcentrations(doublereal* c) const { virtual void getActivityConcentrations(doublereal* c) const {
int n, nsp = nSpecies(); for (size_t n = 0; n < nSpecies(); n++) c[n] = 1.0;
for (n = 0; n < nsp; n++) c[n] = 1.0;
} }
virtual doublereal standardConcentration(int k=0) const { virtual doublereal standardConcentration(size_t k=0) const {
return 1.0; return 1.0;
} }
virtual doublereal logStandardConc(int k=0) const { virtual doublereal logStandardConc(size_t k=0) const {
return 0.0; return 0.0;
} }

View file

@ -241,7 +241,7 @@ namespace Cantera {
* by which the generalized concentration is normalized to produce * by which the generalized concentration is normalized to produce
* the activity. * the activity.
*/ */
doublereal MetalSHEelectrons::standardConcentration(int k) const { doublereal MetalSHEelectrons::standardConcentration(size_t k) const {
return 1.0; return 1.0;
} }
//==================================================================================================================== //====================================================================================================================
@ -249,7 +249,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal MetalSHEelectrons::logStandardConc(int k) const { doublereal MetalSHEelectrons::logStandardConc(size_t k) const {
return 0.0; return 0.0;
} }
//==================================================================================================================== //====================================================================================================================

View file

@ -336,13 +336,13 @@ namespace Cantera {
* @return * @return
* Returns The standard Concentration as 1.0 * Returns The standard Concentration as 1.0
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Natural logarithm of the standard concentration of the kth species. //! Natural logarithm of the standard concentration of the kth species.
/*! /*!
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the array of chemical potentials at unit activity for the species //! Get the array of chemical potentials at unit activity for the species
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution. //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.

View file

@ -232,7 +232,7 @@ namespace Cantera {
* by which the generalized concentration is normalized to produce * by which the generalized concentration is normalized to produce
* the activity. * the activity.
*/ */
doublereal MineralEQ3::standardConcentration(int k) const { doublereal MineralEQ3::standardConcentration(size_t k) const {
return 1.0; return 1.0;
} }
@ -240,7 +240,7 @@ namespace Cantera {
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
* concentration of the kth species * concentration of the kth species
*/ */
doublereal MineralEQ3::logStandardConc(int k) const { doublereal MineralEQ3::logStandardConc(size_t k) const {
return 0.0; return 0.0;
} }

View file

@ -311,13 +311,13 @@ namespace Cantera {
* @return * @return
* Returns The standard Concentration as 1.0 * Returns The standard Concentration as 1.0
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
//! Natural logarithm of the standard concentration of the kth species. //! Natural logarithm of the standard concentration of the kth species.
/*! /*!
* @param k index of the species (defaults to zero) * @param k index of the species (defaults to zero)
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
//! Get the array of chemical potentials at unit activity for the species //! Get the array of chemical potentials at unit activity for the species
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution. //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.

View file

@ -297,7 +297,7 @@ namespace Cantera {
* preserved. * preserved.
*/ */
void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) { void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) {
int kk = nSpecies(); size_t kk = nSpecies();
doublereal x; doublereal x;
/* /*
* Get a vector of mole fractions * Get a vector of mole fractions
@ -428,12 +428,12 @@ namespace Cantera {
err("getActivityConcentrations"); err("getActivityConcentrations");
} }
doublereal MolalityVPSSTP::standardConcentration(int k) const { doublereal MolalityVPSSTP::standardConcentration(size_t k) const {
err("standardConcentration"); err("standardConcentration");
return -1.0; return -1.0;
} }
doublereal MolalityVPSSTP::logStandardConc(int k) const { doublereal MolalityVPSSTP::logStandardConc(size_t k) const {
err("logStandardConc"); err("logStandardConc");
return -1.0; return -1.0;
} }

View file

@ -477,7 +477,7 @@ namespace Cantera {
* *
* @param k species index. Defaults to zero. * @param k species index. Defaults to zero.
*/ */
virtual doublereal standardConcentration(int k=0) const; virtual doublereal standardConcentration(size_t k=0) const;
/** /**
* Returns the natural logarithm of the standard * Returns the natural logarithm of the standard
@ -485,7 +485,7 @@ namespace Cantera {
* *
* @param k species index * @param k species index
*/ */
virtual doublereal logStandardConc(int k=0) const; virtual doublereal logStandardConc(size_t k=0) const;
/** /**
* Returns the units of the standard and generalized * Returns the units of the standard and generalized
@ -873,7 +873,7 @@ namespace Cantera {
* law. This is the indentity of the Cl- species for the PHSCALE_NBS * law. This is the indentity of the Cl- species for the PHSCALE_NBS
* scaling * scaling
*/ */
int m_indexCLM; size_t m_indexCLM;
//! Molecular weight of the Solvent //! Molecular weight of the Solvent
doublereal m_weightSolvent; doublereal m_weightSolvent;

View file

@ -43,7 +43,7 @@ namespace Cantera {
* 7 = mu3 (J/kmol) * 7 = mu3 (J/kmol)
* ........ * ........
*/ */
Mu0Poly::Mu0Poly(int n, doublereal tlow, doublereal thigh, Mu0Poly::Mu0Poly(size_t n, doublereal tlow, doublereal thigh,
doublereal pref, doublereal pref,
const doublereal* coeffs) : const doublereal* coeffs) :
m_numIntervals(0), m_numIntervals(0),
@ -153,7 +153,7 @@ namespace Cantera {
* *
* *
*/ */
void Mu0Poly::reportParameters(int &n, int &type, void Mu0Poly::reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {
@ -182,7 +182,7 @@ namespace Cantera {
* getting the information from an XML database. * getting the information from an XML database.
*/ */
void installMu0ThermoFromXML(std::string speciesName, void installMu0ThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k, SpeciesThermo& sp, size_t k,
const XML_Node* Mu0Node_ptr) { const XML_Node* Mu0Node_ptr) {
doublereal tmin, tmax; doublereal tmin, tmax;

View file

@ -101,7 +101,7 @@ namespace Cantera {
* - ........ * - ........
* . * .
*/ */
Mu0Poly(int n, doublereal tlow, doublereal thigh, Mu0Poly(size_t n, doublereal tlow, doublereal thigh,
doublereal pref, const doublereal* coeffs); doublereal pref, const doublereal* coeffs);
//! Copy constructor //! Copy constructor
@ -132,7 +132,7 @@ namespace Cantera {
virtual int reportType() const { return MU0_INTERP; } virtual int reportType() const { return MU0_INTERP; }
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const { return m_index; } virtual size_t speciesIndex() const { return m_index; }
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
/*! /*!
@ -192,7 +192,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
virtual void reportParameters(int &n, int &type, virtual void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const; doublereal* const coeffs) const;
@ -249,7 +249,7 @@ namespace Cantera {
doublereal m_Pref; doublereal m_Pref;
//! Species index //! Species index
int m_index; size_t m_index;
private: private:
@ -292,7 +292,7 @@ namespace Cantera {
* @ingroup spthermo * @ingroup spthermo
*/ */
void installMu0ThermoFromXML(std::string speciesName, void installMu0ThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k, SpeciesThermo& sp, size_t k,
const XML_Node* Mu0Node_ptr); const XML_Node* Mu0Node_ptr);
} }

View file

@ -75,7 +75,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
Nasa9Poly1::Nasa9Poly1(int n, doublereal tlow, doublereal thigh, Nasa9Poly1::Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh,
doublereal pref, doublereal pref,
const doublereal* coeffs) : const doublereal* coeffs) :
m_lowT (tlow), m_lowT (tlow),
@ -148,7 +148,7 @@ namespace Cantera {
} }
// Returns an integer representing the species index // Returns an integer representing the species index
int Nasa9Poly1::speciesIndex() const { size_t Nasa9Poly1::speciesIndex() const {
return m_index; return m_index;
} }
@ -258,7 +258,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
void Nasa9Poly1::reportParameters(int &n, int &type, void Nasa9Poly1::reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {

View file

@ -84,7 +84,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
Nasa9Poly1(int n, doublereal tlow, doublereal thigh, doublereal pref, Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
const doublereal* coeffs); const doublereal* coeffs);
//! copy constructor //! copy constructor
@ -121,7 +121,7 @@ namespace Cantera {
virtual int reportType() const; virtual int reportType() const;
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const; virtual size_t speciesIndex() const;
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
/*! /*!
@ -200,7 +200,7 @@ namespace Cantera {
* coeffs[2] is max temperature * coeffs[2] is max temperature
* coeffs[3+i] from i =0,9 are the coefficients themselves * coeffs[3+i] from i =0,9 are the coefficients themselves
*/ */
virtual void reportParameters(int &n, int &type, virtual void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const; doublereal* const coeffs) const;
@ -220,7 +220,7 @@ namespace Cantera {
//! standard-state pressure //! standard-state pressure
doublereal m_Pref; doublereal m_Pref;
//! species index //! species index
int m_index; size_t m_index;
//! array of polynomial coefficients //! array of polynomial coefficients
array_fp m_coeff; array_fp m_coeff;
}; };

View file

@ -216,7 +216,7 @@ namespace Cantera {
// Returns an integer representing the species index // Returns an integer representing the species index
int Nasa9PolyMultiTempRegion::speciesIndex() const { size_t Nasa9PolyMultiTempRegion::speciesIndex() const {
return m_index; return m_index;
} }
@ -332,7 +332,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
void Nasa9PolyMultiTempRegion::reportParameters(int &n, int &type, void Nasa9PolyMultiTempRegion::reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {
@ -344,7 +344,7 @@ namespace Cantera {
double ctmp[12]; double ctmp[12];
coeffs[0] = double(m_numTempRegions); coeffs[0] = double(m_numTempRegions);
int index = 1; int index = 1;
int n_tmp = 0;; size_t n_tmp = 0;;
int type_tmp = 0; int type_tmp = 0;
double pref_tmp = 0.0; double pref_tmp = 0.0;
for (size_t iReg = 0; iReg < m_numTempRegions; iReg++) { for (size_t iReg = 0; iReg < m_numTempRegions; iReg++) {

View file

@ -121,7 +121,7 @@ namespace Cantera {
virtual int reportType() const; virtual int reportType() const;
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const; virtual size_t speciesIndex() const;
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
/*! /*!
@ -202,7 +202,7 @@ namespace Cantera {
* coeffs[index+1] = maxTempZone * coeffs[index+1] = maxTempZone
* coeffs[index+2+i] from i =0,9 are the coefficients themselves * coeffs[index+2+i] from i =0,9 are the coefficients themselves
*/ */
virtual void reportParameters(int &n, int &type, virtual void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const; doublereal* const coeffs) const;
@ -222,7 +222,7 @@ namespace Cantera {
//! standard-state pressure //! standard-state pressure
doublereal m_Pref; doublereal m_Pref;
//! species index //! species index
int m_index; size_t m_index;
//! Number of temperature regions //! Number of temperature regions
size_t m_numTempRegions; size_t m_numTempRegions;

View file

@ -65,7 +65,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
NasaPoly1(int n, doublereal tlow, doublereal thigh, doublereal pref, NasaPoly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
const doublereal* coeffs) : const doublereal* coeffs) :
m_lowT (tlow), m_lowT (tlow),
m_highT (thigh), m_highT (thigh),
@ -132,7 +132,7 @@ namespace Cantera {
virtual int reportType() const { return NASA1; } virtual int reportType() const { return NASA1; }
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const { return m_index; } virtual size_t speciesIndex() const { return m_index; }
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
/*! /*!
@ -226,7 +226,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
virtual void reportParameters(int &n, int &type, virtual void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {
@ -306,7 +306,7 @@ namespace Cantera {
//! standard-state pressure //! standard-state pressure
doublereal m_Pref; doublereal m_Pref;
//! species index //! species index
int m_index; size_t m_index;
//! array of polynomial coefficients //! array of polynomial coefficients
array_fp m_coeff; array_fp m_coeff;

View file

@ -72,7 +72,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
NasaPoly2(int n, doublereal tlow, doublereal thigh, doublereal pref, NasaPoly2(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
const doublereal* coeffs) : const doublereal* coeffs) :
m_lowT(tlow), m_lowT(tlow),
m_highT(thigh), m_highT(thigh),
@ -165,7 +165,7 @@ namespace Cantera {
virtual int reportType() const { return NASA2; } virtual int reportType() const { return NASA2; }
//! Returns an integer representing the species index //! Returns an integer representing the species index
virtual int speciesIndex() const { return m_index; } virtual size_t speciesIndex() const { return m_index; }
//! Update the properties for this species, given a temperature polynomial //! Update the properties for this species, given a temperature polynomial
@ -243,7 +243,7 @@ namespace Cantera {
* @param coeffs Vector of coefficients used to set the * @param coeffs Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
void reportParameters(int &n, int &type, void reportParameters(size_t &n, int &type,
doublereal &tlow, doublereal &thigh, doublereal &tlow, doublereal &thigh,
doublereal &pref, doublereal &pref,
doublereal* const coeffs) const { doublereal* const coeffs) const {
@ -301,7 +301,7 @@ namespace Cantera {
//! pointer to the NasaPoly1 object for the high temperature region. //! pointer to the NasaPoly1 object for the high temperature region.
NasaPoly1 *mnp_high; NasaPoly1 *mnp_high;
//! species index //! species index
int m_index; size_t m_index;
//! array of polynomial coefficients //! array of polynomial coefficients
array_fp m_coeff; array_fp m_coeff;

View file

@ -149,7 +149,7 @@ namespace Cantera {
* parameterization. * parameterization.
* @see speciesThermoTypes.h * @see speciesThermoTypes.h
*/ */
virtual void install(string name, int index, int type, virtual void install(string name, size_t index, int type,
const doublereal* c, const doublereal* c,
doublereal minTemp, doublereal maxTemp, doublereal minTemp, doublereal maxTemp,
doublereal refPressure) { doublereal refPressure) {
@ -235,7 +235,7 @@ namespace Cantera {
* (length m_kk). * (length m_kk).
* *
*/ */
virtual void update_one(int k, doublereal t, doublereal* cp_R, virtual void update_one(size_t k, doublereal t, doublereal* cp_R,
doublereal* h_RT, doublereal* s_R) const { doublereal* h_RT, doublereal* s_R) const {
m_t[0] = t; m_t[0] = t;
@ -245,8 +245,8 @@ namespace Cantera {
m_t[4] = 1.0/t; m_t[4] = 1.0/t;
m_t[5] = log(t); m_t[5] = log(t);
int grp = m_group_map[k]; size_t grp = m_group_map[k];
int pos = m_posInGroup_map[k]; size_t pos = m_posInGroup_map[k];
const vector<NasaPoly1> &mlg = m_low[grp-1]; const vector<NasaPoly1> &mlg = m_low[grp-1];
const NasaPoly1 *nlow = &(mlg[pos]); const NasaPoly1 *nlow = &(mlg[pos]);
@ -313,8 +313,8 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal minTemp(int k=-1) const { virtual doublereal minTemp(size_t k=-1) const {
if (k < 0) if (k == -1)
return m_tlow_max; return m_tlow_max;
else else
return m_tlow[k]; return m_tlow[k];
@ -330,8 +330,8 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal maxTemp(int k=-1) const { virtual doublereal maxTemp(size_t k=-1) const {
if (k < 0) if (k == -1)
return m_thigh_min; return m_thigh_min;
else else
return m_thigh[k]; return m_thigh[k];
@ -350,7 +350,7 @@ namespace Cantera {
* *
* @param k Species index * @param k Species index
*/ */
virtual doublereal refPressure(int k = -1) const { virtual doublereal refPressure(size_t k = -1) const {
return m_p0; return m_p0;
} }
@ -360,7 +360,7 @@ namespace Cantera {
* *
* @param index Species index * @param index Species index
*/ */
virtual int reportType(int index) const { return NASA; } virtual int reportType(size_t index) const { return NASA; }
/*! /*!
* This utility function reports back the type of * This utility function reports back the type of
@ -376,15 +376,15 @@ namespace Cantera {
* @param maxTemp output - Maximum temperature * @param maxTemp output - Maximum temperature
* @param refPressure output - reference pressure (Pa). * @param refPressure output - reference pressure (Pa).
*/ */
virtual void reportParams(int index, int &type, virtual void reportParams(size_t index, int &type,
doublereal * const c, doublereal * const c,
doublereal &minTemp, doublereal &minTemp,
doublereal &maxTemp, doublereal &maxTemp,
doublereal &refPressure) const { doublereal &refPressure) const {
type = reportType(index); type = reportType(index);
if (type == NASA) { if (type == NASA) {
int grp = m_group_map[index]; size_t grp = m_group_map[index];
int pos = m_posInGroup_map[index]; size_t pos = m_posInGroup_map[index];
const vector<NasaPoly1> &mlg = m_low[grp-1]; const vector<NasaPoly1> &mlg = m_low[grp-1];
const vector<NasaPoly1> &mhg = m_high[grp-1]; const vector<NasaPoly1> &mhg = m_high[grp-1];
const NasaPoly1 *lowPoly = &(mlg[pos]); const NasaPoly1 *lowPoly = &(mlg[pos]);
@ -392,7 +392,7 @@ namespace Cantera {
int itype = NASA; int itype = NASA;
doublereal tmid = lowPoly->maxTemp(); doublereal tmid = lowPoly->maxTemp();
c[0] = tmid; c[0] = tmid;
int n; size_t n;
double ttemp; double ttemp;
lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure, lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure,
c + 1); c + 1);
@ -428,11 +428,11 @@ namespace Cantera {
* @param c Vector of coefficients used to set the * @param c Vector of coefficients used to set the
* parameters for the standard state. * parameters for the standard state.
*/ */
virtual void modifyParams(int index, doublereal *c) { virtual void modifyParams(size_t index, doublereal *c) {
int type = reportType(index); int type = reportType(index);
if (type == NASA) { if (type == NASA) {
int grp = m_group_map[index]; size_t grp = m_group_map[index];
int pos = m_posInGroup_map[index]; size_t pos = m_posInGroup_map[index];
vector<NasaPoly1> &mlg = m_low[grp-1]; vector<NasaPoly1> &mlg = m_low[grp-1];
vector<NasaPoly1> &mhg = m_high[grp-1]; vector<NasaPoly1> &mhg = m_high[grp-1];
NasaPoly1 *lowPoly = &(mlg[pos]); NasaPoly1 *lowPoly = &(mlg[pos]);
@ -561,17 +561,17 @@ namespace Cantera {
* for that species are stored. group indecises start at 1, * for that species are stored. group indecises start at 1,
* so a decrement is always performed to access vectors. * so a decrement is always performed to access vectors.
*/ */
mutable map<int, int> m_group_map; mutable map<size_t, size_t> m_group_map;
/*! /*!
* This map takes as its index, the species index in the phase. * This map takes as its index, the species index in the phase.
* It returns the position index within the group, where the * It returns the position index within the group, where the
* temperature polynomials for that species are storred. * temperature polynomials for that species are storred.
*/ */
mutable map<int, int> m_posInGroup_map; mutable map<size_t, size_t> m_posInGroup_map;
//! Species name as a function of the species index //! Species name as a function of the species index
mutable map<int, string> m_name; mutable map<size_t, string> m_name;
private: private:

View file

@ -48,7 +48,7 @@ namespace Cantera {
{ {
} }
PDSS::PDSS(VPStandardStateTP *tp, int spindex) : PDSS::PDSS(VPStandardStateTP *tp, size_t spindex) :
m_pdssType(cPDSS_UNDEF), m_pdssType(cPDSS_UNDEF),
m_temp(-1.0), m_temp(-1.0),
m_pres(-1.0), m_pres(-1.0),
@ -485,7 +485,7 @@ namespace Cantera {
} }
void PDSS::reportParams(int &kindex, int &type, void PDSS::reportParams(size_t &kindex, int &type,
doublereal * const c, doublereal * const c,
doublereal &minTemp, doublereal &minTemp,
doublereal &maxTemp, doublereal &maxTemp,

View file

@ -233,7 +233,7 @@ namespace Cantera {
* @param tp Pointer to the ThermoPhase object pertaining to the phase * @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase * @param spindex Species index of the species in the phase
*/ */
PDSS(VPStandardStateTP *tp, int spindex); PDSS(VPStandardStateTP *tp, size_t spindex);
//! Copy Constructor //! Copy Constructor
/*! /*!
@ -620,7 +620,7 @@ namespace Cantera {
* @param refPressure output - reference pressure (Pa). * @param refPressure output - reference pressure (Pa).
* *
*/ */
virtual void reportParams(int &kindex, int &type, doublereal * const c, virtual void reportParams(size_t &kindex, int &type, doublereal * const c,
doublereal &minTemp, doublereal &maxTemp, doublereal &minTemp, doublereal &maxTemp,
doublereal &refPressure) const; doublereal &refPressure) const;
@ -692,7 +692,7 @@ namespace Cantera {
/** /**
* Species index in the thermophase corresponding to this species. * Species index in the thermophase corresponding to this species.
*/ */
int m_spindex; size_t m_spindex;
//! Pointer to the species thermodynamic property manager. //! Pointer to the species thermodynamic property manager.
/*! /*!

View file

@ -23,21 +23,21 @@ namespace Cantera {
* Basic list of constructors and duplicators * Basic list of constructors and duplicators
*/ */
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex) : PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex) :
PDSS(tp, spindex) PDSS(tp, spindex)
{ {
m_pdssType = cPDSS_CONSTVOL; m_pdssType = cPDSS_CONSTVOL;
} }
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex, std::string inputFile, std::string id) : PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex, std::string inputFile, std::string id) :
PDSS(tp, spindex) PDSS(tp, spindex)
{ {
m_pdssType = cPDSS_CONSTVOL; m_pdssType = cPDSS_CONSTVOL;
constructPDSSFile(tp, spindex, inputFile, id); constructPDSSFile(tp, spindex, inputFile, id);
} }
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex, PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex,
const XML_Node& speciesNode, const XML_Node& speciesNode,
const XML_Node& phaseRoot, const XML_Node& phaseRoot,
bool spInstalled) : bool spInstalled) :
@ -93,7 +93,7 @@ namespace Cantera {
* phase. If none is given, the first XML * phase. If none is given, the first XML
* phase element will be used. * phase element will be used.
*/ */
void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP *tp, int spindex, void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP *tp, size_t spindex,
const XML_Node& speciesNode, const XML_Node& speciesNode,
const XML_Node& phaseNode, bool spInstalled) { const XML_Node& phaseNode, bool spInstalled) {
PDSS::initThermo(); PDSS::initThermo();
@ -138,7 +138,7 @@ namespace Cantera {
* phase. If none is given, the first XML * phase. If none is given, the first XML
* phase element will be used. * phase element will be used.
*/ */
void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP *tp, int spindex, void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP *tp, size_t spindex,
std::string inputFile, std::string id) { std::string inputFile, std::string id) {
if (inputFile.size() == 0) { if (inputFile.size() == 0) {

Some files were not shown because too many files have changed in this diff Show more