Fixing compiler warnings, part 4

This commit is contained in:
Ray Speth 2012-01-17 04:11:20 +00:00
parent 255f1f9b9f
commit 9470103bb2
70 changed files with 859 additions and 932 deletions

View file

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

View file

@ -36,7 +36,7 @@ public:
* @param mcol Number of columns
* @param nrow Number of rows
*/
IntStarStar(int mcol, int nrow, int v = 0);
IntStarStar(size_t mcol, size_t nrow, int v = 0);
//! copy constructor
IntStarStar(const IntStarStar& y);
@ -51,19 +51,19 @@ public:
* @param nrow This is the number of rows
* @param v Default fill value -> defaults to zero.
*/
void resize(int mcol, int nrow, int v = 0);
void resize(size_t mcol, size_t nrow, int v = 0);
//! Pointer to the top of the column
/*!
* @param jcol Pointer to the top of the jth column
*/
int * const operator[](int jcol);
int * const operator[](size_t jcol);
//! Pointer to the top of the column
/*!
* @param j Pointer to the top of the jth column
*/
const int * const operator[](int jcol) const;
const int * const operator[](size_t jcol) const;
//! Returns a int ** pointer to the base address
/*!
@ -74,10 +74,10 @@ public:
int * const * const baseDataAddr();
//! Number of rows
int nRows() const;
size_t nRows() const;
//! Number of columns
int nColumns() const;
size_t nColumns() const;
private:
//! Storage area
@ -86,10 +86,10 @@ private:
std::vector<int *> m_colAddr;
//! number of rows
int m_nrows;
size_t m_nrows;
//! number of columns
int m_ncols;
size_t m_ncols;
};
}

View file

@ -698,7 +698,7 @@ namespace VCSnonideal {
} else {
plogf(" %15.3e %15.3e ", m_vprob->w[i], m_vprob->mf[i]);
if (m_vprob->w[i] <= 0.0) {
int iph = m_vprob->PhaseID[i];
size_t iph = m_vprob->PhaseID[i];
vcs_VolPhase *VPhase = m_vprob->VPhaseList[iph];
if (VPhase->nSpecies() > 1) {
plogf(" -1.000e+300\n");
@ -737,7 +737,7 @@ namespace VCSnonideal {
double vol = 0.0;
string sName;
int nphase = m_vprob->NPhase;
size_t nphase = m_vprob->NPhase;
FILE * FP = fopen(reportFile.c_str(), "w");
if (!FP) {
@ -759,7 +759,7 @@ namespace VCSnonideal {
vol = 0.0;
for (int iphase = 0; iphase < nphase; iphase++) {
for (size_t iphase = 0; iphase < nphase; iphase++) {
istart = m_mix->speciesIndex(0, iphase);
Cantera::ThermoPhase &tref = m_mix->phase(iphase);
nSpecies = tref.nSpecies();
@ -784,7 +784,7 @@ namespace VCSnonideal {
fprintf(FP,"Number Basis optimizations = %d\n", m_vprob->m_NumBasisOptimizations);
fprintf(FP,"Number VCS iterations = %d\n", m_vprob->m_Iterations);
for (int iphase = 0; iphase < nphase; iphase++) {
for (size_t iphase = 0; iphase < nphase; iphase++) {
istart = m_mix->speciesIndex(0, iphase);
Cantera::ThermoPhase &tref = m_mix->phase(iphase);
Cantera::ThermoPhase *tp = &tref;
@ -902,7 +902,6 @@ namespace VCSnonideal {
*/
int vcs_Cantera_to_vprob(Cantera::MultiPhase *mphase,
VCSnonideal::VCS_PROB *vprob) {
int k;
VCS_SPECIES_THERMO *ts_ptr = 0;
/*
@ -935,7 +934,7 @@ namespace VCSnonideal {
* Loop over the phases, transfering pertinent information
*/
int kT = 0;
for (int iphase = 0; iphase < totNumPhases; iphase++) {
for (size_t iphase = 0; iphase < totNumPhases; iphase++) {
/*
* Get the thermophase object - assume volume phase
@ -1057,7 +1056,7 @@ namespace VCSnonideal {
/*
* Loop through each species in the current phase
*/
for (k = 0; k < nSpPhase; k++) {
for (size_t k = 0; k < nSpPhase; k++) {
/*
* Obtain the molecular weight of the species from the
* ThermoPhase object
@ -1201,8 +1200,8 @@ namespace VCSnonideal {
* estimate of the total number of moles is zero.
*/
if (tMoles > 0.0) {
for (k = 0; k < nSpPhase; k++) {
int kTa = VolPhase->spGlobalIndexVCS(k);
for (size_t k = 0; k < nSpPhase; k++) {
size_t kTa = VolPhase->spGlobalIndexVCS(k);
vprob->mf[kTa] = vprob->w[kTa] / tMoles;
}
} else {
@ -1210,8 +1209,8 @@ namespace VCSnonideal {
* Perhaps, we could do a more sophisticated treatment below.
* But, will start with this.
*/
for (k = 0; k < nSpPhase; k++) {
int kTa = VolPhase->spGlobalIndexVCS(k);
for (size_t k = 0; k < nSpPhase; k++) {
size_t kTa = VolPhase->spGlobalIndexVCS(k);
vprob->mf[kTa]= 1.0 / (double) nSpPhase;
}
}
@ -1222,7 +1221,7 @@ namespace VCSnonideal {
* at the specified temperature.
*/
double R = vcsUtil_gasConstant(vprob->m_VCS_UnitsFormat);
for (k = 0; k < nSpPhase; k++) {
for (size_t k = 0; k < nSpPhase; k++) {
vcs_SpeciesProperties *sProp = VolPhase->speciesProperty(k);
ts_ptr = sProp->SpeciesThermo;
ts_ptr->SS0_feSave = VolPhase->G0_calc_one(k)/ R;
@ -1252,7 +1251,7 @@ namespace VCSnonideal {
plogf(" species phaseID phaseName ");
plogf(" Initial_Estimated_kMols\n");
for (int i = 0; i < vprob->nspecies; i++) {
int iphase = vprob->PhaseID[i];
size_t iphase = vprob->PhaseID[i];
vcs_VolPhase *VolPhase = vprob->VPhaseList[iphase];
plogf("%16s %5d %16s", vprob->SpName[i].c_str(), iphase,
@ -1338,8 +1337,8 @@ namespace VCSnonideal {
kT++;
}
if (volPhase->phiVarIndex() >= 0) {
int kphi = volPhase->phiVarIndex();
int kglob = volPhase->spGlobalIndexVCS(kphi);
size_t kphi = volPhase->phiVarIndex();
size_t kglob = volPhase->spGlobalIndexVCS(kphi);
vprob->w[kglob] = tPhase->electricPotential();
}
volPhase->setMolesFromVCS(VCS_STATECALC_OLD, VCS_DATA_PTR(vprob->w));
@ -1373,8 +1372,8 @@ namespace VCSnonideal {
plogf(" Phase IDs of species\n");
plogf(" species phaseID phaseName ");
plogf(" Initial_Estimated_kMols\n");
for (int i = 0; i < vprob->nspecies; i++) {
int iphase = vprob->PhaseID[i];
for (size_t i = 0; i < vprob->nspecies; i++) {
size_t iphase = vprob->PhaseID[i];
vcs_VolPhase *VolPhase = vprob->VPhaseList[iphase];
plogf("%16s %5d %16s", vprob->SpName[i].c_str(), iphase,
@ -1390,7 +1389,7 @@ namespace VCSnonideal {
plogf(" PhaseName PhaseNum SingSpec GasPhase EqnState NumSpec");
plogf(" TMolesInert Tmoles(kmol)\n");
for (int iphase = 0; iphase < vprob->NPhase; iphase++) {
for (size_t iphase = 0; iphase < vprob->NPhase; iphase++) {
vcs_VolPhase *VolPhase = vprob->VPhaseList[iphase];
std::string sEOS = string16_EOSType(VolPhase->m_eqnState);
plogf("%16s %5d %5d %8d %16s %8d %16e ", VolPhase->PhaseName.c_str(),
@ -1412,35 +1411,35 @@ namespace VCSnonideal {
// This routine hasn't been checked yet
void vcs_MultiPhaseEquil::getStoichVector(index_t rxn, Cantera::vector_fp& nu) {
int nsp = m_vsolvePtr->m_numSpeciesTot;
size_t nsp = m_vsolvePtr->m_numSpeciesTot;
nu.resize(nsp, 0.0);
for (int i = 0; i < nsp; i++) {
for (size_t i = 0; i < nsp; i++) {
nu[i] = 0.0;
}
int nc = numComponents();
size_t nc = numComponents();
// scMatrix [nrxn][ncomp]
const DoubleStarStar &scMatrix = m_vsolvePtr->m_stoichCoeffRxnMatrix;
const std::vector<int> indSpecies = m_vsolvePtr->m_speciesMapIndex;
if ((int) rxn > nsp - nc) return;
int j = indSpecies[rxn + nc];
const std::vector<size_t>& indSpecies = m_vsolvePtr->m_speciesMapIndex;
if (rxn > nsp - nc) return;
size_t j = indSpecies[rxn + nc];
nu[j] = 1.0;
for (int kc = 0; kc < nc; kc++) {
for (size_t kc = 0; kc < nc; kc++) {
j = indSpecies[kc];
nu[j] = scMatrix[rxn][kc];
}
}
int vcs_MultiPhaseEquil::numComponents() const {
int nc = -1;
size_t vcs_MultiPhaseEquil::numComponents() const {
size_t nc = -1;
if (m_vsolvePtr) {
nc = m_vsolvePtr->m_numComponents;
}
return nc;
}
int vcs_MultiPhaseEquil::numElemConstraints() const {
int nec = -1;
size_t vcs_MultiPhaseEquil::numElemConstraints() const {
size_t nec = -1;
if (m_vsolvePtr) {
nec = m_vsolvePtr->m_numElemConstraints;
}
@ -1448,8 +1447,8 @@ namespace VCSnonideal {
}
int vcs_MultiPhaseEquil::component(int m) const {
int nc = numComponents();
size_t vcs_MultiPhaseEquil::component(size_t m) const {
size_t nc = numComponents();
if (m < nc) return m_vsolvePtr->m_speciesMapIndex[m];
else return -1;
}

View file

@ -294,7 +294,7 @@ namespace VCSnonideal {
* number of components, which can be obtained from the
* numComponents() command.
*/
int component(int m) const ;
size_t component(size_t m) const ;
//! Get the stoichiometric reaction coefficients for a single
//! reaction index
@ -546,14 +546,14 @@ namespace VCSnonideal {
* @return returns the number of components. If an equilibrium
* problem hasn't been solved yet, it returns -1.
*/
int numComponents() const;
size_t numComponents() const;
//! Reports the number of element contraints in the equilibration problem
/*!
* @return returns the number of element constraints. If an equilibrium
* problem hasn't been solved yet, it returns -1.
*/
int numElemConstraints() const;
size_t numElemConstraints() const;
// Friend functions

View file

@ -13,10 +13,10 @@ class vcs_VolPhase;
class vcs_SpeciesProperties {
public:
int IndexPhase;
int IndexSpeciesPhase;
size_t IndexPhase;
size_t IndexSpeciesPhase;
vcs_VolPhase *OwningPhase;
int NumElements;
size_t NumElements;
//! Name of the species
std::string SpName;

View file

@ -135,9 +135,8 @@ namespace VCSnonideal {
* (note, this is used, so keep it current!)
*/
vcs_VolPhase& vcs_VolPhase::operator=(const vcs_VolPhase& b) {
int k;
if (&b != this) {
int old_num = m_numSpecies;
size_t old_num = m_numSpecies;
// Note: we comment this out for the assignment operator
// specifically, because it isn't true for the assignment
@ -186,14 +185,14 @@ namespace VCSnonideal {
IndSpecies = b.IndSpecies;
//IndSpeciesContig = b.IndSpeciesContig;
for (k = 0; k < old_num; k++) {
for (size_t k = 0; k < old_num; k++) {
if ( ListSpeciesPtr[k]) {
delete ListSpeciesPtr[k];
ListSpeciesPtr[k] = 0;
}
}
ListSpeciesPtr.resize(m_numSpecies, 0);
for (k = 0; k < m_numSpecies; k++) {
for (size_t k = 0; k < m_numSpecies; k++) {
ListSpeciesPtr[k] =
new vcs_SpeciesProperties(*(b.ListSpeciesPtr[k]));
}
@ -393,8 +392,8 @@ namespace VCSnonideal {
TP_ptr->getGibbs_ref(VCS_DATA_PTR(SS0ChemicalPotential));
} else {
double R = vcsUtil_gasConstant(p_VCS_UnitsFormat);
for (int k = 0; k < m_numSpecies; k++) {
int kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
VCS_SPECIES_THERMO *sTherm = sProp->SpeciesThermo;
SS0ChemicalPotential[k] =
@ -413,7 +412,7 @@ namespace VCSnonideal {
*
* @return return value of the gibbs free energy
*/
double vcs_VolPhase::G0_calc_one(int kspec) const {
double vcs_VolPhase::G0_calc_one(size_t kspec) const {
if (!m_UpToDate_G0) {
_updateG0();
}
@ -434,8 +433,8 @@ namespace VCSnonideal {
TP_ptr->getStandardChemPotentials(VCS_DATA_PTR(StarChemicalPotential));
} else {
double R = vcsUtil_gasConstant(p_VCS_UnitsFormat);
for (int k = 0; k < m_numSpecies; k++) {
int kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
VCS_SPECIES_THERMO *sTherm = sProp->SpeciesThermo;
StarChemicalPotential[k] =
@ -458,7 +457,7 @@ namespace VCSnonideal {
* @return Gstar[kspec] returns the gibbs free energy for the
* standard state of the kspec species.
*/
double vcs_VolPhase::GStar_calc_one(int kspec) const {
double vcs_VolPhase::GStar_calc_one(size_t kspec) const {
if (!m_UpToDate_GStar) {
_updateGStar();
}
@ -578,7 +577,7 @@ namespace VCSnonideal {
*/
void vcs_VolPhase::setMolesFromVCS(const int stateCalc,
const double * molesSpeciesVCS) {
int kglob;
size_t kglob;
double tmp;
v_totalMoles = m_totalMolesInert;
@ -619,14 +618,14 @@ namespace VCSnonideal {
}
#endif
for (int k = 0; k < m_numSpecies; k++) {
for (size_t k = 0; k < m_numSpecies; k++) {
if (m_speciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
kglob = IndSpecies[k];
v_totalMoles += MAX(0.0, molesSpeciesVCS[kglob]);
}
}
if (v_totalMoles > 0.0) {
for (int k = 0; k < m_numSpecies; k++) {
for (size_t k = 0; k < m_numSpecies; k++) {
if (m_speciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
kglob = IndSpecies[k];
tmp = MAX(0.0, molesSpeciesVCS[kglob]);
@ -761,9 +760,8 @@ namespace VCSnonideal {
if (!m_UpToDate_AC) {
_updateActCoeff();
}
int kglob;
for (int k = 0; k < m_numSpecies; k++) {
kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
AC[kglob] = ActCoeff[k];
}
}
@ -783,9 +781,8 @@ namespace VCSnonideal {
if (!m_UpToDate_VolPM) {
(void) _updateVolPM();
}
int kglob;
for (int k = 0; k < m_numSpecies; k++) {
kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
VolPM[kglob] = PartialMolarVol[k];
}
return m_totalVol;
@ -806,9 +803,8 @@ namespace VCSnonideal {
if (!m_UpToDate_GStar) {
_updateGStar();
}
int kglob;
for (int k = 0; k < m_numSpecies; k++) {
kglob = IndSpecies[k];
size_t kglob = IndSpecies[k];
gstar[kglob] = StarChemicalPotential[k];
}
}
@ -892,8 +888,8 @@ namespace VCSnonideal {
if (m_useCanteraCalls) {
TP_ptr->getStandardVolumes(VCS_DATA_PTR(StarMolarVol));
} else {
for (int k = 0; k < m_numSpecies; k++) {
int kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
VCS_SPECIES_THERMO *sTherm = sProp->SpeciesThermo;
StarMolarVol[k] = (sTherm->VolStar_calc(kglob, Temp, Pres));
@ -916,7 +912,7 @@ namespace VCSnonideal {
* @return molar volume of the kspec species's standard
* state
*/
double vcs_VolPhase::VolStar_calc_one(int kspec) const {
double vcs_VolPhase::VolStar_calc_one(size_t kspec) const {
if (!m_UpToDate_VolStar) {
_updateVolStar();
}
@ -932,24 +928,22 @@ namespace VCSnonideal {
* @return total volume (m**3)
*/
double vcs_VolPhase::_updateVolPM() const {
int k, kglob;
if (m_useCanteraCalls) {
TP_ptr->getPartialMolarVolumes(VCS_DATA_PTR(PartialMolarVol));
} else {
for (k = 0; k < m_numSpecies; k++) {
kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
VCS_SPECIES_THERMO *sTherm = sProp->SpeciesThermo;
StarMolarVol[k] = (sTherm->VolStar_calc(kglob, Temp, Pres));
}
for (k = 0; k < m_numSpecies; k++) {
for (size_t k = 0; k < m_numSpecies; k++) {
PartialMolarVol[k] = StarMolarVol[k];
}
}
m_totalVol = 0.0;
for (k = 0; k < m_numSpecies; k++) {
for (size_t k = 0; k < m_numSpecies; k++) {
m_totalVol += PartialMolarVol[k] * Xmol[k];
}
m_totalVol *= v_totalMoles;
@ -1065,13 +1059,12 @@ namespace VCSnonideal {
/*
* Now copy over the values
*/
int j, k, jglob, kglob;
for (j = 0; j < m_numSpecies; j++) {
jglob = IndSpecies[j];
for (size_t j = 0; j < m_numSpecies; j++) {
size_t jglob = IndSpecies[j];
double * const lnACJacVCS_col = LnACJac_VCS[jglob];
const double * const lnACJac_col = dLnActCoeffdMolNumber[j];
for (k = 0; k < m_numSpecies; k++) {
kglob = IndSpecies[k];
for (size_t k = 0; k < m_numSpecies; k++) {
size_t kglob = IndSpecies[k];
lnACJacVCS_col[kglob] = lnACJac_col[k];
}
}
@ -1151,7 +1144,7 @@ namespace VCSnonideal {
}
/***************************************************************************/
double vcs_VolPhase::molefraction(int k) const {
double vcs_VolPhase::molefraction(size_t k) const {
return Xmol[k];
}
/***************************************************************************/
@ -1418,8 +1411,7 @@ namespace VCSnonideal {
/**********************************************************************/
// Returns the global index of the local element index for the phase
int vcs_VolPhase::elemGlobalIndex(const int e) const {
DebugAssertThrowVCS(e >= 0, " vcs_VolPhase::elemGlobalIndex") ;
size_t vcs_VolPhase::elemGlobalIndex(const size_t e) const {
DebugAssertThrowVCS(e < m_numElemConstraints, " vcs_VolPhase::elemGlobalIndex") ;
return m_elemGlobalIndex[e];
}
@ -1427,7 +1419,6 @@ namespace VCSnonideal {
// Returns the global index of the local element index for the phase
void vcs_VolPhase::setElemGlobalIndex(const size_t eLocal, const size_t eGlobal) {
DebugAssertThrowVCS(eLocal >= 0, "vcs_VolPhase::setElemGlobalIndex");
DebugAssertThrowVCS(eLocal < m_numElemConstraints,
"vcs_VolPhase::setElemGlobalIndex");
m_elemGlobalIndex[eLocal] = eGlobal;
@ -1475,7 +1466,7 @@ namespace VCSnonideal {
return false;
}
int vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) {
size_t vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) {
size_t e, k, eT;
std::string ename;
size_t eFound = -2;
@ -1642,7 +1633,7 @@ namespace VCSnonideal {
/***************************************************************************/
//! Return the number of species in the phase
int vcs_VolPhase::nSpecies() const {
size_t vcs_VolPhase::nSpecies() const {
return m_numSpecies;
}
/***************************************************************************/

View file

@ -258,7 +258,7 @@ namespace VCSnonideal {
* @return Gstar[kspec] returns the gibbs free energy for the
* standard state of the kth species.
*/
double GStar_calc_one(int kspec) const;
double GStar_calc_one(size_t kspec) const;
//! Gibbs free energy calculation at a temperature for the reference state
//! of a species, return a value for one species
@ -268,7 +268,7 @@ namespace VCSnonideal {
*
* @return return value of the gibbs free energy
*/
double G0_calc_one(int kspec) const;
double G0_calc_one(size_t kspec) const;
//! Molar volume calculation for standard state of one species
/*!
@ -283,7 +283,7 @@ namespace VCSnonideal {
* @return molar volume of the kspec species's standard
* state (m**3/kmol)
*/
double VolStar_calc_one(int kglob) const;
double VolStar_calc_one(size_t kglob) const;
//! Fill in the partial molar volume vector for VCS
/*!
@ -377,7 +377,7 @@ namespace VCSnonideal {
*
* @return Value of the mole fraction
*/
double molefraction(int kspec) const;
double molefraction(size_t kspec) const;
//! Sets the total moles in the phase
/*!
@ -512,7 +512,7 @@ namespace VCSnonideal {
double totalMolesInert() const;
//! Returns the global index of the local element index for the phase
int elemGlobalIndex(const int e) const;
size_t elemGlobalIndex(const size_t e) const;
//! sets a local phase element to a global index value
/*!
@ -552,7 +552,7 @@ namespace VCSnonideal {
*
* @param tPhase Pointer to the thermophase object
*/
int transferElementsFM(const Cantera::ThermoPhase * const tPhase);
size_t transferElementsFM(const Cantera::ThermoPhase * const tPhase);
//! Get a constant form of the Species Formula Matrix
/*!
@ -579,7 +579,7 @@ namespace VCSnonideal {
//! Return the number of species in the phase
int nSpecies() const;
size_t nSpecies() const;
private:

View file

@ -58,8 +58,7 @@ namespace VCSnonideal {
*
*/
int VCS_SOLVE::vcs_elabcheck(int ibound) {
int i;
int top = m_numComponents;
size_t top = m_numComponents;
double eval, scale;
int numNonZero;
bool multisign = false;
@ -69,7 +68,7 @@ namespace VCSnonideal {
/*
* Require 12 digits of accuracy on non-zero constraints.
*/
for (i = 0; i < top; ++i) {
for (size_t i = 0; i < top; ++i) {
if (m_elementActive[i]) {
if (fabs(m_elemAbundances[i] - m_elemAbundancesGoal[i]) > (fabs(m_elemAbundancesGoal[i]) * 1.0e-12)) {
/*
@ -200,7 +199,7 @@ namespace VCSnonideal {
*
*************************************************************************/
{
int i, j, retn = 0, kspec, goodSpec, its;
int i, j, retn = 0, goodSpec, its;
double xx, par, saveDir, dir;
#ifdef DEBUG_MODE
@ -237,7 +236,7 @@ namespace VCSnonideal {
for (i = 0; i < m_numElemConstraints; ++i) {
numNonZero = 0;
multisign = false;
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double eval = m_formulaMatrix[i][kspec];
if (eval < 0.0) {
@ -250,7 +249,7 @@ namespace VCSnonideal {
}
if (!multisign) {
if (numNonZero < 2) {
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double eval = m_formulaMatrix[i][kspec];
if (eval > 0.0) {
@ -261,8 +260,8 @@ namespace VCSnonideal {
}
} else {
int numCompNonZero = 0;
int compID = -1;
for (kspec = 0; kspec < m_numComponents; kspec++) {
size_t compID = -1;
for (size_t kspec = 0; kspec < m_numComponents; kspec++) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double eval = m_formulaMatrix[i][kspec];
if (eval > 0.0) {
@ -273,7 +272,7 @@ namespace VCSnonideal {
}
if (numCompNonZero == 1) {
double diff = m_elemAbundancesGoal[i];
for (kspec = m_numComponents; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = m_numComponents; kspec < m_numSpeciesTot; kspec++) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double eval = m_formulaMatrix[i][kspec];
diff -= eval * m_molNumSpecies_old[kspec];
@ -302,7 +301,7 @@ namespace VCSnonideal {
for (i = 0; i < m_numElemConstraints; ++i) {
int elType = m_elType[i];
if (elType == VCS_ELEM_TYPE_ABSPOS) {
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double atomComp = m_formulaMatrix[i][kspec];
if (atomComp > 0.0) {
@ -424,7 +423,7 @@ namespace VCSnonideal {
* First find a species whose adjustment is a win-win
* situation.
*/
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
continue;
}
@ -486,7 +485,7 @@ namespace VCSnonideal {
for (i = 0; i < m_numElemConstraints; ++i) {
if (m_elType[i] == VCS_ELEM_TYPE_CHARGENEUTRALITY ||
(m_elType[i] == VCS_ELEM_TYPE_ABSPOS && m_elemAbundancesGoal[i] == 0.0)) {
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
if (m_elemAbundances[i] > 0.0) {
if (m_formulaMatrix[i][kspec] < 0.0) {
m_molNumSpecies_old[kspec] -= m_elemAbundances[i] / m_formulaMatrix[i][kspec] ;
@ -524,7 +523,7 @@ namespace VCSnonideal {
double dev = m_elemAbundancesGoal[i] - m_elemAbundances[i];
if (m_elType[i] == VCS_ELEM_TYPE_ELECTRONCHARGE && (fabs(dev) > 1.0E-300)) {
bool useZeroed = true;
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
if (dev < 0.0) {
if (m_formulaMatrix[i][kspec] < 0.0) {
if (m_molNumSpecies_old[kspec] > 0.0) {
@ -539,7 +538,7 @@ namespace VCSnonideal {
}
}
}
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
if (m_molNumSpecies_old[kspec] > 0.0 || useZeroed) {
if (dev < 0.0) {
if (m_formulaMatrix[i][kspec] < 0.0) {

View file

@ -58,8 +58,9 @@ namespace VCSnonideal {
*/
int VCS_SOLVE::vcs_elem_rearrange(double * const aw, double * const sa,
double * const sm, double * const ss) {
int j, k, l, i, jl, ml, jr, lindep, ielem;
int ncomponents = m_numComponents;
size_t j, k, l, i, jl, ml, jr, ielem;
bool lindep;
size_t ncomponents = m_numComponents;
double test = -1.0E10;
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
@ -75,13 +76,13 @@ namespace VCSnonideal {
* Use a temporary work array for the element numbers
* Also make sure the value of test is unique.
*/
lindep = FALSE;
lindep = false;
do {
lindep = FALSE;
lindep = false;
for (i = 0; i < m_numElemConstraints; ++i) {
test -= 1.0;
aw[i] = m_elemAbundancesGoal[i];
if (test == aw[i]) lindep = TRUE;
if (test == aw[i]) lindep = true;
}
} while (lindep);
@ -175,8 +176,8 @@ namespace VCSnonideal {
/* **************************************************** */
/* **** IF NORM OF NEW ROW .LT. 1E-6 REJECT ********** */
/* **************************************************** */
if (sa[jr] < 1.0e-6) lindep = TRUE;
else lindep = FALSE;
if (sa[jr] < 1.0e-6) lindep = true;
else lindep = false;
} while(lindep);
/* ****************************************** */
/* **** REARRANGE THE DATA ****************** */
@ -213,14 +214,14 @@ namespace VCSnonideal {
* @param ipos first global element index
* @param jpos second global element index
*/
void VCS_SOLVE::vcs_switch_elem_pos(int ipos, int jpos) {
void VCS_SOLVE::vcs_switch_elem_pos(size_t ipos, size_t jpos) {
if (ipos == jpos) return;
int j;
size_t j;
double dtmp;
vcs_VolPhase *volPhase;
#ifdef DEBUG_MODE
if (ipos < 0 || ipos > (m_numElemConstraints - 1) ||
jpos < 0 || jpos > (m_numElemConstraints - 1) ) {
if (ipos > (m_numElemConstraints - 1) ||
jpos > (m_numElemConstraints - 1)) {
plogf("vcs_switch_elem_pos: ifunc = 0: inappropriate args: %d %d\n",
ipos, jpos);
plogendl();
@ -231,7 +232,7 @@ namespace VCSnonideal {
* Change the element Global Index list in each vcs_VolPhase object
* to reflect the switch in the element positions.
*/
for (int iph = 0; iph < m_numPhases; iph++) {
for (size_t iph = 0; iph < m_numPhases; iph++) {
volPhase = m_VolPhaseList[iph];
for (size_t e = 0; e < volPhase->nElemConstraints(); e++) {
if (volPhase->elemGlobalIndex(e) == ipos) {
@ -244,7 +245,7 @@ namespace VCSnonideal {
}
vcsUtil_dsw(VCS_DATA_PTR(m_elemAbundancesGoal), ipos, jpos);
vcsUtil_dsw(VCS_DATA_PTR(m_elemAbundances), ipos, jpos);
vcsUtil_isw(VCS_DATA_PTR(m_elementMapIndex), ipos, jpos);
vcsUtil_ssw(VCS_DATA_PTR(m_elementMapIndex), ipos, jpos);
vcsUtil_isw(VCS_DATA_PTR(m_elType), ipos, jpos);
vcsUtil_isw(VCS_DATA_PTR(m_elementActive), ipos, jpos);
for (j = 0; j < m_numSpeciesTot; ++j) {

View file

@ -37,13 +37,13 @@ namespace VCSnonideal {
*/
void VCS_SOLVE::vcs_inest(double * const aw, double * const sa, double * const sm,
double * const ss, double test) {
int conv, k, lt, ikl, kspec, iph, irxn;
size_t conv, lt, ikl, kspec, iph, irxn;
double s;
double s1 = 0.0;
double xl, par;
int finished;
int nspecies = m_numSpeciesTot;
int nrxn = m_numRxnTot;
size_t nspecies = m_numSpeciesTot;
size_t nrxn = m_numRxnTot;
vcs_VolPhase *Vphase = 0;
// double *molNum = VCS_DATA_PTR(m_molNumSpecies_old);
@ -241,7 +241,7 @@ namespace VCSnonideal {
m_deltaMolNumSpecies[kspec] = 0.5 * (m_tPhaseMoles_new[iph] + TMolesMultiphase)
* exp(-m_deltaGRxn_new[irxn]);
for (k = 0; k < m_numComponents; ++k) {
for (size_t k = 0; k < m_numComponents; ++k) {
m_deltaMolNumSpecies[k] += m_stoichCoeffRxnMatrix[irxn][k] * m_deltaMolNumSpecies[kspec];
}
@ -322,14 +322,14 @@ namespace VCSnonideal {
finished = TRUE; continue;
}
if (s < 0.0) {
if (ikl <= 0) {
if (ikl == 0) {
finished = TRUE; continue;
}
}
/* ***************************************** */
/* *** TRY HALF STEP SIZE ****************** */
/* ***************************************** */
if (ikl <= 0) {
if (ikl == 0) {
s1 = s;
par *= 0.5;
ikl = 1;

View file

@ -152,7 +152,7 @@ namespace VCSnonideal {
* (each column is a new rhs)
* @param m number of rhs's
*/
int vcsUtil_mlequ(double *c, int idem, int n, double *b, int m);
int vcsUtil_mlequ(double *c, size_t idem, size_t n, double *b, size_t m);
//! Swap values in vector of doubles
/*!
@ -162,7 +162,7 @@ namespace VCSnonideal {
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_dsw(double x[], int i1, int i2);
void vcsUtil_dsw(double x[], size_t i1, size_t i2);
//! Swap values in an integer array
/*!
@ -172,7 +172,8 @@ namespace VCSnonideal {
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_isw(int x[], int i1, int i2);
void vcsUtil_isw(int x[], size_t i1, size_t i2);
void vcsUtil_ssw(size_t x[], size_t i1, size_t i2);
//! Swap values in a std vector string
/*!
@ -183,7 +184,7 @@ namespace VCSnonideal {
* @param i2 second index
*/
void vcsUtil_stsw(std::vector<std::string> & vecStrings,
int i1, int i2);
size_t i1, size_t i2);
//! Definition of the function pointer for the root finder
/*!
@ -305,7 +306,7 @@ namespace VCSnonideal {
} @endverbatim
*
*/
int vcsUtil_root1d(double xmin, double xmax, int itmax, VCS_FUNC_PTR func,
int vcsUtil_root1d(double xmin, double xmax, size_t itmax, VCS_FUNC_PTR func,
void *fptrPassthrough,
double FuncTargVal, int varID, double *xbest,
int printLvl = 0);
@ -328,7 +329,7 @@ namespace VCSnonideal {
* @param vec_to vector of doubles
* @param length length of the vector to zero.
*/
inline void vcs_dzero(double * const vec_to, const int length) {
inline void vcs_dzero(double * const vec_to, const size_t length) {
(void) memset((void *) vec_to, 0, length * sizeof(double));
}
@ -337,7 +338,7 @@ namespace VCSnonideal {
* @param vec_to vector of ints
* @param length length of the vector to zero.
*/
inline void vcs_izero(int * const vec_to, const int length) {
inline void vcs_izero(int * const vec_to, const size_t length) {
(void) memset((void *) vec_to, 0, length * sizeof(int));
}
@ -349,7 +350,7 @@ namespace VCSnonideal {
* @param length Number of doubles to copy.
*/
inline void vcs_dcopy(double * const vec_to,
const double * const vec_from, const int length) {
const double * const vec_from, const size_t length) {
(void) memcpy((void *) vec_to, (const void *) vec_from,
(length) * sizeof(double));
}
@ -363,7 +364,7 @@ namespace VCSnonideal {
* @param length Number of int to copy.
*/
inline void vcs_icopy(int * const vec_to,
const int * const vec_from, const int length) {
const int * const vec_from, const size_t length) {
(void) memcpy((void *) vec_to, (const void *) vec_from,
(length) * sizeof(int));
}
@ -373,7 +374,7 @@ namespace VCSnonideal {
* @param vec_to vector of doubles
* @param length length of the vector to zero.
*/
inline void vcs_vdzero(std::vector<double> &vec_to, const int length) {
inline void vcs_vdzero(std::vector<double> &vec_to, const size_t length) {
(void) memset((void *)VCS_DATA_PTR(vec_to), 0, (length) * sizeof(double));
}
@ -382,7 +383,7 @@ namespace VCSnonideal {
* @param vec_to vector of ints
* @param length length of the vector to zero.
*/
inline void vcs_vizero(std::vector<int> &vec_to, const int length) {
inline void vcs_vizero(std::vector<int> &vec_to, const size_t length) {
(void) memset((void *)VCS_DATA_PTR(vec_to), 0, (length) * sizeof(int));
}
@ -398,7 +399,7 @@ namespace VCSnonideal {
* @param length Number of doubles to copy.
*/
inline void vcs_vdcopy(std::vector<double> & vec_to,
const std::vector<double> & vec_from, int length) {
const std::vector<double> & vec_from, size_t length) {
(void) memcpy((void *)&(vec_to[0]), (const void *) &(vec_from[0]),
(length) * sizeof(double));
}
@ -449,7 +450,7 @@ namespace VCSnonideal {
* @return Return index of the greatest value on X(i) searched
* j <= i < n
*/
int vcs_optMax(const double *x, const double *xSize, int j, int n);
size_t vcs_optMax(const double *x, const double *xSize, size_t j, size_t n);
//! Returns the maximum integer in a list
/*!

View file

@ -35,7 +35,7 @@ namespace VCSnonideal {
#ifdef ALTLINPROG
#else
int linprogmax(double *XMOLES, double *CC, double *AX, double *BB,
int NE, int M, int NE0)
size_t NE, size_t M, size_t NE0)
/*-----------------------------------------------------------------------
* Find XMOLES(I), i = 1, M such that
@ -60,14 +60,14 @@ int linprogmax(double *XMOLES, double *CC, double *AX, double *BB,
int *IND, *IW, *IOPT;
MROWS = 1;
MCON = NE;
NCOLS = M;
MCON = (int) NE;
NCOLS = (int) M;
MDW = MCON + NCOLS;
NX = 0;
NI = 0;
sum = 0.0;
for (i = 0; i < M; i++) {
for (i = 0; i < NCOLS; i++) {
sum += fabs(CC[i]);
}
F[0] = sum * 1000.;

View file

@ -43,12 +43,12 @@ namespace VCSnonideal {
* can be popped, if there is one species in the phase that can be
* popped.
*/
for (int k = 0; k < Vphase->nSpecies(); k++) {
int kspec = Vphase->spGlobalIndexVCS(k);
int irxn = kspec - m_numComponents;
if (irxn >= 0) {
for (size_t k = 0; k < Vphase->nSpecies(); k++) {
size_t kspec = Vphase->spGlobalIndexVCS(k);
if (kspec >= m_numComponents) {
size_t irxn = kspec - m_numComponents;
bool iPopPossible = true;
for (int j = 0; j < m_numComponents; ++j) {
for (size_t j = 0; j < m_numComponents; ++j) {
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
double stoicC = m_stoichCoeffRxnMatrix[irxn][j];
if (stoicC != 0.0) {
@ -78,7 +78,7 @@ namespace VCSnonideal {
int VCS_SOLVE::vcs_popPhaseID() {
int iphasePop = -1;
int iph;
int irxn, kspec;
size_t irxn, kspec;
doublereal FephaseMax = -1.0E30;
doublereal Fephase = -1.0E30;
vcs_VolPhase *Vphase = 0;
@ -211,12 +211,12 @@ namespace VCSnonideal {
* - 3 : Nothing was done because the phase couldn't be birthed
* because a needed component is zero.
*/
int VCS_SOLVE::vcs_popPhaseRxnStepSizes(const int iphasePop) {
int VCS_SOLVE::vcs_popPhaseRxnStepSizes(const size_t iphasePop) {
vcs_VolPhase *Vphase = m_VolPhaseList[iphasePop];
// Identify the first species in the phase
int kspec = Vphase->spGlobalIndexVCS(0);
size_t kspec = Vphase->spGlobalIndexVCS(0);
// Identify the formation reaction for that species
int irxn = kspec - m_numComponents;
size_t irxn = kspec - m_numComponents;
doublereal s;
int j, k;
@ -334,8 +334,8 @@ namespace VCSnonideal {
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
double delmol = deltaMolNumPhase * X_est[k];
irxn = kspec - m_numComponents;
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
for (j = 0; j < m_numComponents; ++j) {
double stoicC = m_stoichCoeffRxnMatrix[irxn][j];
if (stoicC != 0.0) {
@ -361,7 +361,7 @@ namespace VCSnonideal {
}
} else {
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
int jph = m_phaseID[j];
size_t jph = m_phaseID[j];
if ((jph != iphasePop) && (!m_SSPhase[j])) {
double fdeltaJ = fabs(deltaJ);
if ( m_molNumSpecies_old[j] > 0.0) {
@ -414,7 +414,7 @@ namespace VCSnonideal {
/*
* We will use the _new state calc here
*/
int kspec, irxn, k, i, kc, kc_spec;
size_t kspec, irxn, k, i, kc, kc_spec;
vcs_VolPhase *Vphase = m_VolPhaseList[iph];
doublereal deltaGRxn;
@ -446,7 +446,7 @@ namespace VCSnonideal {
bool oneIsComponent = false;
std::vector<int> componentList;
std::vector<size_t> componentList;
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
@ -486,14 +486,14 @@ namespace VCSnonideal {
// Given a set of fracDelta's, we calculate the fracDelta's
// for the component species, if any
for (i = 0; i < (int) componentList.size(); i++) {
for (i = 0; i < componentList.size(); i++) {
kc = componentList[i];
kc_spec = Vphase->spGlobalIndexVCS(kc);
fracDelta_old[kc] = 0.0;
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
fracDelta_old[kc] += m_stoichCoeffRxnMatrix[irxn][kc_spec] * fracDelta_old[k];
}
}
@ -512,7 +512,7 @@ namespace VCSnonideal {
sum_Xcomp += X_est[k];
}
}
/*
* Feed the newly formed estimate of the mole fractions back into the
@ -529,7 +529,7 @@ namespace VCSnonideal {
* first Calculate altered chemical potentials for component species
* belonging to this phase.
*/
for (i = 0; i < (int) componentList.size(); i++) {
for (i = 0; i < componentList.size(); i++) {
kc = componentList[i];
kc_spec = Vphase->spGlobalIndexVCS(kc);
if ( X_est[kc] > VCS_DELETE_MINORSPECIES_CUTOFF) {
@ -541,14 +541,14 @@ namespace VCSnonideal {
}
}
for (i = 0; i < (int) componentList.size(); i++) {
for (i = 0; i < componentList.size(); i++) {
kc = componentList[i];
kc_spec = Vphase->spGlobalIndexVCS(kc);
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
if (i == 0) {
m_deltaGRxn_Deficient[irxn] = m_deltaGRxn_old[irxn];
}
@ -569,8 +569,8 @@ namespace VCSnonideal {
funcPhaseStability = sum_Xcomp - 1.0;
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
deltaGRxn = m_deltaGRxn_Deficient[irxn];
if (deltaGRxn > 50.0) deltaGRxn = 50.0;
if (deltaGRxn < -50.0) deltaGRxn = -50.0;
@ -587,9 +587,9 @@ namespace VCSnonideal {
*/
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
double b = E_phi[k] / sum * (1.0 - sum_Xcomp);
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
fracDelta_raw[k] = b;
}
}
@ -597,14 +597,14 @@ namespace VCSnonideal {
// Given a set of fracDelta's, we calculate the fracDelta's
// for the component species, if any
for (i = 0; i < (int) componentList.size(); i++) {
for (i = 0; i < componentList.size(); i++) {
kc = componentList[i];
kc_spec = Vphase->spGlobalIndexVCS(kc);
fracDelta_raw[kc] = 0.0;
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
fracDelta_raw[kc] += m_stoichCoeffRxnMatrix[irxn][kc_spec] * fracDelta_raw[k];
}
}

View file

@ -24,12 +24,12 @@ namespace VCSnonideal {
// Calculate the status of single species phases.
void VCS_SOLVE::vcs_SSPhase() {
int kspec, iph;
size_t iph;
vcs_VolPhase *Vphase;
std::vector<int> numPhSpecies(m_numPhases, 0);
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
numPhSpecies[m_phaseID[kspec]]++;
}
/*
@ -56,7 +56,7 @@ namespace VCSnonideal {
* SSPhase = Boolean indicating whether a species is in a
* single species phase or not.
*/
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
iph = m_phaseID[kspec];
Vphase = m_VolPhaseList[iph];
if (Vphase->m_singleSpecies) m_SSPhase[kspec] = TRUE;
@ -99,7 +99,8 @@ namespace VCSnonideal {
*
*/
int VCS_SOLVE::vcs_prep_oneTime(int printLvl) {
int kspec, i, conv, retn = VCS_SUCCESS;
size_t kspec, i, conv;
int retn = VCS_SUCCESS;
double pres, test;
double *aw, *sa, *sm, *ss;
bool modifiedSoln = false;
@ -125,8 +126,8 @@ namespace VCSnonideal {
}
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
int pID = m_phaseID[kspec];
int spPhIndex = m_speciesLocalPhaseIndex[kspec];
size_t pID = m_phaseID[kspec];
size_t spPhIndex = m_speciesLocalPhaseIndex[kspec];
vcs_VolPhase *vPhase = m_VolPhaseList[pID];
vcs_SpeciesProperties *spProp = vPhase->speciesProperty(spPhIndex);
double sz = 0.0;

View file

@ -109,11 +109,11 @@ namespace VCSnonideal {
* We need to manually free all of the arrays.
*/
VCS_PROB::~VCS_PROB() {
for (int i = 0; i < nspecies; i++) {
for (size_t i = 0; i < nspecies; i++) {
delete SpeciesThermo[i];
SpeciesThermo[i] = 0;
}
for (int iph = 0; iph < NPhase; iph++) {
for (size_t iph = 0; iph < NPhase; iph++) {
delete VPhaseList[iph];
VPhaseList[iph] = 0;
}
@ -128,7 +128,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nPhase
* even if nPhase is less than the current value of NPHASE0
*/
void VCS_PROB::resizePhase(int nPhase, int force) {
void VCS_PROB::resizePhase(size_t nPhase, int force) {
if (force || nPhase > NPHASE0) {
NPHASE0 = nPhase;
}
@ -143,7 +143,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nsp
* even if nsp is less than the current value of NSPECIES0
*/
void VCS_PROB::resizeSpecies(int nsp, int force) {
void VCS_PROB::resizeSpecies(size_t nsp, int force) {
if (force || nsp > NSPECIES0) {
m_gibbsSpecies.resize(nsp, 0.0);
w.resize(nsp, 0.0);
@ -174,7 +174,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nel
* even if nel is less than the current value of NEL0
*/
void VCS_PROB::resizeElements(int nel, int force) {
void VCS_PROB::resizeElements(size_t nel, int force) {
if (force || nel > NE0) {
gai.resize(nel, 0.0);
FormulaMatrix.resize(nel, NSPECIES0, 0.0);
@ -317,8 +317,8 @@ namespace VCSnonideal {
for (iphase = 0; iphase < NPhase; iphase++) {
Vphase = VPhaseList[iphase];
Vphase->setState_TP(T, PresPA);
for (int kindex = 0; kindex < Vphase->nSpecies(); kindex++) {
int kglob = Vphase->spGlobalIndexVCS(kindex);
for (size_t kindex = 0; kindex < Vphase->nSpecies(); kindex++) {
size_t kglob = Vphase->spGlobalIndexVCS(kindex);
plogf("%16s ", SpName[kglob].c_str());
if (kindex == 0) {
plogf("%16s", Vphase->PhaseName.c_str());
@ -355,8 +355,8 @@ namespace VCSnonideal {
* addition to the global element list
*/
void VCS_PROB::addPhaseElements(vcs_VolPhase *volPhase) {
int e, eVP;
int foundPos = -1;
size_t e, eVP;
size_t foundPos = -1;
size_t neVP = volPhase->nElemConstraints();
std::string en;
std::string enVP;
@ -402,12 +402,12 @@ namespace VCSnonideal {
*
* @return returns the index number of the new element
*/
int VCS_PROB::addElement(const char *elNameNew, int elType, int elactive) {
size_t VCS_PROB::addElement(const char *elNameNew, int elType, int elactive) {
if (!elNameNew) {
plogf("error: element must have a name\n");
exit(EXIT_FAILURE);
}
int nel = ne + 1;
size_t nel = ne + 1;
resizeElements(nel, 1);
ne = nel;
ElName[ne-1] = elNameNew;
@ -429,7 +429,7 @@ namespace VCSnonideal {
* @param kT global Species number within this object
*
*/
int VCS_PROB::addOnePhaseSpecies(vcs_VolPhase *volPhase, int k, int kT) {
size_t VCS_PROB::addOnePhaseSpecies(vcs_VolPhase *volPhase, size_t k, size_t kT) {
size_t e, eVP;
if (kT > nspecies) {
/*
@ -457,12 +457,11 @@ namespace VCSnonideal {
}
void VCS_PROB::reportCSV(const std::string &reportFile) {
int k;
int istart;
size_t k;
size_t istart;
double vol = 0.0;
string sName;
int nphase = NPhase;
FILE * FP = fopen(reportFile.c_str(), "w");
if (!FP) {
@ -480,12 +479,12 @@ namespace VCSnonideal {
vol = 0.0;
int iK = 0;
for (int iphase = 0; iphase < nphase; iphase++) {
size_t iK = 0;
for (size_t iphase = 0; iphase < NPhase; iphase++) {
istart = iK;
vcs_VolPhase *volP = VPhaseList[iphase];
//const Cantera::ThermoPhase *tptr = volP->ptrThermoPhase();
int nSpeciesPhase = volP->nSpecies();
size_t nSpeciesPhase = volP->nSpecies();
volPM.resize(nSpeciesPhase, 0.0);
volP->sendToVCS_VolPM(VCS_DATA_PTR(volPM));
@ -508,13 +507,13 @@ namespace VCSnonideal {
fprintf(FP,"Number VCS iterations = %d\n", m_Iterations);
iK = 0;
for (int iphase = 0; iphase < nphase; iphase++) {
istart = iK;
for (size_t iphase = 0; iphase < NPhase; iphase++) {
istart = iK;
vcs_VolPhase *volP = VPhaseList[iphase];
const Cantera::ThermoPhase *tp = volP->ptrThermoPhase();
string phaseName = volP->PhaseName;
int nSpeciesPhase = volP->nSpecies();
size_t nSpeciesPhase = volP->nSpecies();
volP->sendToVCS_VolPM(VCS_DATA_PTR(volPM));
double TMolesPhase = volP->totalMoles();
//AssertTrace(TMolesPhase == m_mix->phaseMoles(iphase));

View file

@ -264,7 +264,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nPhase
* even if nPhase is less than the current value of NPHASE0
*/
void resizePhase(int nPhase, int force);
void resizePhase(size_t nPhase, int force);
//! Resizes all of the species lists within the structure
/*!
@ -275,7 +275,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nsp
* even if nsp is less than the current value of NSPECIES0
*/
void resizeSpecies(int nsp, int force);
void resizeSpecies(size_t nsp, int force);
//! Resizes all of the element lists within the structure
/*!
@ -286,7 +286,7 @@ namespace VCSnonideal {
* @param force If true, this will dimension the size to be equal to nel
* even if nel is less than the current value of NEL0
*/
void resizeElements(int nel, int force);
void resizeElements(size_t nel, int force);
//! Calculate the element abundance vector
@ -338,7 +338,7 @@ namespace VCSnonideal {
*
* @return returns the index number of the new element
*/
int addElement(const char *elNameNew, int elType, int elactive);
size_t addElement(const char *elNameNew, int elType, int elactive);
//! This routines adds entries for the formula matrix for one species
@ -354,7 +354,7 @@ namespace VCSnonideal {
* @param kT global Species number within this object
*
*/
int addOnePhaseSpecies(vcs_VolPhase *volPhase, int k, int kT);
size_t addOnePhaseSpecies(vcs_VolPhase *volPhase, size_t k, size_t kT);
void reportCSV(const std::string &reportFile);

View file

@ -24,8 +24,8 @@ namespace VCSnonideal {
* This destroys the data based on reaction ordering.
*/
int VCS_SOLVE::vcs_rearrange() {
int i, l, j;
int k1 = 0;
size_t i, l, j;
size_t k1 = 0;
/* - Loop over all of the species */
for (i = 0; i < m_numSpeciesTot; ++i) {

View file

@ -24,8 +24,8 @@ namespace VCSnonideal {
}
}
static void print_line(std::string schar, int num) {
for (int j = 0; j < num; j++) plogf("%s", schar.c_str());
static void print_line(std::string schar, size_t num) {
for (size_t j = 0; j < num; j++) plogf("%s", schar.c_str());
plogf("\n");
}
@ -42,14 +42,14 @@ namespace VCSnonideal {
***************************************************************************/
int VCS_SOLVE::vcs_report(int iconv) {
bool printActualMoles = true;
int i, j, l, k, inertYes = FALSE, kspec;
int nspecies = m_numSpeciesTot;
size_t i, j, l, k, inertYes = FALSE, kspec;
size_t nspecies = m_numSpeciesTot;
double g;
char originalUnitsState = m_unitsState;
std::vector<int> sortindex(nspecies,0);
std::vector<size_t> sortindex(nspecies,0);
std::vector<double> xy(nspecies,0.0);
/* ************************************************************** */
@ -69,7 +69,7 @@ namespace VCSnonideal {
k = vcs_optMax(VCS_DATA_PTR(xy), 0, l, m_numSpeciesRdc);
if (k != l) {
vcsUtil_dsw(VCS_DATA_PTR(xy), k, l);
vcsUtil_isw(VCS_DATA_PTR(sortindex), k, l);
vcsUtil_ssw(VCS_DATA_PTR(sortindex), k, l);
}
}
@ -208,8 +208,8 @@ namespace VCSnonideal {
}
plogf(" | DG/RT Rxn |\n");
print_line("-", m_numComponents*10 + 45);
for (int irxn = 0; irxn < m_numRxnTot; irxn++) {
int kspec = m_indexRxnToSpecies[irxn];
for (size_t irxn = 0; irxn < m_numRxnTot; irxn++) {
size_t kspec = m_indexRxnToSpecies[irxn];
plogf(" %3d ", kspec);
plogf("%-10.10s", m_speciesName[kspec].c_str());
plogf("|%10.3g |", m_molNumSpecies_old[kspec]*molScale);
@ -323,7 +323,7 @@ namespace VCSnonideal {
print_line("-", 147);
for (i = 0; i < nspecies; ++i) {
l = sortindex[i];
int pid = m_phaseID[l];
size_t pid = m_phaseID[l];
plogf(" %-12.12s", m_speciesName[l].c_str());
plogf(" %14.7E ", m_molNumSpecies_old[l]*molScale);
plogf("%14.7E ", m_SSfeSpecies[l]);

View file

@ -116,7 +116,7 @@ static void print_funcEval(FILE *fp, double xval, double fval, int its)
* @endverbatim
*
*/
int vcsUtil_root1d(double xmin, double xmax, int itmax,
int vcsUtil_root1d(double xmin, double xmax, size_t itmax,
VCS_FUNC_PTR func, void *fptrPassthrough,
double FuncTargVal, int varID,
double *xbest, int printLvl) {

View file

@ -40,10 +40,10 @@ namespace VCSnonideal {
* in this routine. The species is a noncomponent
* - 2 : Same as one but, the zeroed species is a component.
*/
int VCS_SOLVE::vcs_RxnStepSizes() {
int j, irxn, kspec, soldel = 0, iph;
size_t VCS_SOLVE::vcs_RxnStepSizes() {
size_t j, irxn, kspec, soldel = 0, iph;
double s, xx, dss;
int k = 0;
size_t k = 0;
vcs_VolPhase *Vphase = 0;
double *dnPhase_irxn;
#ifdef DEBUG_MODE
@ -126,7 +126,7 @@ namespace VCSnonideal {
m_deltaGRxn_new[irxn]);
#endif
Vphase = m_VolPhaseList[iph];
int numSpPhase = Vphase->nSpecies();
size_t numSpPhase = Vphase->nSpecies();
m_deltaMolNumSpecies[kspec] =
m_totalMolNum * 10.0 * VCS_DELETE_PHASE_CUTOFF / numSpPhase;
}
@ -393,9 +393,9 @@ namespace VCSnonideal {
* NOTE: currently this routine is not used.
*/
int VCS_SOLVE::vcs_rxn_adj_cg() {
int irxn, j;
int k = 0;
int kspec, soldel = 0;
size_t irxn, j;
size_t k = 0;
size_t kspec, soldel = 0;
double s, xx, dss;
double *dnPhase_irxn;
#ifdef DEBUG_MODE
@ -596,7 +596,7 @@ namespace VCSnonideal {
*
* NOTE: currently this routine is not used
*/
double VCS_SOLVE::vcs_Hessian_diag_adj(int irxn, double hessianDiag_Ideal) {
double VCS_SOLVE::vcs_Hessian_diag_adj(size_t irxn, double hessianDiag_Ideal) {
double diag = hessianDiag_Ideal;
double hessActCoef = vcs_Hessian_actCoeff_diag(irxn);
if (hessianDiag_Ideal <= 0.0) {
@ -621,8 +621,8 @@ namespace VCSnonideal {
*
* NOTE: currently this routine is not used
*/
double VCS_SOLVE::vcs_Hessian_actCoeff_diag(int irxn) {
int kspec, k, l, kph;
double VCS_SOLVE::vcs_Hessian_actCoeff_diag(size_t irxn) {
size_t kspec, k, l, kph;
double s;
double *sc_irxn;
kspec = m_indexRxnToSpecies[irxn];
@ -719,18 +719,18 @@ namespace VCSnonideal {
* an unknown state.
*/
double VCS_SOLVE::deltaG_Recalc_Rxn(const int stateCalc,
const int irxn, const double *const molNum,
const size_t irxn, const double *const molNum,
double * const ac, double * const mu_i) {
int kspec = irxn + m_numComponents;
size_t kspec = irxn + m_numComponents;
int *pp_ptr = m_phaseParticipation[irxn];
for (int iphase = 0; iphase < m_numPhases; iphase++) {
for (size_t iphase = 0; iphase < m_numPhases; iphase++) {
if (pp_ptr[iphase]) {
vcs_chemPotPhase(stateCalc, iphase, molNum, ac, mu_i);
}
}
double deltaG = mu_i[kspec];
double *sc_irxn = m_stoichCoeffRxnMatrix[irxn];
for (int k = 0; k < m_numComponents; k++) {
for (size_t k = 0; k < m_numComponents; k++) {
deltaG += sc_irxn[k] * mu_i[k];
}
return deltaG;
@ -751,15 +751,15 @@ namespace VCSnonideal {
*
* @return Returns the optimized step length found by the search
*/
double VCS_SOLVE::vcs_line_search(const int irxn, const double dx_orig,
double VCS_SOLVE::vcs_line_search(const size_t irxn, const double dx_orig,
char * const ANOTE)
#else
double VCS_SOLVE::vcs_line_search(const int irxn, const double dx_orig)
double VCS_SOLVE::vcs_line_search(const size_t irxn, const double dx_orig)
#endif
{
int its = 0;
int k;
int kspec = m_indexRxnToSpecies[irxn];
size_t k;
size_t kspec = m_indexRxnToSpecies[irxn];
const int MAXITS = 10;
double dx = dx_orig;
double *sc_irxn = m_stoichCoeffRxnMatrix[irxn];

View file

@ -75,8 +75,8 @@ namespace VCSnonideal {
* @param nphase0 Number of phases defined within the problem.
*
*/
void VCS_SOLVE::vcs_initSizes(const int nspecies0, const int nelements,
const int nphase0) {
void VCS_SOLVE::vcs_initSizes(const size_t nspecies0, const size_t nelements,
const size_t nphase0) {
if (NSPECIES0 != 0) {
if ((nspecies0 != NSPECIES0) || (nelements != m_numElemConstraints) || (nphase0 != NPHASE0)){
@ -253,8 +253,8 @@ namespace VCSnonideal {
* This gets called by the destructor or by InitSizes().
*/
void VCS_SOLVE::vcs_delete_memory() {
int j;
int nspecies = m_numSpeciesTot;
size_t j;
size_t nspecies = m_numSpeciesTot;
for (j = 0; j < m_numPhases; j++) {
delete m_VolPhaseList[j];
@ -313,8 +313,8 @@ namespace VCSnonideal {
* zero : success
*/
int VCS_SOLVE::vcs(VCS_PROB *vprob, int ifunc, int ipr, int ip1, int maxit) {
int retn = 0;
int iconv = 0, nspecies0, nelements0, nphase0;
int retn = 0, iconv = 0;
size_t nspecies0, nelements0, nphase0;
Cantera::clockWC tickTock;
int iprintTime = MAX(ipr, ip1);
@ -456,7 +456,7 @@ namespace VCSnonideal {
*/
int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB *pub) {
int i, j, kspec;
int iph;
size_t iph;
vcs_VolPhase *Vphase = 0;
const char *ser =
"vcs_pub_to_priv ERROR :ill defined interface -> bailout:\n\t";
@ -465,17 +465,17 @@ namespace VCSnonideal {
* First Check to see whether we have room for the current problem
* size
*/
int nspecies = pub->nspecies;
size_t nspecies = pub->nspecies;
if (NSPECIES0 < nspecies) {
plogf("%sPrivate Data is dimensioned too small\n", ser);
return VCS_PUB_BAD;
}
int nph = pub->NPhase;
size_t nph = pub->NPhase;
if (NPHASE0 < nph) {
plogf("%sPrivate Data is dimensioned too small\n", ser);
return VCS_PUB_BAD;
}
int nelements = pub->ne;
size_t nelements = pub->ne;
if (m_numElemConstraints < nelements) {
plogf("%sPrivate Data is dimensioned too small\n", ser);
return VCS_PUB_BAD;
@ -652,7 +652,7 @@ namespace VCSnonideal {
* -> Check for bad values at the same time.
*/
if (pub->PhaseID.size() != 0) {
std::vector<int> numPhSp(nph, 0);
std::vector<size_t> numPhSp(nph, 0);
for (kspec = 0; kspec < nspecies; kspec++) {
iph = pub->PhaseID[kspec];
if (iph < 0 || iph >= nph) {
@ -743,9 +743,9 @@ namespace VCSnonideal {
* data space.
*/
Vphase = m_VolPhaseList[iph];
for (int k = 0; k < Vphase->nSpecies(); k++) {
for (size_t k = 0; k < Vphase->nSpecies(); k++) {
vcs_SpeciesProperties *sProp = Vphase->speciesProperty(k);
int kT = Vphase->spGlobalIndexVCS(k);
size_t kT = Vphase->spGlobalIndexVCS(k);
sProp->SpeciesThermo = m_speciesThermoList[kT];
}
}
@ -766,10 +766,10 @@ namespace VCSnonideal {
* So SpecLnMnaught[iSolvent] = 0.0, and the
* loop below starts at 1, not 0.
*/
int iSolvent = Vphase->spGlobalIndexVCS(0);
size_t iSolvent = Vphase->spGlobalIndexVCS(0);
double mnaught = m_wtSpecies[iSolvent] / 1000.;
for (int k = 1; k < Vphase->nSpecies(); k++) {
int kspec = Vphase->spGlobalIndexVCS(k);
for (size_t k = 1; k < Vphase->nSpecies(); k++) {
size_t kspec = Vphase->spGlobalIndexVCS(k);
m_actConventionSpecies[kspec] = Vphase->p_activityConvention;
m_lnMnaughtSpecies[kspec] = log(mnaught);
}
@ -811,7 +811,7 @@ namespace VCSnonideal {
* initialize the current equilibrium problem
*/
int VCS_SOLVE::vcs_prob_specify(const VCS_PROB *pub) {
int kspec, k, i, j, iph;
size_t kspec, k, i, j, iph;
string yo("vcs_prob_specify ERROR: ");
int retn = VCS_SUCCESS;
bool status_change = false;
@ -941,22 +941,20 @@ namespace VCSnonideal {
* equilibrium calculation transfered to it.
*/
int VCS_SOLVE::vcs_prob_update(VCS_PROB *pub) {
int i, j, l;
int k1 = 0;
size_t k1 = 0;
vcs_tmoles();
m_totalVol = vcs_VolTotal(m_temperature, m_pressurePA,
VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_PMVolumeSpecies));
for (i = 0; i < m_numSpeciesTot; ++i) {
for (size_t i = 0; i < m_numSpeciesTot; ++i) {
/*
* Find the index of I in the index vector, m_speciesIndexVector[].
* Call it K1 and continue.
*/
for (j = 0; j < m_numSpeciesTot; ++j) {
l = m_speciesMapIndex[j];
for (size_t j = 0; j < m_numSpeciesTot; ++j) {
k1 = j;
if (l == i) break;
if (m_speciesMapIndex[j] == i) break;
}
/*
* - Switch the species data back from K1 into I
@ -975,7 +973,7 @@ namespace VCSnonideal {
pub->T = m_temperature;
pub->PresPA = m_pressurePA;
pub->Vol = m_totalVol;
int kT = 0;
size_t kT = 0;
for (int iph = 0; iph < pub->NPhase; iph++) {
vcs_VolPhase *pubPhase = pub->VPhaseList[iph];
vcs_VolPhase *vPhase = m_VolPhaseList[iph];
@ -987,7 +985,7 @@ namespace VCSnonideal {
VCS_DATA_PTR(vPhase->moleFractions()),
VCS_STATECALC_TMP);
const std::vector<double> & mfVector = pubPhase->moleFractions();
for (int k = 0; k < pubPhase->nSpecies(); k++) {
for (size_t k = 0; k < pubPhase->nSpecies(); k++) {
kT = pubPhase->spGlobalIndexVCS(k);
pub->mf[kT] = mfVector[k];
if (pubPhase->phiVarIndex() == k) {

View file

@ -74,7 +74,7 @@ public:
* @param nphase0 Number of phases defined within the problem.
*
*/
void vcs_initSizes(const int nspecies0, const int nelements, const int nphase0);
void vcs_initSizes(const size_t nspecies0, const size_t nelements, const size_t nphase0);
//! Solve an equilibrium problem
/*!
@ -143,7 +143,7 @@ public:
*/
int vcs_solve_TP(int print_lvl, int printDetails, int maxit);
void vcs_reinsert_deleted(int kspec);
void vcs_reinsert_deleted(size_t kspec);
//! Choose the optimum species basis for the calculations
/*!
@ -216,7 +216,7 @@ public:
* there is a problem.
*/
int vcs_basopt(const int doJustComponents, double aw[], double sa[], double sm[],
double ss[], double test, int * const usedZeroedSpecies);
double ss[], double test, size_t* const usedZeroedSpecies);
//! Choose a species to test for the next component
/*!
@ -229,7 +229,7 @@ public:
* molNum[].
* @param n Length of molNum[]
*/
int vcs_basisOptMax(const double *const molNum, const int j, const int n);
size_t vcs_basisOptMax(const double *const molNum, const size_t j, const size_t n);
//! Evaluate the species category for the indicated species
/*!
@ -239,7 +239,7 @@ public:
*
* @return Returns the calculated species type
*/
int vcs_species_type(const int kspec) const;
int vcs_species_type(const size_t kspec) const;
bool vcs_evaluate_speciesType();
@ -340,7 +340,7 @@ public:
* (VCS species order)
*
*/
void vcs_chemPotPhase(const int stateCalc, const int iph, const double *const molNum,
void vcs_chemPotPhase(const int stateCalc, const size_t iph, const double *const molNum,
double * const ac, double * const mu_i,
const bool do_deleted = false);
@ -486,7 +486,7 @@ public:
* the same T and P as the solution.
* tg : Total Number of moles in the phase.
*/
void vcs_dfe(const int stateCalc, const int ll, const int lbot, const int ltop);
void vcs_dfe(const int stateCalc, const int ll, const size_t lbot, const size_t ltop);
//! This routine uploads the state of the system into all of the
//! vcs_VolumePhase objects in the current problem.
@ -527,7 +527,7 @@ public:
* in this routine. The species is a noncomponent
* - 2 : Same as one but, the zeroed species is a component.
*/
int vcs_popPhaseRxnStepSizes(const int iphasePop);
int vcs_popPhaseRxnStepSizes(const size_t iphasePop);
//! Calculates formation reaction step sizes.
/*!
@ -549,7 +549,7 @@ public:
* in this routine. The species is a noncomponent
* - 2 : Same as one but, the zeroed species is a component.
*/
int vcs_RxnStepSizes();
size_t vcs_RxnStepSizes();
//! Calculates the total number of moles of species in all phases.
/*!
@ -615,7 +615,7 @@ public:
* NOTE: this is currently not used used anywhere.
* It may be in the future?
*/
void vcs_deltag_Phase(const int iphase, const bool doDeleted,
void vcs_deltag_Phase(const size_t iphase, const bool doDeleted,
const int stateCalc, const bool alterZeroedPhases = true);
//! Swaps the indecises for all of the global data for two species, k1
@ -633,7 +633,7 @@ public:
*
* @param k2 Second species index
*/
void vcs_switch_pos(const int ifunc, const int k1, const int k2);
void vcs_switch_pos(const int ifunc, const size_t k1, const size_t k2);
//! Birth guess returns the number of moles of a species
@ -853,7 +853,7 @@ public:
* @param ipos first global element index
* @param jpos second global element index
*/
void vcs_switch_elem_pos(int ipos, int jpos);
void vcs_switch_elem_pos(size_t ipos, size_t jpos);
//! Calculates reaction adjustments using a full Hessian approximation
/*!
@ -893,7 +893,7 @@ public:
*
* NOTE: currently this routine is not used
*/
double vcs_Hessian_diag_adj(int irxn, double hessianDiag_Ideal);
double vcs_Hessian_diag_adj(size_t irxn, double hessianDiag_Ideal);
//! Calculates the diagonal contribution to the Hessian due to
//! the dependence of the activity coefficients on the mole numbers.
@ -902,7 +902,7 @@ public:
*
* NOTE: currently this routine is not used
*/
double vcs_Hessian_actCoeff_diag(int irxn);
double vcs_Hessian_actCoeff_diag(size_t irxn);
void vcs_CalcLnActCoeffJac(const double * const moleSpeciesVCS);
@ -919,10 +919,10 @@ public:
* line search
*
*/
double vcs_line_search(const int irxn, const double dx_orig,
double vcs_line_search(const size_t irxn, const double dx_orig,
char * const ANOTE);
#else
double vcs_line_search(const int irxn, const double dx_orig);
double vcs_line_search(const size_t irxn, const double dx_orig);
#endif
@ -1101,7 +1101,7 @@ private:
* 1: succeeded
* 0: failed.
*/
int vcs_zero_species(const int kspec);
int vcs_zero_species(const size_t kspec);
//! Change a single species from active to inactive status
/*!
@ -1117,7 +1117,7 @@ private:
* noncomponent species is equal to zero. A recheck of deleted species
* is carried out in the main code.
*/
int vcs_delete_species(const int kspec);
int vcs_delete_species(const size_t kspec);
//! This routine handles the bookkeepking involved with the
//! deletion of multiphase phases from the problem.
@ -1135,7 +1135,7 @@ private:
*
* @return Returns whether the operation was successful or not
*/
bool vcs_delete_multiphase(const int iph);
bool vcs_delete_multiphase(const size_t iph);
//! Change the concentration of a species by delta moles.
/*!
@ -1149,7 +1149,7 @@ private:
* 1: succeeded without change of dx
* 0: Had to adjust dx, perhaps to zero, in order to do the delta.
*/
int delta_species(const int kspec, double * const delta_ptr);
int delta_species(const size_t kspec, double * const delta_ptr);
//! Provide an estimate for the deleted species in phases that
//! are not zeroed out
@ -1161,7 +1161,7 @@ private:
* This routine is called at the end of the calculation, just before
* returning to the user.
*/
int vcs_add_all_deleted();
size_t vcs_add_all_deleted();
//! Recheck deleted species in multispecies phases.
/*!
@ -1267,7 +1267,7 @@ private:
*
* @param dx The change in mole number
*/
double vcs_minor_alt_calc(int kspec, int irxn, int *do_delete
double vcs_minor_alt_calc(size_t kspec, size_t irxn, int *do_delete
#ifdef DEBUG_MODE
, char *ANOTE
#endif
@ -1294,7 +1294,7 @@ private:
* where the slope is equal to zero.
*
*/
int vcs_globStepDamp();
bool vcs_globStepDamp();
//! Switch rows and columns of a sqare matrix
/*!
@ -1309,7 +1309,7 @@ private:
* @param k2 second row/column value to be switched
*/
void vcs_switch2D(double * const * const Jac,
const int k1, const int k2) const;
const size_t k1, const size_t k2) const;
//! Calculate the norm of a deltaGibbs free energy vector
/*!
@ -1374,7 +1374,7 @@ private:
* @return Returns the dimensionless deltaG of the reaction
*/
double deltaG_Recalc_Rxn(const int stateCalc,
const int irxn, const double *const molNum,
const size_t irxn, const double *const molNum,
double * const ac, double * const mu_i);
//! Delete memory that isn't just resizeable STL containers
@ -1403,7 +1403,7 @@ private:
void vcs_setFlagsVolPhases(const bool upToDate, const int stateCalc);
void vcs_setFlagsVolPhase(const int iph, const bool upToDate, const int stateCalc);
void vcs_setFlagsVolPhase(const size_t iph, const bool upToDate, const int stateCalc);
//! Update all underlying vcs_VolPhase objects
/*!
@ -1418,46 +1418,46 @@ private:
public:
//! value of the number of species used to malloc data structures
int NSPECIES0;
size_t NSPECIES0;
//! value of the number of phases used to malloc data structures
int NPHASE0;
size_t NPHASE0;
//! Total number of species in the problems
int m_numSpeciesTot;
size_t m_numSpeciesTot;
//! Number of element constraints in the problem
/*!
* This is typically equal to the number of elements in the problem
*/
int m_numElemConstraints;
size_t m_numElemConstraints;
//! Number of components calculated for the problem
int m_numComponents;
size_t m_numComponents;
//! Total number of non-component species in the problem
int m_numRxnTot;
size_t m_numRxnTot;
//! Current number of species in the problems
/*!
* Species can be deleted if they aren't
* stable under the current conditions
*/
int m_numSpeciesRdc;
size_t m_numSpeciesRdc;
//! Current number of non-component species in the problem
/*!
* Species can be deleted if they aren't
* stable under the current conditions
*/
int m_numRxnRdc;
size_t m_numRxnRdc;
//! Number of active species which are currently either treated as
//! minor species
int m_numRxnMinorZeroed;
size_t m_numRxnMinorZeroed;
//! Number of Phases in the problem
int m_numPhases;
size_t m_numPhases;
//! Formula matrix for the problem
/*!
@ -1716,7 +1716,7 @@ public:
* kspec = current order in the vcs_solve object
* k = original order in the vcs_prob object and in the MultiPhase object
*/
std::vector<int> m_speciesMapIndex;
std::vector<size_t> m_speciesMapIndex;
//! Index that keeps track of the index of the species within the local
//! phase
@ -1730,7 +1730,7 @@ public:
*
* Length = number of species
*/
std::vector<int> m_speciesLocalPhaseIndex;
std::vector<size_t> m_speciesLocalPhaseIndex;
//! Index vector that keeps track of the rearrangement of the elements
/*!
@ -1744,7 +1744,7 @@ public:
* eNum = current order in the vcs_solve object
* e = original order in the vcs_prob object and in the MultiPhase object
*/
std::vector<int> m_elementMapIndex;
std::vector<size_t> m_elementMapIndex;
//! Mapping between the species index for noncomponent species and the
//! full species index.
@ -1760,7 +1760,7 @@ public:
* noncomponent species in the mechanism.
* kspec = ir[irxn]
*/
std::vector<int> m_indexRxnToSpecies;
std::vector<size_t> m_indexRxnToSpecies;
//! Major -Minor status vector for the species in the problem
/*!
@ -1822,7 +1822,7 @@ public:
std::vector<int> m_speciesStatus;
//! Mapping from the species number to the phase number
std::vector<int> m_phaseID;
std::vector<size_t> m_phaseID;
//! Boolean indicating whether a species belongs to a single-species phase
std::vector<int> m_SSPhase;
@ -2039,7 +2039,7 @@ public:
#ifdef ALTLINPROG
#else
int linprogmax(double *, double *, double *, double *, int, int, int);
int linprogmax(double *, double *, double *, double *, size_t, size_t, size_t);
#endif
}

View file

@ -29,7 +29,7 @@ namespace VCSnonideal {
/************ Prototypes for static functions ******************************/
static void print_space(int num);
static void print_space(size_t num);
@ -92,24 +92,24 @@ namespace VCSnonideal {
* found.
*/
int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit) {
int conv = FALSE, retn = VCS_SUCCESS;
int conv = FALSE, retn = VCS_SUCCESS, solveFail, soldel;
double test, RT;
int j, k, l, solveFail, l1, kspec, irxn;
bool allMinorZeroedSpecies = false;
int forced, iph;
size_t j, k, l, l1, kspec, irxn, i;
bool allMinorZeroedSpecies = false, forced;
size_t iph;
double dx, xx, par;
int dofast, soldel, ll = 0, it1 = 0;
int lec, npb, iti, i, lnospec;
size_t dofast, ll = 0, it1 = 0;
int lec, npb, iti, lnospec;
int rangeErrorFound = 0;
bool giveUpOnElemAbund = false;
int finalElemAbundAttempts = 0;
bool MajorSpeciesHaveConverged = false;
int uptodate_minors = TRUE;
bool justDeletedMultiPhase = FALSE;
int usedZeroedSpecies; /* return flag from basopt indicating that
bool uptodate_minors = true;
bool justDeletedMultiPhase = false;
size_t usedZeroedSpecies; /* return flag from basopt indicating that
one of the components had a zero concentration */
int doPhaseDeleteIph = -1;
int doPhaseDeleteKspec = -1;
size_t doPhaseDeleteIph = -1;
size_t doPhaseDeleteKspec = -1;
vcs_VolPhase *Vphase;
double *sc_irxn = NULL; /* Stoichiometric coefficients for cur rxn */
double *dnPhase_irxn;
@ -339,14 +339,14 @@ namespace VCSnonideal {
* potentials and delta G for their formation reactions
* We have already evaluated the major non-components
*/
if (uptodate_minors == FALSE) {
if (!uptodate_minors) {
vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD);
vcs_dfe(VCS_STATECALC_OLD, 1, 0, m_numSpeciesRdc);
vcs_deltag(1, false, VCS_STATECALC_OLD);
}
uptodate_minors = TRUE;
uptodate_minors = true;
} else {
uptodate_minors = FALSE;
uptodate_minors = false;
}
if (printDetails) {
@ -1304,7 +1304,7 @@ namespace VCSnonideal {
vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD);
vcs_dfe(VCS_STATECALC_OLD, 0, 0, m_numSpeciesRdc);
vcs_deltag(0, true, VCS_STATECALC_OLD);
uptodate_minors = TRUE;
uptodate_minors = true;
}
#ifdef DEBUG_MODE
else {
@ -1340,7 +1340,7 @@ namespace VCSnonideal {
for (i = 0; i < m_numRxnRdc; ++i) {
l = m_indexRxnToSpecies[i];
if (m_speciesUnknownType[l] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
for (j = m_numComponents - 1; j >= 0; j--) {
for (j = m_numComponents - 1; j != -1; j--) {
bool doSwap = false;
if (m_SSPhase[j]) {
doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) >
@ -1624,7 +1624,7 @@ namespace VCSnonideal {
vcs_setFlagsVolPhases(false, VCS_STATECALC_OLD);
vcs_dfe(VCS_STATECALC_OLD, 1, 0, m_numSpeciesRdc);
vcs_deltag(1, false, VCS_STATECALC_OLD);
uptodate_minors = TRUE;
uptodate_minors = true;
}
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
@ -1981,7 +1981,7 @@ namespace VCSnonideal {
*
* @param dx The change in mole number
*/
double VCS_SOLVE::vcs_minor_alt_calc(int kspec, int irxn, int *do_delete
double VCS_SOLVE::vcs_minor_alt_calc(size_t kspec, size_t irxn, int *do_delete
#ifdef DEBUG_MODE
, char *ANOTE
#endif
@ -1991,7 +1991,7 @@ namespace VCSnonideal {
double molNum_kspec_new;
double wTrial;
double dg_irxn = m_deltaGRxn_old[irxn];
int iph = m_phaseID[kspec];
size_t iph = m_phaseID[kspec];
*do_delete = FALSE;
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
if (w_kspec <= 0.0) {
@ -2081,8 +2081,8 @@ namespace VCSnonideal {
* 1: succeeded without change of dx
* 0: Had to adjust dx, perhaps to zero, in order to do the delta.
*/
int VCS_SOLVE::delta_species(const int kspec, double * const delta_ptr) {
int irxn = kspec - m_numComponents;
int VCS_SOLVE::delta_species(const size_t kspec, double * const delta_ptr) {
size_t irxn = kspec - m_numComponents;
int retn = 1;
int j;
double tmp;
@ -2125,7 +2125,7 @@ namespace VCSnonideal {
*/
*delta_ptr = dx;
m_molNumSpecies_old[kspec] += dx;
int iph = m_phaseID[kspec];
size_t iph = m_phaseID[kspec];
m_tPhaseMoles_old[iph] += dx;
vcs_setFlagsVolPhase(iph, false, VCS_STATECALC_OLD);
@ -2159,7 +2159,7 @@ namespace VCSnonideal {
* 1: succeeded
* 0: failed.
*/
int VCS_SOLVE::vcs_zero_species(const int kspec) {
int VCS_SOLVE::vcs_zero_species(const size_t kspec) {
int retn = 1;
/*
* Calculate a delta that will eliminate the species.
@ -2198,11 +2198,11 @@ namespace VCSnonideal {
* noncomponent species is equal to zero. A recheck of deleted species
* is carried out in the main code.
*/
int VCS_SOLVE::vcs_delete_species(const int kspec) {
const int klast = m_numSpeciesRdc - 1;
const int iph = m_phaseID[kspec];
int VCS_SOLVE::vcs_delete_species(const size_t kspec) {
const size_t klast = m_numSpeciesRdc - 1;
const size_t iph = m_phaseID[kspec];
vcs_VolPhase * const Vphase = m_VolPhaseList[iph];
const int irxn = kspec - m_numComponents;
const size_t irxn = kspec - m_numComponents;
/*
* Zero the concentration of the species.
* -> This zeroes w[kspec] and modifies m_tPhaseMoles_old[]
@ -2293,10 +2293,10 @@ namespace VCSnonideal {
*
* This routine is responsible for the global data manipulation only.
*/
void VCS_SOLVE::vcs_reinsert_deleted(int kspec) {
int i, k;
void VCS_SOLVE::vcs_reinsert_deleted(size_t kspec) {
size_t i, k;
// int irxn = kspec - m_numComponents;
int iph = m_phaseID[kspec];
size_t iph = m_phaseID[kspec];
double dx;
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
@ -2373,8 +2373,8 @@ namespace VCSnonideal {
*
* @param iph Phase to be deleted
*/
bool VCS_SOLVE::vcs_delete_multiphase(const int iph) {
int kspec, irxn;
bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph) {
size_t kspec, irxn;
double dx;
vcs_VolPhase *Vphase = m_VolPhaseList[iph];
bool successful = true;
@ -2558,8 +2558,8 @@ namespace VCSnonideal {
*
*/
int VCS_SOLVE::vcs_recheck_deleted() {
int iph, kspec, irxn, npb;
int npb;
size_t iph, kspec, irxn;
double *xtcutoff = VCS_DATA_PTR(m_TmpPhase);
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
@ -2691,7 +2691,7 @@ namespace VCSnonideal {
if (Vphase->exists() == VCS_PHASE_EXIST_ZEROEDPHASE) {
return false;
}
int irxn, kspec;
size_t irxn, kspec;
if (Vphase->m_singleSpecies) {
kspec = Vphase->spGlobalIndexVCS(0);
irxn = kspec + m_numComponents;
@ -2702,7 +2702,7 @@ namespace VCSnonideal {
}
double phaseDG = 1.0;
for (int kk = 0; kk < Vphase->nSpecies(); kk++) {
for (size_t kk = 0; kk < Vphase->nSpecies(); kk++) {
kspec = Vphase->spGlobalIndexVCS(kk);
irxn = kspec + m_numComponents;
if (m_deltaGRxn_old[irxn] > 50.0) m_deltaGRxn_old[irxn] = 50.0;
@ -2724,8 +2724,8 @@ namespace VCSnonideal {
* are obtained and the species is added back into the equation system,
* into the old state vector.
*/
int VCS_SOLVE::vcs_add_all_deleted() {
int iph, kspec, retn;
size_t VCS_SOLVE::vcs_add_all_deleted() {
size_t iph, kspec, retn;
if (m_numSpeciesRdc == m_numSpeciesTot) return 0;
/*
* Use the standard chemical potentials for the chemical potentials
@ -2747,7 +2747,7 @@ namespace VCSnonideal {
*/
vcs_deltag(0, true, VCS_STATECALC_NEW);
for (int irxn = m_numRxnRdc; irxn < m_numRxnTot; ++irxn) {
for (size_t irxn = m_numRxnRdc; irxn < m_numRxnTot; ++irxn) {
kspec = m_indexRxnToSpecies[irxn];
iph = m_phaseID[kspec];
if (m_tPhaseMoles_old[iph] > 0.0) {
@ -2796,7 +2796,7 @@ namespace VCSnonideal {
vcs_deltag(0, true, VCS_STATECALC_OLD);
retn = 0;
for (int irxn = m_numRxnRdc; irxn < m_numRxnTot; ++irxn) {
for (size_t irxn = m_numRxnRdc; irxn < m_numRxnTot; ++irxn) {
kspec = m_indexRxnToSpecies[irxn];
iph = m_phaseID[kspec];
if (m_tPhaseMoles_old[iph] > 0.0) {
@ -2842,9 +2842,9 @@ namespace VCSnonideal {
* where the slope is equal to zero.
*
*/
int VCS_SOLVE::vcs_globStepDamp() {
bool VCS_SOLVE::vcs_globStepDamp() {
double s1, s2, al;
int irxn, kspec, iph;
size_t irxn, kspec, iph;
double *dptr = VCS_DATA_PTR(m_deltaGRxn_new);
/* *************************************************** */
@ -2890,7 +2890,7 @@ namespace VCSnonideal {
plogendl();
}
#endif
return FALSE;
return false;
}
if (s2 <= 0.0) {
@ -2900,7 +2900,7 @@ namespace VCSnonideal {
plogendl();
}
#endif
return FALSE;
return false;
}
/* *************************************************** */
@ -2916,7 +2916,7 @@ namespace VCSnonideal {
plogf(" --- subroutine FORCE produced no adjustments (al = %g)\n", al);
}
#endif
return FALSE;
return false;
}
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
@ -2981,7 +2981,7 @@ namespace VCSnonideal {
plogendl();
}
#endif
return TRUE;
return true;
}
/****************************************************************************************/
@ -3057,11 +3057,11 @@ namespace VCSnonideal {
* VCS_FAILED_CONVERGENCE if there is a problem.
*/
int VCS_SOLVE::vcs_basopt(const int doJustComponents, double aw[], double sa[], double sm[],
double ss[], double test, int * const usedZeroedSpecies) {
int j, k, l, i, jl, ml, jr, lindep, irxn, kspec;
int ncTrial;
int juse = -1;
int jlose = -1;
double ss[], double test, size_t* const usedZeroedSpecies) {
size_t j, k, l, i, jl, ml, jr, lindep, irxn, kspec;
size_t ncTrial;
size_t juse = -1;
size_t jlose = -1;
double *dptr, *scrxn_ptr;
Cantera::clockWC tickTock;
#ifdef DEBUG_MODE
@ -3182,7 +3182,7 @@ namespace VCSnonideal {
double maxConcPossKspec = 0.0;
double maxConcPoss = 0.0;
int kfound = -1;
size_t kfound = -1;
int minNonZeroes = 100000;
int nonZeroesKspec = 0;
for (kspec = ncTrial; kspec < m_numSpeciesTot; kspec++) {
@ -3242,7 +3242,7 @@ namespace VCSnonideal {
if (aw[k] == test) {
m_numComponents = jr;
ncTrial = m_numComponents;
int numPreDeleted = m_numRxnTot - m_numRxnRdc;
size_t numPreDeleted = m_numRxnTot - m_numRxnRdc;
if (numPreDeleted != (m_numSpeciesTot - m_numSpeciesRdc)) {
plogf("vcs_basopt:: we shouldn't be here\n");
exit(EXIT_FAILURE);
@ -3523,7 +3523,7 @@ namespace VCSnonideal {
scrxn_ptr = m_stoichCoeffRxnMatrix[irxn];
dptr = m_deltaMolNumPhase[irxn];
kspec = m_indexRxnToSpecies[irxn];
int iph = m_phaseID[kspec];
size_t iph = m_phaseID[kspec];
int *pp_ptr = m_phaseParticipation[irxn];
dptr[iph] = 1.0;
pp_ptr[iph]++;
@ -3571,12 +3571,12 @@ namespace VCSnonideal {
* molNum[].
* @param n Length of molNum[]
*/
int VCS_SOLVE::vcs_basisOptMax(const double * const molNum, const int j,
const int n) {
int largest = j;
size_t VCS_SOLVE::vcs_basisOptMax(const double * const molNum, const size_t j,
const size_t n) {
size_t largest = j;
double big = molNum[j] * m_spSize[j] * 1.01;
AssertThrowVCS(m_spSize[j] > 0.0, "spsize is nonpos");
for (int i = j + 1; i < n; ++i) {
for (size_t i = j + 1; i < n; ++i) {
AssertThrowVCS(m_spSize[i] > 0.0, "spsize is nonpos");
bool doSwap = false;
if (m_SSPhase[j]) {
@ -3613,7 +3613,7 @@ namespace VCSnonideal {
*
* @return Returns the calculated species type
*/
int VCS_SOLVE::vcs_species_type(const int kspec) const {
int VCS_SOLVE::vcs_species_type(const size_t kspec) const {
// ---------- Treat special cases first ---------------------
@ -3622,8 +3622,8 @@ namespace VCSnonideal {
return VCS_SPECIES_INTERFACIALVOLTAGE;
}
int iph = m_phaseID[kspec];
int irxn = kspec - m_numComponents;
size_t iph = m_phaseID[kspec];
size_t irxn = kspec - m_numComponents;
vcs_VolPhase *VPhase = m_VolPhaseList[iph];
int phaseExist = VPhase->exists();
@ -3696,7 +3696,7 @@ namespace VCSnonideal {
}
}
} else if (negChangeComp < 0.0) {
int jph = m_phaseID[j];
size_t jph = m_phaseID[j];
vcs_VolPhase *jVPhase = m_VolPhaseList[jph];
if (jVPhase->exists() <= 0) {
#ifdef DEBUG_MODE
@ -3908,13 +3908,13 @@ namespace VCSnonideal {
*
*/
void VCS_SOLVE::vcs_chemPotPhase(const int stateCalc,
const int iph, const double *const molNum,
const size_t iph, const double *const molNum,
double * const ac, double * const mu_i,
const bool do_deleted) {
vcs_VolPhase *Vphase = m_VolPhaseList[iph];
int nkk = Vphase->nSpecies();
int k, kspec;
size_t nkk = Vphase->nSpecies();
size_t k, kspec;
#ifdef DEBUG_MODE
//if (m_debug_print_lvl >= 2) {
@ -4102,9 +4102,9 @@ namespace VCSnonideal {
* tg : Total Number of moles in the phase.
*/
void VCS_SOLVE::vcs_dfe(const int stateCalc,
const int ll, const int lbot, const int ltop) {
int l1, l2, iph, kspec, irxn;
int iphase;
const int ll, const size_t lbot, const size_t ltop) {
size_t l1, l2, iph, kspec, irxn;
size_t iphase;
double *tPhMoles_ptr;
double *actCoeff_ptr;
double *tlogMoles;
@ -4416,10 +4416,10 @@ namespace VCSnonideal {
*/
double VCS_SOLVE::l2normdg(double dgLocal[]) const {
double tmp;
int irxn;
size_t irxn;
if (m_numRxnRdc <= 0) return 0.0;
for (irxn = 0, tmp = 0.0; irxn < m_numRxnRdc; ++irxn) {
int kspec = irxn + m_numComponents;
size_t kspec = irxn + m_numComponents;
if (m_speciesStatus[kspec] == VCS_SPECIES_MAJOR || m_speciesStatus[kspec] == VCS_SPECIES_MINOR ||
dgLocal[irxn] < 0.0) {
if (m_speciesStatus[kspec] != VCS_SPECIES_ZEROEDMS) {
@ -4668,8 +4668,8 @@ namespace VCSnonideal {
* @param k2 second row/column value to be switched
*/
void VCS_SOLVE::vcs_switch2D(double * const * const Jac,
const int k1, const int k2) const {
int i;
const size_t k1, const size_t k2) const {
size_t i;
register double dtmp;
if (k1 == k2) return;
for (i = 0; i < m_numSpeciesTot; i++) {
@ -4681,9 +4681,9 @@ namespace VCSnonideal {
}
/*****************************************************************************/
static void print_space(int num)
static void print_space(size_t num)
{
int j;
size_t j;
for (j = 0; j < num; j++) plogf(" ");
}
/********************************************************************************/
@ -4719,11 +4719,11 @@ namespace VCSnonideal {
*/
void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted,
const int vcsState, const bool alterZeroedPhases) {
int iph;
int lneed, irxn, kspec;
size_t iph;
size_t lneed, irxn, kspec;
double *dtmp_ptr;
int icase = 0;
int irxnl = m_numRxnRdc;
size_t irxnl = m_numRxnRdc;
if (doDeleted) {
irxnl = m_numRxnTot;
}
@ -4888,9 +4888,9 @@ namespace VCSnonideal {
double poly = 0.0;
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
// We may need to look at deltaGRxn for components!
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
if (deltaGRxn[irxn] > 50.0) deltaGRxn[irxn] = 50.0;
if (deltaGRxn[irxn] < -50.0) deltaGRxn[irxn] = -50.0;
poly += exp(-deltaGRxn[irxn])/actCoeffSpecies[kspec];
@ -4903,8 +4903,8 @@ namespace VCSnonideal {
*/
for (k = 0; k < Vphase->nSpecies(); k++) {
kspec = Vphase->spGlobalIndexVCS(k);
irxn = kspec - m_numComponents;
if (irxn >= 0) {
if (kspec >= m_numComponents) {
irxn = kspec - m_numComponents;
deltaGRxn[irxn] = 1.0 - poly;
}
}
@ -4937,10 +4937,10 @@ namespace VCSnonideal {
*
* NOTE: this is currently not used used anywhere. It may be in the future?
*/
void VCS_SOLVE::vcs_deltag_Phase(const int iphase, const bool doDeleted,
void VCS_SOLVE::vcs_deltag_Phase(const size_t iphase, const bool doDeleted,
const int stateCalc, const bool alterZeroedPhases) {
int iph;
int irxn, kspec, kcomp;
size_t iph;
size_t irxn, kspec, kcomp;
double *dtmp_ptr;
double *feSpecies;
@ -4964,7 +4964,7 @@ namespace VCSnonideal {
}
#endif
int irxnl = m_numRxnRdc;
size_t irxnl = m_numRxnRdc;
if (doDeleted) irxnl = m_numRxnTot;
vcs_VolPhase *vPhase = m_VolPhaseList[iphase];
@ -5098,10 +5098,10 @@ namespace VCSnonideal {
*
* @param k2 Second species index
*/
void VCS_SOLVE::vcs_switch_pos(const int ifunc, const int k1, const int k2) {
register int j;
void VCS_SOLVE::vcs_switch_pos(const int ifunc, const size_t k1, const size_t k2) {
register size_t j;
register double t1 = 0.0;
int i1, i2, iph, kp1, kp2;
size_t i1, i2, iph, kp1, kp2;
vcs_VolPhase *pv1, *pv2;
VCS_SPECIES_THERMO *st_tmp;
if (k1 == k2) return;
@ -5134,21 +5134,21 @@ namespace VCSnonideal {
pv2->setSpGlobalIndexVCS(kp2, k1);
//pv1->IndSpecies[kp1] = k2;
//pv2->IndSpecies[kp2] = k1;
int itmp;
vcsUtil_stsw(m_speciesName, k1, k2);
SWAP(m_molNumSpecies_old[k1], m_molNumSpecies_old[k2], t1);
SWAP(m_speciesUnknownType[k1], m_speciesUnknownType[k2], j);
SWAP(m_speciesUnknownType[k1], m_speciesUnknownType[k2], itmp);
SWAP(m_molNumSpecies_new[k1], m_molNumSpecies_new[k2], t1);
SWAP(m_SSfeSpecies[k1], m_SSfeSpecies[k2], t1);
SWAP(m_spSize[k1], m_spSize[k2], t1);
SWAP(m_deltaMolNumSpecies[k1], m_deltaMolNumSpecies[k2], t1);
SWAP(m_feSpecies_old[k1], m_feSpecies_old[k2], t1);
SWAP(m_feSpecies_new[k1], m_feSpecies_new[k2], t1);
SWAP(m_SSPhase[k1], m_SSPhase[k2], j);
SWAP(m_SSPhase[k1], m_SSPhase[k2], itmp);
SWAP(m_phaseID[k1], m_phaseID[k2], j);
SWAP(m_speciesMapIndex[k1], m_speciesMapIndex[k2], j);
SWAP(m_speciesLocalPhaseIndex[k1], m_speciesLocalPhaseIndex[k2], j);
SWAP(m_actConventionSpecies[k1], m_actConventionSpecies[k2], j);
SWAP(m_actConventionSpecies[k1], m_actConventionSpecies[k2], itmp);
SWAP(m_lnMnaughtSpecies[k1], m_lnMnaughtSpecies[k2], t1);
SWAP(m_actCoeffSpecies_new[k1], m_actCoeffSpecies_new[k2], t1);
SWAP(m_actCoeffSpecies_old[k1], m_actCoeffSpecies_old[k2], t1);
@ -5163,7 +5163,7 @@ namespace VCSnonideal {
if (m_useActCoeffJac) {
vcs_switch2D(m_dLnActCoeffdMolNum.baseDataAddr(), k1, k2);
}
SWAP(m_speciesStatus[k1], m_speciesStatus[k2], j);
SWAP(m_speciesStatus[k1], m_speciesStatus[k2], itmp);
/*
* Handle the index pointer in the phase structures
*/
@ -5189,7 +5189,7 @@ namespace VCSnonideal {
for (iph = 0; iph < m_numPhases; iph++) {
SWAP(m_deltaMolNumPhase[i1][iph], m_deltaMolNumPhase[i2][iph], t1);
SWAP(m_phaseParticipation[i1][iph],
m_phaseParticipation[i2][iph], j);
m_phaseParticipation[i2][iph], itmp);
}
SWAP(m_deltaGRxn_new[i1], m_deltaGRxn_new[i2], t1);
SWAP(m_deltaGRxn_old[i1], m_deltaGRxn_old[i2], t1);
@ -5230,7 +5230,7 @@ namespace VCSnonideal {
* have.
*/
double VCS_SOLVE::vcs_birthGuess(const int kspec) {
int irxn = kspec - m_numComponents;
size_t irxn = kspec - m_numComponents;
int soldel = false;
double dx = 0.0;
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
@ -5281,7 +5281,7 @@ namespace VCSnonideal {
* be respected.
*/
double *sc_irxn = m_stoichCoeffRxnMatrix[irxn];
for (int j = 0; j < m_numComponents; ++j) {
for (size_t j = 0; j < m_numComponents; ++j) {
// Only loop over element contraints that involve positive def. constraints
if (m_speciesUnknownType[j] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
if (m_molNumSpecies_old[j] > 0.0) {
@ -5318,7 +5318,7 @@ namespace VCSnonideal {
}
/*******************************************************************************/
void VCS_SOLVE::vcs_setFlagsVolPhase(const int iph, const bool upToDate,
void VCS_SOLVE::vcs_setFlagsVolPhase(const size_t iph, const bool upToDate,
const int stateCalc) {
vcs_VolPhase *Vphase = m_VolPhaseList[iph];
if (!upToDate) {

View file

@ -27,8 +27,8 @@ using namespace std;
namespace VCSnonideal {
VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(int indexPhase,
int indexSpeciesPhase) :
VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(size_t indexPhase,
size_t indexSpeciesPhase) :
IndexPhase(indexPhase),
IndexSpeciesPhase(indexSpeciesPhase),
@ -168,7 +168,7 @@ VCS_SPECIES_THERMO* VCS_SPECIES_THERMO::duplMyselfAsVCS_SPECIES_THERMO() {
* Output
* return value = standard state free energy in units of Kelvin.
*/
double VCS_SPECIES_THERMO::GStar_R_calc(int kglob, double TKelvin,
double VCS_SPECIES_THERMO::GStar_R_calc(size_t kglob, double TKelvin,
double pres)
{
char yo[] = "VCS_SPECIES_THERMO::GStar_R_calc ";
@ -177,7 +177,7 @@ double VCS_SPECIES_THERMO::GStar_R_calc(int kglob, double TKelvin,
T = TKelvin;
if (UseCanteraCalls) {
AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency");
int kspec = IndexSpeciesPhase;
size_t kspec = IndexSpeciesPhase;
OwningPhase->setState_TP(TKelvin, pres);
fe = OwningPhase->GStar_calc_one(kspec);
double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
@ -212,7 +212,7 @@ double VCS_SPECIES_THERMO::GStar_R_calc(int kglob, double TKelvin,
* (VCS_UNITS_MKS)
*/
double VCS_SPECIES_THERMO::
VolStar_calc(int kglob, double TKelvin, double presPA)
VolStar_calc(size_t kglob, double TKelvin, double presPA)
{
char yo[] = "VCS_SPECIES_THERMO::VStar_calc ";
double vol, T;
@ -220,7 +220,7 @@ VolStar_calc(int kglob, double TKelvin, double presPA)
T = TKelvin;
if (UseCanteraCalls) {
AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency");
int kspec = IndexSpeciesPhase;
size_t kspec = IndexSpeciesPhase;
OwningPhase->setState_TP(TKelvin, presPA);
vol = OwningPhase->VolStar_calc_one(kspec);
} else {
@ -254,7 +254,7 @@ VolStar_calc(int kglob, double TKelvin, double presPA)
* Output
* return value = naught state free energy in Kelvin.
*/
double VCS_SPECIES_THERMO::G0_R_calc(int kglob, double TKelvin)
double VCS_SPECIES_THERMO::G0_R_calc(size_t kglob, double TKelvin)
{
#ifdef DEBUG_MODE
char yo[] = "VS_SPECIES_THERMO::G0_R_calc ";
@ -270,7 +270,7 @@ double VCS_SPECIES_THERMO::G0_R_calc(int kglob, double TKelvin)
}
if (UseCanteraCalls) {
AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency");
int kspec = IndexSpeciesPhase;
size_t kspec = IndexSpeciesPhase;
OwningPhase->setState_T(TKelvin);
fe = OwningPhase->G0_calc_one(kspec);
double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
@ -316,7 +316,7 @@ double VCS_SPECIES_THERMO::G0_R_calc(int kglob, double TKelvin)
* Output
* return value = activity coefficient for species kspec
*/
double VCS_SPECIES_THERMO::eval_ac(int kglob)
double VCS_SPECIES_THERMO::eval_ac(size_t kglob)
{
#ifdef DEBUG_MODE
char yo[] = "VCS_SPECIES_THERMO::eval_ac ";
@ -329,7 +329,7 @@ double VCS_SPECIES_THERMO::eval_ac(int kglob)
* activity coefficients for all species in the phase are reevaluated.
*/
if (UseCanteraCalls) {
int kspec = IndexSpeciesPhase;
size_t kspec = IndexSpeciesPhase;
ac = OwningPhase->AC_calc_one(kspec);
} else {
switch (Activity_Coeff_Model) {

View file

@ -50,12 +50,12 @@ public:
/**
* Index of the phase that this species belongs to.
*/
int IndexPhase;
size_t IndexPhase;
/**
* Index of this species in the current phase.
*/
int IndexSpeciesPhase;
size_t IndexSpeciesPhase;
/**
* Pointer to the owning phase object.
@ -167,7 +167,7 @@ public:
/*
* constructor and destructor
*/
VCS_SPECIES_THERMO(int indexPhase, int indexSpeciesPhase);
VCS_SPECIES_THERMO(size_t indexPhase, size_t indexSpeciesPhase);
virtual ~VCS_SPECIES_THERMO();
/*
@ -194,7 +194,7 @@ public:
* Output
* return value = standard state free energy in units of Kelvin.
*/
virtual double GStar_R_calc(int kspec, double TKelvin, double pres);
virtual double GStar_R_calc(size_t kspec, double TKelvin, double pres);
/**
*
@ -209,7 +209,7 @@ public:
* Output
* return value = standard state free energy in Kelvin.
*/
virtual double G0_R_calc(int kspec, double TKelvin);
virtual double G0_R_calc(size_t kspec, double TKelvin);
/**
* cpc_ts_VStar_calc:
@ -225,7 +225,7 @@ public:
* return value = standard state volume in cm**3 per mol.
* (if__=3) m**3 / kmol
*/
virtual double VolStar_calc(int kglob, double TKelvin, double Pres);
virtual double VolStar_calc(size_t kglob, double TKelvin, double Pres);
/**
* This function evaluates the activity coefficient
@ -244,7 +244,7 @@ public:
* Output
* return value = activity coefficient for species kspec
*/
virtual double eval_ac(int kspec);
virtual double eval_ac(size_t kspec);
/**
* Get the pointer to the vcs_VolPhase object for this species.

View file

@ -188,9 +188,9 @@ namespace VCSnonideal {
* RETURN
* return index of the greatest value on X(*) searched
*/
int vcs_optMax(const double *x, const double * xSize, int j, int n) {
int i;
int largest = j;
size_t vcs_optMax(const double *x, const double * xSize, size_t j, size_t n) {
size_t i;
size_t largest = j;
double big = x[j];
if (xSize) {
assert(xSize[j] > 0.0);
@ -242,7 +242,7 @@ namespace VCSnonideal {
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_stsw(std::vector<std::string> & vstr, int i1, int i2) {
void vcsUtil_stsw(std::vector<std::string> & vstr, size_t i1, size_t i2) {
std::string tmp(vstr[i2]);
vstr[i2] = vstr[i1];
vstr[i1] = tmp;
@ -256,7 +256,7 @@ namespace VCSnonideal {
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_dsw(double x[], int i1, int i2) {
void vcsUtil_dsw(double x[], size_t i1, size_t i2) {
double t = x[i1];
x[i1] = x[i2];
x[i2] = t;
@ -270,12 +270,26 @@ namespace VCSnonideal {
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_isw(int x[], int i1, int i2) {
void vcsUtil_isw(int x[], size_t i1, size_t i2) {
int t = x[i1];
x[i1] = x[i2];
x[i2] = t;
}
// Swap values in an size_t array
/*
* Switches the value of x[i1] with x[i2]
*
* @param x Vector of integers
* @param i1 first index
* @param i2 second index
*/
void vcsUtil_ssw(size_t x[], size_t i1, size_t i2) {
size_t t = x[i1];
x[i1] = x[i2];
x[i2] = t;
}
// Invert an n x n matrix and solve m rhs's
/*
* Solve a square matrix with multiple right hand sides
@ -306,7 +320,7 @@ namespace VCSnonideal {
* (each column is a new rhs)
* @param m number of rhs's
*/
int vcsUtil_mlequ(double *c, int idem, int n, double *b, int m) {
int vcsUtil_mlequ(double *c, size_t idem, size_t n, double *b, size_t m) {
int i, j, k, l;
double R;
if (n > idem || n <= 0) {

View file

@ -81,7 +81,6 @@ namespace Cantera {
* Update the equilibrium constants in molar units.
*/
void AqueousKinetics::updateKc() {
int i, irxn;
vector_fp& m_rkc = m_kdata->m_rkcn;
doublereal rt = GasConstant* m_kdata->m_temp;
@ -97,12 +96,12 @@ namespace Cantera {
//doublereal logStandConc = m_kdata->m_logStandConc;
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
for (size_t i = 0; i < m_nrev; i++) {
size_t irxn = m_revindex[i];
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;
}
}
@ -420,7 +419,7 @@ namespace Cantera {
void AqueousKinetics::addElementaryReaction(const ReactionData& r) {
int iloc;
size_t iloc;
// install rate coeff calculator
iloc = m_rates.install( reactionNumber(),
@ -447,7 +446,7 @@ namespace Cantera {
doublereal nsFlt;
doublereal reactantGlobalOrder = 0.0;
doublereal productGlobalOrder = 0.0;
int rnum = reactionNumber();
size_t rnum = reactionNumber();
std::vector<size_t> rk;
size_t nr = r.reactants.size();
@ -508,7 +507,7 @@ namespace Cantera {
const vector<grouplist_t>& r,
const vector<grouplist_t>& p) {
if (!r.empty()) {
writelog("installing groups for reaction "+int2str(reactionNumber()));
writelog("installing groups for reaction "+int2str(int(reactionNumber())));
m_rgroups[reactionNumber()] = r;
m_pgroups[reactionNumber()] = p;
}

View file

@ -89,11 +89,11 @@ namespace Cantera {
virtual int ID() const { return cAqueousKinetics; }
virtual int type() const { return cAqueousKinetics; }
virtual doublereal reactantStoichCoeff(int k, int i) const {
virtual doublereal reactantStoichCoeff(size_t k, size_t i) const {
return m_rrxn[k][i];
}
virtual doublereal productStoichCoeff(int k, int i) const {
virtual doublereal productStoichCoeff(size_t k, size_t i) const {
return m_prxn[k][i];
}
@ -265,11 +265,11 @@ namespace Cantera {
* their meaning are specific to the particular kinetics
* manager.
*/
virtual int reactionType(int i) const {
virtual int reactionType(size_t i) const {
return m_index[i].first;
}
virtual std::string reactionString(int i) const {
virtual std::string reactionString(size_t i) const {
return m_rxneqn[i];
}
@ -278,7 +278,7 @@ namespace Cantera {
* isReversible(i) is false, then the reverse rate of progress
* for reaction i is always zero.
*/
virtual bool isReversible(int i) {
virtual bool isReversible(size_t i) {
if (std::find(m_revindex.begin(), m_revindex.end(), i)
< m_revindex.end()) return true;
else return false;
@ -323,9 +323,9 @@ namespace Cantera {
void updateROP();
const std::vector<grouplist_t>& reactantGroups(int i)
const std::vector<grouplist_t>& reactantGroups(size_t i)
{ return m_rgroups[i]; }
const std::vector<grouplist_t>& productGroups(int i)
const std::vector<grouplist_t>& productGroups(size_t i)
{ return m_pgroups[i]; }
@ -340,9 +340,9 @@ namespace Cantera {
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;
std::vector<int> m_irrev;
std::vector<size_t> m_irrev;
ReactionStoichMgr* m_rxnstoich;
@ -351,13 +351,13 @@ namespace Cantera {
int m_nirrev;
int m_nrev;
std::map<int, std::vector<grouplist_t> > m_rgroups;
std::map<int, std::vector<grouplist_t> > m_pgroups;
std::map<size_t, std::vector<grouplist_t> > m_rgroups;
std::map<size_t, std::vector<grouplist_t> > m_pgroups;
std::vector<int> m_rxntype;
mutable std::vector<std::map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<int, doublereal> > m_prxn;
mutable std::vector<std::map<size_t, doublereal> > m_rrxn;
mutable std::vector<std::map<size_t, doublereal> > m_prxn;
/**
* Difference between the input global reactants order
@ -366,7 +366,7 @@ namespace Cantera {
* stoichiometries.
*/
array_fp m_dn;
array_int m_revindex;
std::vector<size_t> m_revindex;
std::vector<std::string> m_rxneqn;
@ -390,8 +390,8 @@ namespace Cantera {
const std::vector<grouplist_t>& p);
void updateKc();
void registerReaction(int rxnNumber, int type, int loc) {
m_index[rxnNumber] = std::pair<int, int>(type, loc);
void registerReaction(size_t rxnNumber, int type, size_t loc) {
m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
}
bool m_finalized;
};

View file

@ -21,9 +21,9 @@ namespace Cantera {
Enhanced3BConc() : m_n (0), m_deflt (1.0) {}
Enhanced3BConc(int n, const std::map<int, doublereal>& enhanced,
Enhanced3BConc(size_t n, const std::map<size_t, doublereal>& enhanced,
doublereal deflt = 1.0) {
std::map<int, doublereal>::const_iterator iter;
std::map<size_t, doublereal>::const_iterator iter;
for (iter = enhanced.begin(); iter != enhanced.end(); ++iter) {
m_index.push_back( iter->first );
m_eff.push_back( iter->second - deflt);
@ -32,36 +32,33 @@ namespace Cantera {
m_n = n;
}
Enhanced3BConc(int n, const vector_int& e_index,
Enhanced3BConc(size_t n, const std::vector<size_t>& e_index,
const vector_fp& efficiencies, doublereal deflt = 1.0)
: m_index (e_index), m_eff (efficiencies) {
int i;
: m_index(e_index), m_eff(efficiencies) {
m_n = n;
m_deflt = deflt;
for (i = 0; i < m_n; i++) {
for (size_t i = 0; i < m_n; i++) {
m_eff[i] -= m_deflt;
}
}
doublereal update(const vector_fp& c, doublereal ctot) const {
int i;
doublereal sum = 0.0;
for (i = 0; i < m_n; i++) {
for (size_t i = 0; i < m_n; i++) {
sum += m_eff[i] * c[m_index[i]];
}
return m_deflt * ctot + sum;
}
void getEfficiencies(vector_fp& eff) const {
int i;
for (i = 0; i < m_n; i++) {
for (size_t i = 0; i < m_n; i++) {
eff[m_index[i]] = m_eff[i] + m_deflt;
}
}
private:
int m_n;
vector_int m_index;
size_t m_n;
std::vector<size_t> m_index;
vector_fp m_eff;
doublereal m_deflt;
};

View file

@ -54,7 +54,7 @@ namespace Cantera {
* @param type of falloff function to install.
* @param c vector of coefficients for the falloff function.
*/
void install(int rxn, int type,
void install(size_t rxn, int type,
const vector_fp& c) {
if (type != SIMPLE_FALLOFF) {
m_rxn.push_back(rxn);
@ -107,7 +107,7 @@ namespace Cantera {
}
protected:
vector_int m_rxn, m_rxn0;
std::vector<size_t> m_rxn, m_rxn0;
std::vector<Falloff*> m_falloff;
FalloffFactory* m_factory;
vector_int m_loc;

View file

@ -96,7 +96,6 @@ namespace Cantera {
* Update the equilibrium constants in molar units.
*/
void GasKinetics::updateKc() {
int i, irxn;
vector_fp& m_rkc = m_kdata->m_rkcn;
thermo().getStandardChemPotentials(&m_grt[0]);
@ -107,12 +106,12 @@ namespace Cantera {
doublereal logStandConc = m_kdata->m_logStandConc;
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
for (size_t i = 0; i < m_nrev; i++) {
size_t irxn = m_revindex[i];
m_rkc[irxn] = exp(m_rkc[irxn]*rrt - m_dn[irxn]*logStandConc);
}
for(i = 0; i != m_nirrev; ++i) {
for(size_t i = 0; i != m_nirrev; ++i) {
m_rkc[ m_irrev[i] ] = 0.0;
}
}
@ -622,10 +621,10 @@ namespace Cantera {
}
void GasKinetics::installGroups(int irxn,
void GasKinetics::installGroups(size_t irxn,
const vector<grouplist_t>& r, const vector<grouplist_t>& p) {
if (!r.empty()) {
writelog("installing groups for reaction "+int2str(reactionNumber()));
writelog("installing groups for reaction "+int2str(int(reactionNumber())));
m_rgroups[reactionNumber()] = r;
m_pgroups[reactionNumber()] = p;
}

View file

@ -88,11 +88,11 @@ namespace Cantera {
virtual int ID() const { return cGasKinetics; }
virtual int type() const { return cGasKinetics; }
virtual doublereal reactantStoichCoeff(int k, int i) const {
virtual doublereal reactantStoichCoeff(size_t k, size_t i) const {
return m_rrxn[k][i];
}
virtual doublereal productStoichCoeff(int k, int i) const {
virtual doublereal productStoichCoeff(size_t k, size_t i) const {
return m_prxn[k][i];
}
@ -268,11 +268,11 @@ namespace Cantera {
* their meaning are specific to the particular kinetics
* manager.
*/
virtual int reactionType(int i) const {
virtual int reactionType(size_t i) const {
return m_index[i].first;
}
virtual std::string reactionString(int i) const {
virtual std::string reactionString(size_t i) const {
return m_rxneqn[i];
}
@ -281,7 +281,7 @@ namespace Cantera {
* isReversible(i) is false, then the reverse rate of progress
* for reaction i is always zero.
*/
virtual bool isReversible(int i) {
virtual bool isReversible(size_t i) {
if (std::find(m_revindex.begin(), m_revindex.end(), i)
< m_revindex.end()) return true;
else return false;
@ -326,9 +326,9 @@ namespace Cantera {
void updateROP();
const std::vector<grouplist_t>& reactantGroups(int i)
const std::vector<grouplist_t>& reactantGroups(size_t i)
{ return m_rgroups[i]; }
const std::vector<grouplist_t>& productGroups(int i)
const std::vector<grouplist_t>& productGroups(size_t i)
{ return m_pgroups[i]; }
@ -341,7 +341,7 @@ namespace Cantera {
size_t m_kk, m_nfall;
array_int m_fallindx;
std::vector<size_t> m_fallindx;
Rate1<Arrhenius> m_falloff_low_rates;
Rate1<Arrhenius> m_falloff_high_rates;
@ -354,7 +354,7 @@ namespace Cantera {
ThirdBodyMgr<Enhanced3BConc> m_3b_concm;
ThirdBodyMgr<Enhanced3BConc> m_falloff_concm;
std::vector<int> m_irrev;
std::vector<size_t> m_irrev;
ReactionStoichMgr* m_rxnstoich;
@ -363,13 +363,13 @@ namespace Cantera {
int m_nirrev;
int m_nrev;
std::map<int, std::vector<grouplist_t> > m_rgroups;
std::map<int, std::vector<grouplist_t> > m_pgroups;
std::map<size_t, std::vector<grouplist_t> > m_rgroups;
std::map<size_t, std::vector<grouplist_t> > m_pgroups;
std::vector<int> m_rxntype;
mutable std::vector<std::map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<int, doublereal> > m_prxn;
mutable std::vector<std::map<size_t, doublereal> > m_rrxn;
mutable std::vector<std::map<size_t, doublereal> > m_prxn;
/**
* Difference between the input global reactants order
@ -378,7 +378,7 @@ namespace Cantera {
* stoichiometries.
*/
array_fp m_dn;
array_int m_revindex;
std::vector<size_t> m_revindex;
std::vector<std::string> m_rxneqn;
@ -400,7 +400,7 @@ namespace Cantera {
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);
void updateKc();

View file

@ -69,9 +69,9 @@ namespace Cantera {
m_numTotalBulkSpecies += nsp;
imatch = m_bulkPhases.size() - 1;
}
pLocTmp[ip] = imatch;
pLocTmp[ip] = int(imatch);
} else {
pLocTmp[ip] = -n;
pLocTmp[ip] = -int(n);
}
}
pLocVec.push_back(pLocTmp);

View file

@ -140,7 +140,7 @@ namespace Cantera {
// overloaded methods of class FuncEval
//! Return the number of equations
virtual int neq() { return m_nv; }
virtual size_t neq() { return m_nv; }
//! Evaluate the value of ydot[k] at the current conditions
/*!
@ -248,9 +248,8 @@ namespace Cantera {
//! index of the surface phase in each InterfaceKinetics object
std::vector<size_t> m_surfindex;
vector_int m_specStartIndex;
std::vector<size_t> m_specStartIndex;
//! Total number of surface phases.
/*!
@ -267,7 +266,7 @@ namespace Cantera {
size_t m_nv;
size_t m_numBulkPhases;
vector_int m_nspBulkPhases;
std::vector<size_t> m_nspBulkPhases;
size_t m_numTotalBulkSpecies;
size_t m_numTotalSpecies;

View file

@ -167,7 +167,7 @@ namespace Cantera {
m_rxnPhaseIsReactant.resize(m_ii, 0);
m_rxnPhaseIsProduct.resize(m_ii, 0);
int np = nPhases();
size_t np = nPhases();
for (i = 0; i < m_ii; i++) {
m_rxnPhaseIsReactant[i] = new bool[np];
m_rxnPhaseIsProduct[i] = new bool[np];
@ -254,8 +254,7 @@ namespace Cantera {
}
//====================================================================================================================
void InterfaceKinetics::_update_rates_phi() {
int np = nPhases();
for (int n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
if (thermo(n).electricPotential() != m_phi[n]) {
m_phi[n] = thermo(n).electricPotential();
m_redo_rates = true;
@ -273,10 +272,7 @@ namespace Cantera {
* quantities.
*/
void InterfaceKinetics::_update_rates_C() {
int n;
int np = nPhases();
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
/*
* We call the getActivityConcentrations function of each
* ThermoPhase class that makes up this kinetics object to
@ -323,7 +319,7 @@ namespace Cantera {
for (size_t i = 0; i < m_nrev; i++) {
size_t irxn = m_revindex[i];
if (irxn < 0 || irxn >= nReactions()) {
if (irxn == -1 || irxn >= nReactions()) {
throw CanteraError("InterfaceKinetics",
"illegal value: irxn = "+int2str(int(irxn)));
}
@ -339,7 +335,6 @@ namespace Cantera {
void InterfaceKinetics::checkPartialEquil() {
int i, irxn;
vector_fp dmu(nTotalSpecies(), 0.0);
vector_fp rmu(nReactions(), 0.0);
vector_fp frop(nReactions(), 0.0);
@ -368,8 +363,8 @@ namespace Cantera {
getFwdRatesOfProgress(DATA_PTR(frop));
getRevRatesOfProgress(DATA_PTR(rrop));
getNetRatesOfProgress(DATA_PTR(netrop));
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
for (size_t i = 0; i < m_nrev; i++) {
size_t irxn = m_revindex[i];
cout << "Reaction " << reactionString(irxn)
<< " " << rmu[irxn]/rt << endl;
printf("%12.6e %12.6e %12.6e %12.6e \n",
@ -388,8 +383,7 @@ namespace Cantera {
size_t ik=0;
doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt;
int np = nPhases();
for (size_t n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
size_t nsp = thermo(n).nSpecies();
for (size_t k = 0; k < nsp; k++) {
@ -523,10 +517,8 @@ namespace Cantera {
#ifdef DEBUG_KIN_MODE
doublereal ea;
#endif
int nct = m_beta.size();
int irxn;
for (size_t i = 0; i < nct; i++) {
irxn = m_ctrxn[i];
for (size_t i = 0; i < m_beta.size(); i++) {
size_t irxn = m_ctrxn[i];
eamod = m_beta[i]*m_rwork[irxn];
// if (eamod != 0.0 && m_E[irxn] != 0.0) {
if (eamod != 0.0) {
@ -552,11 +544,10 @@ namespace Cantera {
//====================================================================================================================
void InterfaceKinetics::applyExchangeCurrentDensityFormulation(doublereal* const kfwd) {
getExchangeCurrentQuantities();
int nct = m_ctrxn.size();
doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt;
for (int i = 0; i < nct; i++) {
int irxn = m_ctrxn[i];
for (size_t i = 0; i < m_ctrxn.size(); i++) {
size_t irxn = m_ctrxn[i];
int iECDFormulation = m_ctrxn_ecdf[i];
if (iECDFormulation) {
double tmp = exp(- m_beta[i] * m_deltaG0[irxn] * rrt);
@ -730,9 +721,7 @@ namespace Cantera {
* Get the chemical potentials of the species in the
* ideal gas solution.
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getChemPotentials(DATA_PTR(m_grt) + m_start[n]);
}
//for (n = 0; n < m_grt.size(); n++) {
@ -762,9 +751,7 @@ namespace Cantera {
* Get the partial molar enthalpy of all species in the
* ideal gas.
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getPartialMolarEnthalpies(DATA_PTR(m_grt) + m_start[n]);
}
/*
@ -792,9 +779,7 @@ namespace Cantera {
* Get the partial molar entropy of all species in all of
* the phases
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getPartialMolarEntropies(DATA_PTR(m_grt) + m_start[n]);
}
/*
@ -822,9 +807,7 @@ namespace Cantera {
* We define these here as the chemical potentials of the pure
* species at the temperature and pressure of the solution.
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getStandardChemPotentials(DATA_PTR(m_grt) + m_start[n]);
}
/*
@ -852,13 +835,11 @@ namespace Cantera {
* We define these here as the enthalpies of the pure
* species at the temperature and pressure of the solution.
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getEnthalpy_RT(DATA_PTR(m_grt) + m_start[n]);
}
doublereal RT = thermo().temperature() * GasConstant;
for (int k = 0; k < m_kk; k++) {
for (size_t k = 0; k < m_kk; k++) {
m_grt[k] *= RT;
}
/*
@ -885,13 +866,11 @@ namespace Cantera {
* We define these here as the entropies of the pure
* species at the temperature and pressure of the solution.
*/
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
thermo(n).getEntropy_R(DATA_PTR(m_grt) + m_start[n]);
}
doublereal R = GasConstant;
for (int k = 0; k < m_kk; k++) {
for (size_t k = 0; k < m_kk; k++) {
m_grt[k] *= R;
}
/*
@ -1035,7 +1014,7 @@ namespace Cantera {
* Obtain the current reaction index for the reaction that we
* are adding. The first reaction is labeled 0.
*/
int rnum = reactionNumber();
size_t rnum = reactionNumber();
// vectors rk and pk are lists of species numbers, with
// repeated entries for species with stoichiometric
@ -1126,10 +1105,8 @@ namespace Cantera {
* m_kk previously, before all phases have been added.
*/
void InterfaceKinetics::init() {
int n;
m_kk = 0;
int np = nPhases();
for (n = 0; n < np; n++) {
for (size_t n = 0; n < nPhases(); n++) {
m_kk += thermo(n).nSpecies();
}
m_rrxn.resize(m_kk);
@ -1138,7 +1115,7 @@ namespace Cantera {
m_mu0.resize(m_kk);
m_grt.resize(m_kk);
m_pot.resize(m_kk, 0.0);
m_phi.resize(np, 0.0);
m_phi.resize(nPhases(), 0.0);
}
//================================================================================================
/**
@ -1152,14 +1129,14 @@ namespace Cantera {
void InterfaceKinetics::finalize() {
Kinetics::finalize();
m_rwork.resize(nReactions());
int ks = reactionPhaseIndex();
if (ks < 0) throw CanteraError("InterfaceKinetics::finalize",
"no surface phase is present.");
size_t ks = reactionPhaseIndex();
if (ks == -1) throw CanteraError("InterfaceKinetics::finalize",
"no surface phase is present.");
m_surf = (SurfPhase*)&thermo(ks);
if (m_surf->nDim() != 2)
throw CanteraError("InterfaceKinetics::finalize",
"expected interface dimension = 2, but got dimension = "
+int2str(m_surf->nDim()));
+int2str(int(m_surf->nDim())));
@ -1174,9 +1151,8 @@ namespace Cantera {
m_finalized = true;
}
doublereal InterfaceKinetics::electrochem_beta(int irxn) const{
int n = m_ctrxn.size();
for (int i = 0; i < n; i++) {
doublereal InterfaceKinetics::electrochem_beta(size_t irxn) const{
for (size_t i = 0; i < m_ctrxn.size(); i++) {
if (m_ctrxn[i] == irxn) {
return m_beta[i];
}
@ -1236,8 +1212,8 @@ namespace Cantera {
}
//================================================================================================
void InterfaceKinetics::setPhaseExistence(const int iphase, const bool exists) {
if (iphase < 0 || iphase >= (int) m_thermo.size()) {
void InterfaceKinetics::setPhaseExistence(const size_t iphase, const bool exists) {
if (iphase < 0 || iphase >= m_thermo.size()) {
throw CanteraError("InterfaceKinetics:setPhaseExistence", "out of bounds");
}
if (exists) {
@ -1255,14 +1231,14 @@ namespace Cantera {
//================================================================================================
void EdgeKinetics::finalize() {
m_rwork.resize(nReactions());
int ks = reactionPhaseIndex();
if (ks < 0) throw CanteraError("EdgeKinetics::finalize",
"no edge phase is present.");
size_t ks = reactionPhaseIndex();
if (ks == -1) throw CanteraError("EdgeKinetics::finalize",
"no edge phase is present.");
m_surf = (SurfPhase*)&thermo(ks);
if (m_surf->nDim() != 1)
throw CanteraError("EdgeKinetics::finalize",
"expected interface dimension = 1, but got dimension = "
+int2str(m_surf->nDim()));
+int2str(int(m_surf->nDim())));
m_finalized = true;
}
//================================================================================================

View file

@ -298,7 +298,7 @@ namespace Cantera {
* Stoichiometric coefficient of species k as a reactant in
* reaction i.
*/
virtual doublereal reactantStoichCoeff(int k, int i) const {
virtual doublereal reactantStoichCoeff(size_t k, size_t i) const {
return m_rrxn[k][i];
}
@ -306,7 +306,7 @@ namespace Cantera {
* Stoichiometric coefficient of species k as a product in
* reaction i.
*/
virtual doublereal productStoichCoeff(int k, int i) const {
virtual doublereal productStoichCoeff(size_t k, size_t i) const {
return m_prxn[k][i];
}
@ -315,7 +315,7 @@ namespace Cantera {
* their meaning are specific to the particular kinetics
* manager.
*/
virtual int reactionType(int i) const {
virtual int reactionType(size_t i) const {
return m_index[i].first;
}
@ -335,14 +335,14 @@ namespace Cantera {
* Beta parameter. This defaults to zero, even for charge transfer
* reactions.
*/
doublereal electrochem_beta(int irxn) const;
doublereal electrochem_beta(size_t irxn) const;
/**
* True if reaction i has been declared to be reversible. If
* isReversible(i) is false, then the reverse rate of progress
* for reaction i is always zero.
*/
virtual bool isReversible(int i) {
virtual bool isReversible(size_t i) {
if (std::find(m_revindex.begin(), m_revindex.end(), i)
< m_revindex.end()) return true;
else return false;
@ -351,7 +351,7 @@ namespace Cantera {
/**
* Return a string representing the reaction.
*/
virtual std::string reactionString(int i) const {
virtual std::string reactionString(size_t i) const {
return m_rxneqn[i];
}
@ -482,7 +482,7 @@ namespace Cantera {
void checkPartialEquil();
int reactionNumber() const { return m_ii;}
size_t reactionNumber() const { return m_ii;}
void addElementaryReaction(const ReactionData& r);
void addGlobalReaction(const ReactionData& r);
@ -496,8 +496,8 @@ namespace Cantera {
* @param type reaction type
* @param loc location ??
*/
void registerReaction(int rxnNumber, int type, int loc) {
m_index[rxnNumber] = std::pair<int, int>(type, loc);
void registerReaction(size_t rxnNumber, int type, size_t loc) {
m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
}
//! Apply corrections for interfacial charge transfer reactions
@ -527,7 +527,7 @@ namespace Cantera {
* @param iphase Index of the phase. This is the order within the internal thermo vector object
* @param exists Boolean indicating whether the phase exists or not
*/
void setPhaseExistence(const int iphase, const bool exists);
void setPhaseExistence(const size_t iphase, const bool exists);
protected:
@ -536,7 +536,7 @@ namespace Cantera {
//! m_kk is the number of species in all of the phases
//! that participate in this kinetics mechanism.
int m_kk;
size_t m_kk;
//! List of reactions numbers which are reversible reactions
/*!
@ -544,7 +544,7 @@ namespace Cantera {
* in the list is reversible.
* Length = number of reversible reactions
*/
vector_int m_revindex;
std::vector<size_t> m_revindex;
Rate1<SurfaceArrhenius> m_rates;
bool m_redo_rates;
@ -556,7 +556,7 @@ namespace Cantera {
* The first pair is the reactionType of the reaction.
* The second pair is ...
*/
mutable std::map<int, std::pair<int, int> > m_index;
mutable std::map<size_t, std::pair<int, size_t> > m_index;
//! Vector of irreversible reaction numbers
/*!
@ -592,7 +592,7 @@ namespace Cantera {
* HKM -> mutable because search sometimes creates extra
* entries. To be fixed in future...
*/
mutable std::vector<std::map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<size_t, doublereal> > m_rrxn;
//! m_prxn is a vector of maps, containing the reactant
//! stochiometric coefficient information
@ -603,7 +603,7 @@ namespace Cantera {
* reaction number being the key, and the
* product stoichiometric coefficient for the species being the value.
*/
mutable std::vector<std::map<int, doublereal> > m_prxn;
mutable std::vector<std::map<size_t, doublereal> > m_prxn;
//! String expression for each rxn
/*!
@ -699,7 +699,7 @@ namespace Cantera {
*
* irxn = m_ctrxn[i]
*/
vector_int m_ctrxn;
std::vector<size_t> m_ctrxn;
//! Vector of booleans indicating whether the charge transfer reaction may be
//! described by an exchange current density expression

View file

@ -225,14 +225,13 @@ namespace Cantera {
* manager) and returns the index of the phase owning the
* species.
*/
int Kinetics::speciesPhaseIndex(int k) {
int np = m_start.size();
for (int n = np-1; n >= 0; n--) {
size_t Kinetics::speciesPhaseIndex(size_t k) {
for (size_t n = m_start.size()-1; n != -1; n--) {
if (k >= m_start[n]) {
return n;
}
}
throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(k));
throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(int(k)));
return -1;
}
@ -291,9 +290,8 @@ namespace Cantera {
void Kinetics::finalize() {
m_nTotalSpecies = 0;
int np = nPhases();
for (int n = 0; n < np; n++) {
int nsp = m_thermo[n]->nSpecies();
for (size_t n = 0; n < nPhases(); n++) {
size_t nsp = m_thermo[n]->nSpecies();
m_nTotalSpecies += nsp;
}
}

View file

@ -236,7 +236,7 @@ namespace Cantera {
* identifies the one surface phase. For homogeneous
* mechanisms, this reurns -1.
*/
int surfacePhaseIndex() { return m_surfphase; }
size_t surfacePhaseIndex() { return m_surfphase; }
/**
* Phase where the reactions occur. For heterogeneous
@ -248,7 +248,7 @@ namespace Cantera {
* index of the first one is returned. For homogeneous
* mechanisms, the value 0 is returned.
*/
int reactionPhaseIndex() { return m_rxnphase; }
size_t reactionPhaseIndex() { return m_rxnphase; }
/**
@ -391,7 +391,7 @@ namespace Cantera {
*
* @param k Species index
*/
thermo_t& speciesPhase(int k) {
thermo_t& speciesPhase(size_t k) {
return thermo(speciesPhaseIndex(k));
}
@ -403,7 +403,7 @@ namespace Cantera {
*
* @param k Species index
*/
int speciesPhaseIndex(int k);
size_t speciesPhaseIndex(size_t k);
//@}
@ -634,7 +634,7 @@ namespace Cantera {
* @param k kinetic species index
* @param i reaction index
*/
virtual doublereal reactantStoichCoeff(int k, int i) const {
virtual doublereal reactantStoichCoeff(size_t k, size_t i) const {
err("reactantStoichCoeff");
return -1.0;
}
@ -646,7 +646,7 @@ namespace Cantera {
* @param k kinetic species index
* @param i reaction index
*/
virtual doublereal productStoichCoeff(int k, int i) const {
virtual doublereal productStoichCoeff(size_t k, size_t i) const {
err("productStoichCoeff");
return -1.0;
}
@ -657,7 +657,7 @@ namespace Cantera {
* @param k kinetic species index
* @param i reaction index
*/
virtual doublereal reactantOrder(int k, int i) const {
virtual doublereal reactantOrder(size_t k, size_t i) const {
err("reactantOrder");
return -1.0;
}
@ -668,7 +668,7 @@ namespace Cantera {
*
* @param i reaction index
*/
virtual const std::vector<size_t>& reactants(int i) const {
virtual const std::vector<size_t>& reactants(size_t i) const {
return m_reactants[i];
}
@ -678,7 +678,7 @@ namespace Cantera {
*
* @param i reaction index
*/
virtual const std::vector<size_t>& products(int i) const {
virtual const std::vector<size_t>& products(size_t i) const {
return m_products[i];
}
@ -689,7 +689,7 @@ namespace Cantera {
*
* @param i reaction index
*/
virtual int reactionType(int i) const {
virtual int reactionType(size_t i) const {
err("reactionType");
return -1;
}
@ -701,7 +701,7 @@ namespace Cantera {
*
* @param i reaction index
*/
virtual bool isReversible(int i){
virtual bool isReversible(size_t i){
err("isReversible");
return false;
}
@ -711,7 +711,7 @@ namespace Cantera {
*
* @param i reaction index
*/
virtual std::string reactionString(int i) const {
virtual std::string reactionString(size_t i) const {
err("reactionStd::String"); return "<null>";
}
@ -821,12 +821,12 @@ namespace Cantera {
err("addReaction");
}
virtual const std::vector<grouplist_t>& reactantGroups(int i) {
virtual const std::vector<grouplist_t>& reactantGroups(size_t i) {
//err("reactantGroups");
return m_dummygroups;
}
virtual const std::vector<grouplist_t>& productGroups(int i) {
virtual const std::vector<grouplist_t>& productGroups(size_t i) {
//err("productGroups");
return m_dummygroups;
}
@ -887,7 +887,7 @@ namespace Cantera {
doublereal* phase_data);
/// For internal use. May be removed in a future release.
int index(){ return m_index; }
size_t index(){ return m_index; }
//! Set the index of the Kinetics Manager
/*!
@ -969,7 +969,7 @@ namespace Cantera {
* returning the index value, so that missing phases return
* -1.
*/
std::map<std::string, int> m_phaseindex;
std::map<std::string, size_t> m_phaseindex;
//! Index of the Kinetics Manager
size_t m_index;
@ -985,7 +985,7 @@ namespace Cantera {
size_t m_rxnphase;
/// number of spatial dimensions of lowest-dimensional phase.
int m_mindim;
size_t m_mindim;
private:

View file

@ -46,7 +46,7 @@ namespace Cantera {
vector_fp pstoich;
std::vector<grouplist_t> rgroups;
std::vector<grouplist_t> pgroups;
std::map<int, doublereal> thirdBodyEfficiencies;
std::map<size_t, doublereal> thirdBodyEfficiencies;
//! True if the current reaction is reversible. False otherwise
bool reversible;

View file

@ -22,7 +22,7 @@ namespace Cantera {
}
void SpeciesNode::printPaths() {
for (int i = 0; i < int(m_paths.size()); i++) {
for (size_t i = 0; i < m_paths.size(); i++) {
cout << m_paths[i]->begin()->name << " --> "
<< m_paths[i]->end()->name << ": "
<< m_paths[i]->flow() << endl;
@ -46,7 +46,7 @@ namespace Cantera {
* reaction, the total flow, and the flow associated with this
* label.
*/
void Path::addReaction(int rxnNumber, doublereal value,
void Path::addReaction(size_t rxnNumber, doublereal value,
string label) {
m_rxn[rxnNumber] += value;
m_total += value;
@ -60,7 +60,7 @@ namespace Cantera {
*/
void Path::writeLabel(ostream& s, doublereal threshold)
{
int nn = static_cast<int>(m_label.size());
size_t nn = m_label.size();
if (nn == 0) return;
doublereal v;
map<string, doublereal>::const_iterator i = m_label.begin();
@ -112,18 +112,17 @@ namespace Cantera {
ReactionPathDiagram::~ReactionPathDiagram()
{
// delete the nodes
map<int, SpeciesNode*>::const_iterator i = m_nodes.begin();
map<size_t, SpeciesNode*>::const_iterator i = m_nodes.begin();
for (; i != m_nodes.end(); ++i) delete i->second;
// delete the paths
int nn = nPaths();
int n;
for (n = 0; n < nn; n++) delete m_pathlist[n];
size_t nn = nPaths();
for (size_t n = 0; n < nn; n++) delete m_pathlist[n];
}
vector_int ReactionPathDiagram::reactions() {
int i, npaths = nPaths();
size_t i, npaths = nPaths();
doublereal flmax = 0.0, flxratio;
Path* p;
for (i = 0; i < npaths; i++)
@ -145,8 +144,8 @@ namespace Cantera {
}
}
vector_int r;
map<int, int>::const_iterator begin = m_rxns.begin();
for (; begin != m_rxns.end(); ++begin) r.push_back(abs(begin->first));
map<size_t, int>::const_iterator begin = m_rxns.begin();
for (; begin != m_rxns.end(); ++begin) r.push_back(int(begin->first));
return r;
}
@ -157,8 +156,8 @@ namespace Cantera {
// throw CanteraError("ReactionPathDiagram::add",
// "number of nodes must be the same");
// }
int np = nPaths();
int n, k1, k2;
size_t np = nPaths();
size_t n, k1, k2;
Path* p = 0;
for (n = 0; n < np; n++) {
p = path(n);
@ -170,8 +169,8 @@ namespace Cantera {
void ReactionPathDiagram::findMajorPaths(doublereal athreshold, int lda,
doublereal* a) {
int nn = nNodes();
int n, m, k1, k2;
size_t nn = nNodes();
size_t n, m, k1, k2;
doublereal fl, netmax = 0.0;
for (n = 0; n < nn; n++) {
for (m = n+1; m < nn; m++) {
@ -194,8 +193,8 @@ namespace Cantera {
void ReactionPathDiagram::writeData(ostream& s) {
doublereal f1, f2;
int nnodes = nNodes();
int i1, i2, k1, k2;
size_t nnodes = nNodes();
size_t i1, i2, k1, k2;
s << title << endl;
for (i1 = 0; i1 < nnodes; i1++)
{
@ -236,7 +235,6 @@ namespace Cantera {
*/
void ReactionPathDiagram::exportToDot(ostream& s)
{
int i;
doublereal flxratio, flmax = 0.0, lwidth;
//s.flags(std::ios_base::showpoint+std::ios_base::fixed);
s.precision(3);
@ -258,11 +256,9 @@ namespace Cantera {
if (dot_options != "")
s << dot_options << endl;
int npaths = nPaths();
Path* p;
int nnodes = nNodes();
int kbegin, kend, i1, i2, k1, k2;
size_t kbegin, kend, i1, i2, k1, k2;
doublereal flx;
// draw paths representing net flows
@ -273,11 +269,11 @@ namespace Cantera {
// net flows by the maximum net flow
if (scale <= 0.0)
{
for (i1 = 0; i1 < nnodes; i1++)
for (i1 = 0; i1 < nNodes(); i1++)
{
k1 = m_speciesNumber[i1];
node(k1)->visible = false;
for (i2 = i1+1; i2 < nnodes; i2++)
for (i2 = i1+1; i2 < nNodes(); i2++)
{
k2 = m_speciesNumber[i2];
flx = netFlow(k1, k2);
@ -293,14 +289,14 @@ namespace Cantera {
// loop over all unique pairs of nodes
for (i1 = 0; i1 < nnodes; i1++)
for (i1 = 0; i1 < nNodes(); i1++)
{
k1 = m_speciesNumber[i1];
for (i2 = i1+1; i2 < nnodes; i2++)
for (i2 = i1+1; i2 < nNodes(); i2++)
{
k2 = m_speciesNumber[i2];
flx = netFlow(k1, k2);
if (m_local >= 0) {
if (m_local != -1) {
if (k1 != m_local && k2 != m_local) flx = 0.0;
}
if (flx != 0.0)
@ -378,16 +374,16 @@ namespace Cantera {
}
else {
for (i = 0; i < npaths; i++)
for (size_t i = 0; i < nPaths(); i++)
{
p = path(i);
if (p->flow() > flmax) flmax = p->flow();
}
for (i = 0; i < npaths; i++) {
for (size_t i = 0; i < nPaths(); i++) {
p = path(i);
flxratio = p->flow()/flmax;
if (m_local >= 0) {
if (m_local != -1) {
if (p->begin()->number != m_local
&& p->end()->number != m_local) flxratio = 0.0;
}
@ -430,7 +426,7 @@ namespace Cantera {
}
}
s.precision(2);
map<int, SpeciesNode*>::const_iterator b = m_nodes.begin();
map<size_t, SpeciesNode*>::const_iterator b = m_nodes.begin();
for (; b != m_nodes.end(); ++b) {
if (b->second->visible) {
s << "s" << b->first << " [ fontname=\""+m_font+"\", label=\"" << b->second->name
@ -444,7 +440,7 @@ namespace Cantera {
}
void ReactionPathDiagram::addNode(int k, string nm, doublereal x) {
void ReactionPathDiagram::addNode(size_t k, string nm, doublereal x) {
if (!m_nodes[k]) {
m_nodes[k] = new SpeciesNode;
m_nodes[k]->number = k;
@ -454,7 +450,7 @@ namespace Cantera {
}
}
void ReactionPathDiagram::linkNodes(int k1, int k2, int rxn,
void ReactionPathDiagram::linkNodes(size_t k1, size_t k2, size_t rxn,
doublereal value, string legend) {
SpeciesNode* begin = m_nodes[k1];
SpeciesNode* end = m_nodes[k2];
@ -469,7 +465,7 @@ namespace Cantera {
if (ff->flow() > m_flxmax) m_flxmax = ff->flow();
}
vector_int ReactionPathDiagram::species(){
std::vector<size_t> ReactionPathDiagram::species(){
return m_speciesNumber;
}
@ -491,8 +487,8 @@ namespace Cantera {
const std::vector<size_t>& r = s.reactants(i);
const std::vector<size_t>& p = s.products(i);
size_t nr = s.reactants(i).size();
size_t np = s.products(i).size();
size_t nr = r.size();
size_t np = p.size();
Group b0, b1, bb;
@ -517,12 +513,12 @@ namespace Cantera {
// loop over reactants
for (size_t igr = 0; igr < nrg; igr++) {
kr = r[igr];
ngrpr = static_cast<int>(rgroups[igr].size());
ngrpr = rgroups[igr].size();
// loop over products
for (size_t igp = 0; igp < npg; igp++) {
kp = p[igp];
ngrpp = static_cast<int>(pgroups[igp].size());
ngrpp = pgroups[igp].size();
// loop over pairs of reactant and product groups
for (size_t kgr = 0; kgr < ngrpr; kgr++) {
@ -781,7 +777,7 @@ namespace Cantera {
vector_int comp(m_nel);
m_sgroup.resize(m_ns);
for (size_t 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 (size_t m = 0; m < m_nel; m++) comp[m] = int(m_atoms(j,m)); //ph.nAtoms(j,m));
m_sgroup[j] = Group(comp);
}
@ -841,7 +837,7 @@ namespace Cantera {
{
doublereal f, ropf, ropr, fwd, rev;
string fwdlabel, revlabel;
map<int, int> warn;
map<size_t, int> warn;
doublereal threshold = 0.0;
bool fwd_incl, rev_incl, force_incl;
@ -975,10 +971,10 @@ namespace Cantera {
}
}
if (fwd_incl) {
r.linkNodes(kkr, kkp, i, fwd, fwdlabel);
r.linkNodes(kkr, kkp, int(i), fwd, fwdlabel);
}
if (rev_incl) {
r.linkNodes(kkp, kkr, -i, rev, revlabel);
r.linkNodes(kkp, kkr, -int(i), rev, revlabel);
}
}
}

View file

@ -40,7 +40,7 @@ namespace Cantera {
virtual ~SpeciesNode() {}
// public attributes
int number; ///< Species number
size_t number; ///< Species number
std::string name; ///< Label on graph
doublereal value; ///< May be used to set node appearance
bool visible; ///< Visible on graph;
@ -84,7 +84,7 @@ namespace Cantera {
public:
typedef std::map<int, doublereal> rxn_path_map;
typedef std::map<size_t, doublereal> rxn_path_map;
/**
* Constructor. Construct a one-way path from
@ -95,7 +95,7 @@ namespace Cantera {
/// Destructor
virtual ~Path() {}
void addReaction(int rxnNumber, doublereal value, std::string label = "");
void addReaction(size_t rxnNumber, doublereal value, std::string label = "");
/// Upstream node.
const SpeciesNode* begin() const { return m_a; }
@ -151,49 +151,51 @@ namespace Cantera {
doublereal maxFlow() { return m_flxmax; }
/// The net flow from node \c k1 to node \c k2
doublereal netFlow(int k1, int k2) {
doublereal netFlow(size_t k1, size_t k2) {
return flow(k1, k2) - flow(k2, k1);
}
/// The one-way flow from node \c k1 to node \c k2
doublereal flow(int k1, int k2) {
doublereal flow(size_t k1, size_t k2) {
return (m_paths[k1][k2] ? m_paths[k1][k2]->flow() : 0.0);
}
/// True if a node for species k exists
bool hasNode(int k) {
bool hasNode(size_t k) {
return (m_nodes[k] != 0);
}
void writeData(std::ostream& s);
void exportToDot(std::ostream& s);
void add(ReactionPathDiagram& d);
SpeciesNode* node(int k) { return m_nodes[k]; }
Path* path(int k1, int k2) { return m_paths[k1][k2]; }
Path* path(int n) { return m_pathlist[n]; }
int nPaths() { return static_cast<int>(m_pathlist.size()); }
int nNodes() { return static_cast<int>(m_nodes.size()); }
SpeciesNode* node(size_t k) { return m_nodes[k]; }
Path* path(size_t k1, size_t k2) { return m_paths[k1][k2]; }
Path* path(size_t n) { return m_pathlist[n]; }
size_t nPaths() { return m_pathlist.size(); }
size_t nNodes() { return m_nodes.size(); }
void addNode(int k, std::string nm, doublereal x = 0.0);
void addNode(size_t k, std::string nm, doublereal x = 0.0);
void displayOnly(int k=-1) { m_local = k; }
void displayOnly(size_t k=-1) { m_local = k; }
void linkNodes(int k1, int k2, int rxn, doublereal value,
void linkNodes(size_t k1, size_t k2, size_t rxn, doublereal value,
std::string legend = "");
void include(std::string aaname) { m_include.push_back(aaname); }
void exclude(std::string aaname) { m_exclude.push_back(aaname); }
void include(std::vector<std::string>& names) {
int n = static_cast<int>(names.size());
for (int i = 0; i < n; i++) m_include.push_back(names[i]);
for (size_t i = 0; i < names.size(); i++) {
m_include.push_back(names[i]);
}
}
void exclude(std::vector<std::string>& names) {
int n = static_cast<int>(names.size());
for (int i = 0; i < n; i++) m_exclude.push_back(names[i]);
for (size_t i = 0; i < names.size(); i++) {
m_exclude.push_back(names[i]);
}
}
std::vector<std::string>& included() { return m_include; }
std::vector<std::string>& excluded() { return m_exclude; }
vector_int species();
std::vector<size_t> species();
vector_int reactions();
void findMajorPaths(doublereal threshold, int lda, doublereal* a);
void setFont(std::string font) {
@ -220,14 +222,14 @@ namespace Cantera {
protected:
doublereal m_flxmax;
std::map<int, std::map<int, Path*> > m_paths;
std::map<int, SpeciesNode*> m_nodes;
std::map<size_t, std::map<size_t, Path*> > m_paths;
std::map<size_t, SpeciesNode*> m_nodes;
std::vector<Path*> m_pathlist;
std::vector<std::string> m_include;
std::vector<std::string> m_exclude;
vector_int m_speciesNumber;
std::map<int, int> m_rxns;
int m_local;
std::vector<size_t> m_speciesNumber;
std::map<size_t, int> m_rxns;
size_t m_local;
};

View file

@ -41,7 +41,7 @@ namespace Cantera {
void ReactionStoichMgr::
add(int rxn, const std::vector<size_t>& reactants,
add(size_t rxn, const std::vector<size_t>& reactants,
const std::vector<size_t>& products,
bool reversible) {
@ -55,7 +55,7 @@ namespace Cantera {
void ReactionStoichMgr::
add(int rxn, const ReactionData& r) {
add(size_t rxn, const ReactionData& r) {
std::vector<size_t> rk;
doublereal frac;
@ -151,7 +151,7 @@ namespace Cantera {
}
void ReactionStoichMgr::
getReactionDelta(int nr, const doublereal* g, doublereal* dg) {
getReactionDelta(size_t nr, const doublereal* g, doublereal* dg) {
fill(dg, dg + nr, 0.0);
// products add
m_revproducts->incrementReactions(g, dg);
@ -161,7 +161,7 @@ namespace Cantera {
}
void ReactionStoichMgr::
getRevReactionDelta(int nr, const doublereal* g, doublereal* dg) {
getRevReactionDelta(size_t nr, const doublereal* g, doublereal* dg) {
fill(dg, dg + nr, 0.0);
m_revproducts->incrementReactions(g, dg);
m_reactants->decrementReactions(g, dg);

View file

@ -89,7 +89,7 @@ namespace Cantera {
* @param products vector of integer product indices
* @param reversible true if the reaction is reversible, false otherwise
*/
virtual void add(int rxn, const std::vector<size_t>& reactants,
virtual void add(size_t rxn, const std::vector<size_t>& reactants,
const std::vector<size_t>& products, bool reversible);
/**
@ -109,7 +109,7 @@ namespace Cantera {
// bool reversible, const vector_fp& fwdOrder);
virtual void add(int rxn, const ReactionData& r);
virtual void add(size_t rxn, const ReactionData& r);
/**
* Species creation rates.
@ -181,7 +181,7 @@ namespace Cantera {
* An example would be the delta change in enthalpy,
* i.e., the enthalpy of reaction.
*/
virtual void getReactionDelta(int nReactions,
virtual void getReactionDelta(size_t nReactions,
const doublereal* g,
doublereal* dg);
@ -198,7 +198,7 @@ namespace Cantera {
* calculating reveerse rate coefficients from thermochemistry
* for reversible reactions.
*/
virtual void getRevReactionDelta(int nr, const doublereal* g, doublereal* dg);
virtual void getRevReactionDelta(size_t nr, const doublereal* g, doublereal* dg);
/**

View file

@ -201,7 +201,7 @@ namespace Cantera {
{
}
SurfaceArrhenius( int csize, const doublereal* c ) :
SurfaceArrhenius(size_t csize, const doublereal* c ) :
m_b (c[1]),
m_E (c[2]),
m_A (c[0]),
@ -217,14 +217,14 @@ namespace Cantera {
m_logA = log(c[0]);
}
if (csize >= 7) {
for (int n = 3; n < csize-3; n += 4) {
addCoverageDependence(int(c[n]),
for (size_t n = 3; n < csize-3; n += 4) {
addCoverageDependence(size_t(c[n]),
c[n+1], c[n+2], c[n+3]);
}
}
}
void addCoverageDependence(int k, doublereal a,
void addCoverageDependence(size_t k, doublereal a,
doublereal m, doublereal e) {
m_ncov++;
m_sp.push_back(k);
@ -241,14 +241,14 @@ namespace Cantera {
m_acov = 0.0;
m_ecov = 0.0;
m_mcov = 0.0;
int n, k;
size_t k;
doublereal th;
for (n = 0; n < m_ncov; n++) {
for (size_t n = 0; n < m_ncov; n++) {
k = m_sp[n];
m_acov += m_ac[n] * theta[k];
m_ecov += m_ec[n] * theta[k];
}
for (n = 0; n < m_nmcov; n++) {
for (size_t n = 0; n < m_nmcov; n++) {
k = m_msp[n];
// changed n to k, dgg 1/22/04
th = fmaxx(theta[k], Tiny);
@ -290,7 +290,7 @@ namespace Cantera {
doublereal m_acov, m_ecov, m_mcov;
vector_int m_sp, m_msp;
vector_fp m_ac, m_ec, m_mc;
int m_ncov, m_nmcov;
size_t m_ncov, m_nmcov;
};
@ -363,7 +363,7 @@ namespace Cantera {
m_A(0.0) {}
//! Constructor with Arrhenius parameters specified with an array.
ExchangeCurrent(int csize, const doublereal* c) :
ExchangeCurrent(size_t csize, const doublereal* c) :
m_b (c[1]),
m_E (c[2]),
m_A (c[0])

View file

@ -226,7 +226,7 @@ namespace Cantera {
C2(size_t rxn = 0, size_t ic0 = 0, size_t ic1 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {}
int data(std::vector<size_t>& ic) {
size_t data(std::vector<size_t>& ic) {
ic.resize(2);
ic[0] = m_ic0;
ic[1] = m_ic1;
@ -304,7 +304,7 @@ namespace Cantera {
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) {}
int data(std::vector<size_t>& ic) {
size_t data(std::vector<size_t>& ic) {
ic.resize(3);
ic[0] = m_ic0;
ic[1] = m_ic1;

View file

@ -24,10 +24,10 @@ namespace Cantera {
ThirdBodyMgr<_E>() : m_n(0) {}
void install( int rxnNumber, const std::map<int, doublereal>& enhanced,
void install(size_t rxnNumber, const std::map<size_t, doublereal>& enhanced,
doublereal dflt=1.0) {
m_n++;
m_reaction_index.push_back( rxnNumber );
m_reaction_index.push_back(rxnNumber);
m_concm.push_back( _E(static_cast<int>(enhanced.size()),
enhanced, dflt ) );
}
@ -54,7 +54,7 @@ namespace Cantera {
protected:
int m_n;
vector_int m_reaction_index;
std::vector<size_t> m_reaction_index;
std::vector<_E> m_concm;
};

View file

@ -49,7 +49,7 @@ namespace Cantera {
//! string vector of ints
std::vector<int> m_dup;
//! string vector of ints
std::vector<int> m_nr;
std::vector<size_t> m_nr;
//! string vector of ints
std::vector<int> m_typ;
//! vector of bools.
@ -107,8 +107,7 @@ namespace Cantera {
// << " atoms of " << ph.elementName(m) << " and kstoich = " << kstoich << endl;
}
}
int nr = rdata.reactants.size();
for (size_t index = 0; index < nr; index++) {
for (size_t index = 0; index < rdata.reactants.size(); index++) {
size_t kr = rdata.reactants[index];
size_t n = kin.speciesPhaseIndex(kr);
//klocal = kr - kin.start(n);
@ -485,13 +484,11 @@ namespace Cantera {
vector<string> key, val;
getPairs(eff, key, val);
int ne = static_cast<int>(key.size());
string nm;
string phse = kin.thermo(0).id();
int n, k;
for (n = 0; n < ne; n++) { // ; bb != ee; ++bb) {
for (size_t n = 0; n < key.size(); n++) { // ; bb != ee; ++bb) {
nm = key[n];// bb->first;
k = kin.kineticsSpeciesIndex(nm, phse);
size_t k = kin.kineticsSpeciesIndex(nm, phse);
rdata.thirdBodyEfficiencies[k] = fpValue(val[n]); // bb->second;
}
}
@ -761,9 +758,8 @@ namespace Cantera {
* the bool isReversibleWithFrac to true.
*/
if (rdata.reversible == true) {
int np = rdata.products.size();
for (int i = 0; i < np; i++) {
int k = rdata.products[i];
for (size_t i = 0; i < rdata.products.size(); i++) {
size_t k = rdata.products[i];
doublereal po = rdata.porder[i];
AssertTrace(po == rdata.pstoich[i]);
doublereal chk = po - 1.0 * int(po);
@ -780,9 +776,8 @@ namespace Cantera {
}
}
int nr = rdata.reactants.size();
for (int i = 0; i < nr; i++) {
int k = rdata.reactants[i];
for (size_t i = 0; i < rdata.reactants.size(); i++) {
size_t k = rdata.reactants[i];
doublereal ro = rdata.rorder[i];
AssertTrace(ro == rdata.rstoich[i]);
doublereal chk = ro - 1.0 * int(ro);
@ -837,17 +832,14 @@ namespace Cantera {
map<int, doublereal> rxnstoich;
rxnstoich.clear();
int nr = rdata.reactants.size();
for (nn = 0; nn < nr; nn++) {
rxnstoich[-1 - rdata.reactants[nn]] -= rdata.rstoich[nn];
for (nn = 0; nn < rdata.reactants.size(); nn++) {
rxnstoich[-1 - int(rdata.reactants[nn])] -= rdata.rstoich[nn];
}
int np = rdata.products.size();
for (nn = 0; nn < np; nn++) {
rxnstoich[rdata.products[nn]+1] += rdata.pstoich[nn];
for (nn = 0; nn < rdata.products.size(); nn++) {
rxnstoich[int(rdata.products[nn])+1] += rdata.pstoich[nn];
}
int nrxns = static_cast<int>(m_rdata.size());
for (nn = 0; nn < nrxns; nn++) {
if ((int(rdata.reactants.size()) == m_nr[nn])
for (nn = 0; nn < m_rdata.size(); nn++) {
if ((rdata.reactants.size() == m_nr[nn])
&& (rdata.reactionType == m_typ[nn])) {
c = isDuplicateReaction(rxnstoich, m_rdata[nn]);
if (c > 0.0

View file

@ -27,8 +27,8 @@ namespace Cantera {
* STATIC ROUTINES DEFINED IN THIS FILE
***************************************************************************/
static doublereal calc_damping(doublereal *x, doublereal *dx, int dim, int *);
static doublereal calcWeightedNorm(const doublereal [], const doublereal dx[], int);
static doublereal calc_damping(doublereal *x, doublereal *dx, size_t dim, int *);
static doublereal calcWeightedNorm(const doublereal [], const doublereal dx[], size_t);
/***************************************************************************
* LAPACK PROTOTYPES
@ -73,10 +73,10 @@ namespace Cantera {
{
m_numSurfPhases = 0;
int numPossibleSurfPhases = m_objects.size();
for (int n = 0; n < numPossibleSurfPhases; n++) {
size_t numPossibleSurfPhases = m_objects.size();
for (size_t n = 0; n < numPossibleSurfPhases; n++) {
InterfaceKinetics *m_kin = m_objects[n];
int surfPhaseIndex = m_kin->surfacePhaseIndex();
size_t surfPhaseIndex = m_kin->surfacePhaseIndex();
if (surfPhaseIndex >= 0) {
m_numSurfPhases++;
m_indexKinObjSurfPhase.push_back(n);
@ -94,7 +94,7 @@ namespace Cantera {
}
m_ptrsSurfPhase.push_back(sp);
int nsp = sp->nSpecies();
size_t nsp = sp->nSpecies();
m_nSpeciesSurfPhase.push_back(nsp);
m_numTotSurfSpecies += nsp;
@ -148,14 +148,14 @@ namespace Cantera {
m_kinObjIndex.resize(m_numTotSurfSpecies + m_numTotBulkSpeciesSS, 0);
m_eqnIndexStartSolnPhase.resize(m_numSurfPhases + m_numBulkPhasesSS, 0);
int kindexSP = 0;
int isp, k, nsp, kstart;
size_t kindexSP = 0;
size_t isp, k, nsp, kstart;
for (isp = 0; isp < m_numSurfPhases; isp++) {
int iKinObject = m_indexKinObjSurfPhase[isp];
size_t iKinObject = m_indexKinObjSurfPhase[isp];
InterfaceKinetics *m_kin = m_objects[iKinObject];
int surfPhaseIndex = m_kinObjPhaseIDSurfPhase[isp];
size_t surfPhaseIndex = m_kinObjPhaseIDSurfPhase[isp];
kstart = m_kin->kineticsSpeciesIndex(0, surfPhaseIndex);
nsp = m_nSpeciesSurfPhase[isp];
nsp = m_nSpeciesSurfPhase[isp];
m_eqnIndexStartSolnPhase[isp] = kindexSP;
for (k = 0; k < nsp; k++, kindexSP++) {
m_kinSpecIndex[kindexSP] = kstart + k;
@ -178,7 +178,7 @@ namespace Cantera {
}
// Dimension solution vector
int dim1 = MAX(1, m_neq);
size_t dim1 = MAX(1, m_neq);
m_CSolnSP.resize(dim1, 0.0);
m_CSolnSPInit.resize(dim1, 0.0);
m_CSolnSPOld.resize(dim1, 0.0);
@ -189,7 +189,7 @@ namespace Cantera {
m_Jac.resize(dim1, dim1, 0.0);
m_JacCol.resize(dim1, 0);
for (int k = 0; k < dim1; k++) {
for (size_t k = 0; k < dim1; k++) {
m_JacCol[k] = m_Jac.ptrColumn(k);
}
}
@ -258,11 +258,11 @@ namespace Cantera {
* Store the initial guess for the surface problem in the soln vector,
* CSoln, and in an separate vector CSolnInit.
*/
int loc = 0;
for (int n = 0; n < m_numSurfPhases; n++) {
size_t loc = 0;
for (size_t n = 0; n < m_numSurfPhases; n++) {
SurfPhase *sf_ptr = m_ptrsSurfPhase[n];
sf_ptr->getConcentrations(DATA_PTR(m_numEqn1));
int nsp = m_nSpeciesSurfPhase[n];
size_t nsp = m_nSpeciesSurfPhase[n];
for (k = 0; k <nsp; k++) {
m_CSolnSP[loc] = m_numEqn1[k];
loc++;
@ -546,8 +546,8 @@ namespace Cantera {
* Update the surface states of the surface phases.
*/
void solveSP::updateState(const doublereal *CSolnSP) {
int loc = 0;
for (int n = 0; n < m_numSurfPhases; n++) {
size_t loc = 0;
for (size_t n = 0; n < m_numSurfPhases; n++) {
m_ptrsSurfPhase[n]->setConcentrations(CSolnSP + loc);
loc += m_nSpeciesSurfPhase[n];
}
@ -563,8 +563,8 @@ namespace Cantera {
* Update the mole fractions for phases which are part of the equation set
*/
void solveSP::updateMFSolnSP(doublereal *XMolSolnSP) {
for (int isp = 0; isp < m_numSurfPhases; isp++) {
int keqnStart = m_eqnIndexStartSolnPhase[isp];
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
size_t keqnStart = m_eqnIndexStartSolnPhase[isp];
m_ptrsSurfPhase[isp]->getMoleFractions(XMolSolnSP + keqnStart);
}
//if (m_bulkFunc == BULK_DEPOSITION) {
@ -581,9 +581,9 @@ namespace Cantera {
*/
void solveSP::updateMFKinSpecies(doublereal *XMolKinSpecies, int isp) {
InterfaceKinetics *m_kin = m_objects[isp];
int nph = m_kin->nPhases();
for (int iph = 0; iph < nph; iph++) {
int ksi = m_kin->kineticsSpeciesIndex(0, iph);
size_t nph = m_kin->nPhases();
for (size_t iph = 0; iph < nph; iph++) {
size_t ksi = m_kin->kineticsSpeciesIndex(0, iph);
ThermoPhase &thref = m_kin->thermo(iph);
thref.getMoleFractions(XMolKinSpecies + ksi);
}
@ -594,13 +594,13 @@ namespace Cantera {
* surface phase.
*/
void solveSP::evalSurfLarge(const doublereal *CSolnSP) {
int kindexSP = 0;
for (int isp = 0; isp < m_numSurfPhases; isp++) {
int nsp = m_nSpeciesSurfPhase[isp];
size_t kindexSP = 0;
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
size_t nsp = m_nSpeciesSurfPhase[isp];
doublereal Clarge = CSolnSP[kindexSP];
m_spSurfLarge[isp] = 0;
kindexSP++;
for (int k = 1; k < nsp; k++, kindexSP++) {
for (size_t k = 1; k < nsp; k++, kindexSP++) {
if (CSolnSP[kindexSP] > Clarge) {
Clarge = CSolnSP[kindexSP];
m_spSurfLarge[isp] = k;
@ -623,7 +623,7 @@ namespace Cantera {
const doublereal *CSolnOld, const bool do_time,
const doublereal deltaT)
{
int isp, nsp, kstart, k, kindexSP, kins, kspecial;
size_t isp, nsp, kstart, k, kindexSP, kins, kspecial;
doublereal lenScale = 1.0E-9;
doublereal sd = 0.0;
doublereal grRate;
@ -646,7 +646,7 @@ namespace Cantera {
for (isp = 0; isp < m_numSurfPhases; isp++) {
nsp = m_nSpeciesSurfPhase[isp];
InterfaceKinetics *kinPtr = m_objects[isp];
int surfIndex = kinPtr->surfacePhaseIndex();
size_t surfIndex = kinPtr->surfacePhaseIndex();
kstart = kinPtr->kineticsSpeciesIndex(0, surfIndex);
kins = kindexSP;
kinPtr->getNetProductionRates(DATA_PTR(m_netProductionRatesSave));
@ -668,7 +668,7 @@ namespace Cantera {
for (isp = 0; isp < m_numSurfPhases; isp++) {
nsp = m_nSpeciesSurfPhase[isp];
InterfaceKinetics *kinPtr = m_objects[isp];
int surfIndex = kinPtr->surfacePhaseIndex();
size_t surfIndex = kinPtr->surfacePhaseIndex();
kstart = kinPtr->kineticsSpeciesIndex(0, surfIndex);
kins = kindexSP;
kinPtr->getNetProductionRates(DATA_PTR(m_netProductionRatesSave));
@ -691,7 +691,7 @@ namespace Cantera {
//ThermoPhase *THptr = m_bulkPhasePtrs[isp];
//THptr->getMoleFractions(XBlk);
nsp = m_nSpeciesSurfPhase[isp];
int surfPhaseIndex = m_indexKinObjSurfPhase[isp];
size_t surfPhaseIndex = m_indexKinObjSurfPhase[isp];
InterfaceKinetics *m_kin = m_objects[isp];
grRate = 0.0;
kstart = m_kin->kineticsSpeciesIndex(0, surfPhaseIndex);
@ -745,7 +745,7 @@ namespace Cantera {
const doublereal CSolnOld[], const bool do_time,
const doublereal deltaT)
{
int kColIndex = 0, nsp, jsp, i, kCol;
size_t kColIndex = 0, nsp, jsp, i, kCol;
doublereal dc, cSave, sd;
doublereal *col_j;
/*
@ -795,7 +795,7 @@ namespace Cantera {
#define APPROACH 0.80
static doublereal calc_damping(doublereal x[], doublereal dxneg[], int dim, int *label)
static doublereal calc_damping(doublereal x[], doublereal dxneg[], size_t dim, int *label)
/* This function calculates a damping factor for the Newton iteration update
* vector, dxneg, to insure that all site and bulk fractions, x, remain
@ -809,13 +809,12 @@ namespace Cantera {
*/
{
int i;
doublereal damp = 1.0, xnew, xtop, xbot;
static doublereal damp_old = 1.0;
*label = -1;
for (i = 0; i < dim; i++) {
for (size_t i = 0; i < dim; i++) {
/*
* Calculate the new suggested new value of x[i]
@ -833,14 +832,14 @@ namespace Cantera {
xbot = fabs(x[i]*0.1) - 1.0e-16;
if (xnew > xtop ) {
damp = - APPROACH * (1.0 - x[i]) / dxneg[i];
*label = i;
*label = int(i);
}
else if (xnew < xbot) {
damp = APPROACH * x[i] / dxneg[i];
*label = i;
*label = int(i);
} else if (xnew > 3.0*MAX(x[i], 1.0E-10)) {
damp = - 2.0 * MAX(x[i], 1.0E-10) / dxneg[i];
*label = i;
*label = int(i);
}
}
@ -870,11 +869,11 @@ namespace Cantera {
* This function calculates the norm of an update, dx[],
* based on the weighted values of x.
*/
static doublereal calcWeightedNorm(const doublereal wtX[], const doublereal dx[], int dim) {
static doublereal calcWeightedNorm(const doublereal wtX[], const doublereal dx[], size_t dim) {
doublereal norm = 0.0;
doublereal tmp;
if (dim == 0) return 0.0;
for (int i = 0; i < dim; i++) {
for (size_t i = 0; i < dim; i++) {
tmp = dx[i] / wtX[i];
norm += tmp * tmp;
}
@ -890,7 +889,7 @@ namespace Cantera {
const Array2D &Jac, const doublereal CSoln[],
const doublereal abstol, const doublereal reltol)
{
int k, jcol, kindex, isp, nsp;
size_t k, jcol, kindex, isp, nsp;
doublereal sd;
/*
* First calculate the weighting factor for the concentrations of
@ -942,13 +941,13 @@ namespace Cantera {
calc_t(doublereal netProdRateSolnSP[], doublereal XMolSolnSP[],
int *label, int *label_old, doublereal *label_factor, int ioflag)
{
int k, isp, nsp, kstart;
size_t k, isp, nsp, kstart;
doublereal inv_timeScale = 1.0E-10;
doublereal sden, tmp;
int kindexSP = 0;
size_t kindexSP = 0;
*label = 0;
int ispSpecial = 0;
int kspSpecial = 0;
size_t ispSpecial = 0;
size_t kspSpecial = 0;
updateMFSolnSP(XMolSolnSP);
for (isp = 0; isp < m_numSurfPhases; isp++) {
nsp = m_nSpeciesSurfPhase[isp];
@ -958,7 +957,7 @@ namespace Cantera {
// Calcuate the start of the species index for surfaces within
// the InterfaceKinetics object
int surfIndex = m_kin->surfacePhaseIndex();
size_t surfIndex = m_kin->surfacePhaseIndex();
kstart = m_kin->kineticsSpeciesIndex(0, surfIndex);
ThermoPhase& THref = m_kin->thermo(surfIndex);
@ -966,7 +965,7 @@ namespace Cantera {
sden = THref.molarDensity();
for (k = 0; k < nsp; k++, kindexSP++) {
int kspindex = kstart + k;
size_t kspindex = kstart + k;
netProdRateSolnSP[kindexSP] = m_numEqn1[kspindex];
if (XMolSolnSP[kindexSP] <= 1.0E-10) {
tmp = 1.0E-10;
@ -978,7 +977,7 @@ namespace Cantera {
if (netProdRateSolnSP[kindexSP]> 0.0) tmp /= 100.;
if (tmp > inv_timeScale) {
inv_timeScale = tmp;
*label = kindexSP;
*label = int(kindexSP);
ispSpecial = isp;
kspSpecial = k;
}
@ -1002,7 +1001,7 @@ namespace Cantera {
printf("Delta_t increase due to repeated controlling species = %e\n",
*label_factor);
}
int kkin = m_kinSpecIndex[*label];
size_t kkin = m_kinSpecIndex[*label];
InterfaceKinetics *m_kin = m_objects[ispSpecial];
string sn = m_kin->kineticsSpeciesName(kkin);
printf("calc_t: spec=%d(%s) sf=%e pr=%e dt=%e\n",
@ -1193,13 +1192,13 @@ namespace Cantera {
void solveSP::printIteration(int ioflag, doublereal damp, int label_d,
int label_t,
doublereal inv_t, doublereal t_real, int iter,
doublereal inv_t, doublereal t_real, size_t iter,
doublereal update_norm, doublereal resid_norm,
doublereal netProdRate[], doublereal CSolnSP[],
doublereal resid[], doublereal XMolSolnSP[],
doublereal wtSpecies[], int dim, bool do_time)
doublereal wtSpecies[], size_t dim, bool do_time)
{
int i, k;
size_t i, k;
string nm;
if (ioflag == 1) {
@ -1215,7 +1214,7 @@ namespace Cantera {
printf("%9.4e %9.4e", update_norm, resid_norm);
if (do_time) {
k = m_kinSpecIndex[label_t];
int isp = m_kinObjIndex[label_t];
size_t isp = m_kinObjIndex[label_t];
InterfaceKinetics *m_kin = m_objects[isp];
nm = m_kin->kineticsSpeciesName(k);
printf(" %-16s", nm.c_str());
@ -1224,7 +1223,7 @@ namespace Cantera {
}
if (label_d >= 0) {
k = m_kinSpecIndex[label_d];
int isp = m_kinObjIndex[label_d];
size_t isp = m_kinObjIndex[label_d];
InterfaceKinetics *m_kin = m_objects[isp];
nm = m_kin->kineticsSpeciesName(k);
printf(" %-16s", nm.c_str());
@ -1276,15 +1275,15 @@ namespace Cantera {
void solveSP::printFinal(int ioflag, doublereal damp, int label_d, int label_t,
doublereal inv_t, doublereal t_real, int iter,
doublereal inv_t, doublereal t_real, size_t iter,
doublereal update_norm, doublereal resid_norm,
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
const doublereal resid[], doublereal XMolSolnSP[],
const doublereal wtSpecies[], const doublereal wtRes[],
int dim, bool do_time,
size_t dim, bool do_time,
doublereal TKelvin, doublereal PGas)
{
int i, k;
size_t i, k;
string nm;
if (ioflag == 1) {
@ -1300,7 +1299,7 @@ namespace Cantera {
printf("%9.4e %9.4e", update_norm, resid_norm);
if (do_time) {
k = m_kinSpecIndex[label_t];
int isp = m_kinObjIndex[label_t];
size_t isp = m_kinObjIndex[label_t];
InterfaceKinetics *m_kin = m_objects[isp];
nm = m_kin->kineticsSpeciesName(k);
printf(" %-16s", nm.c_str());
@ -1309,7 +1308,7 @@ namespace Cantera {
}
if (label_d >= 0) {
k = m_kinSpecIndex[label_d];
int isp = m_kinObjIndex[label_d];
size_t isp = m_kinObjIndex[label_d];
InterfaceKinetics *m_kin = m_objects[isp];
nm = m_kin->kineticsSpeciesName(k);
printf(" %-16s", nm.c_str());

View file

@ -266,11 +266,11 @@ namespace Cantera {
//! Printing routine that gets called after every iteration
void printIteration(int ioflag, doublereal damp, int label_d, int label_t,
doublereal inv_t, doublereal t_real, int iter,
doublereal inv_t, doublereal t_real, size_t iter,
doublereal update_norm, doublereal resid_norm,
doublereal netProdRate[], doublereal CSolnSP[],
doublereal resid[], doublereal XMolSolnSP[],
doublereal wtSpecies[], int dim, bool do_time);
doublereal wtSpecies[], size_t dim, bool do_time);
//! Print a summary of the solution
@ -278,12 +278,12 @@ namespace Cantera {
*
*/
void printFinal(int ioflag, doublereal damp, int label_d, int label_t,
doublereal inv_t, doublereal t_real, int iter,
doublereal inv_t, doublereal t_real, size_t iter,
doublereal update_norm, doublereal resid_norm,
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
const doublereal resid[], doublereal XMolSolnSP[],
const doublereal wtSpecies[], const doublereal wtRes[],
int dim, bool do_time,
size_t dim, bool do_time,
doublereal TKelvin, doublereal PGas);
//! Calculate a conservative delta T to use in a pseudo-steady state
@ -434,7 +434,7 @@ namespace Cantera {
/*!
* Note, this can be zero, and frequently is
*/
int m_neq;
size_t m_neq;
//! This variable determines how the bulk phases are to be handled
/*!
@ -454,7 +454,7 @@ namespace Cantera {
* This number is equal to the number of InterfaceKinetics objects
* in the problem. (until further noted)
*/
int m_numSurfPhases;
size_t m_numSurfPhases;
//! Total number of surface species in all surface phases.
/*!
@ -462,7 +462,7 @@ namespace Cantera {
* It's equal to the sum of the number of species in each of the
* m_numSurfPhases.
*/
int m_numTotSurfSpecies;
size_t m_numTotSurfSpecies;
//! Mapping between the surface phases and the InterfaceKinetics objects
/*!
@ -470,14 +470,14 @@ namespace Cantera {
* in some places)
* m_surfKinObjID[i] = i
*/
std::vector<int> m_indexKinObjSurfPhase;
std::vector<size_t> m_indexKinObjSurfPhase;
//! Vector of length number of surface phases containing
//! the number of surface species in each phase
/*!
* Length is equal to the number of surface phases, m_numSurfPhases
*/
std::vector<int> m_nSpeciesSurfPhase;
std::vector<size_t> m_nSpeciesSurfPhase;
//! Vector of surface phase pointers
/*!
@ -496,7 +496,7 @@ namespace Cantera {
* i_eqn is the equation number of the first unknown in the
* solution vector corresponding to isp'th phase.
*/
std::vector<int> m_eqnIndexStartSolnPhase;
std::vector<size_t> m_eqnIndexStartSolnPhase;
//! Phase ID in the InterfaceKinetics object of the surface phase
/*!
@ -505,7 +505,7 @@ namespace Cantera {
*
* Length is equal to m_numSurfPhases
*/
std::vector<int> m_kinObjPhaseIDSurfPhase;
std::vector<size_t> m_kinObjPhaseIDSurfPhase;
//! Total number of volumetric condensed phases included in the steady state
//! problem handled by this routine.
@ -518,13 +518,13 @@ namespace Cantera {
*
* This is equal to 0, for the time being
*/
int m_numBulkPhasesSS;
size_t m_numBulkPhasesSS;
//! Vector of number of species in the m_numBulkPhases phases.
/*!
* Length is number of bulk phases
*/
std::vector<int> m_numBulkSpecies;
std::vector<size_t> m_numBulkSpecies;
//std::vector<int> m_bulkKinObjID;
//std::vector<int> m_bulkKinObjPhaseID;
@ -535,7 +535,7 @@ namespace Cantera {
* This is also the number of bulk equations to solve when bulk
* equation solving is turned on.
*/
int m_numTotBulkSpeciesSS;
size_t m_numTotBulkSpeciesSS;
//! Vector of bulk phase pointers, length is equal to m_numBulkPhases.
/*!
@ -552,14 +552,14 @@ namespace Cantera {
* ksp = m_kinSpecIndex[ieq]
* ksp is the kinetic species index for the ieq'th equation.
*/
std::vector<int> m_kinSpecIndex;
std::vector<size_t> m_kinSpecIndex;
//! Index between the equation index and the index of the
//! InterfaceKinetics object
/*!
* Length m_neq
*/
std::vector<int> m_kinObjIndex;
std::vector<size_t> m_kinObjIndex;
//! Vector containing the indecies of the largest species
//! in each surface phase
@ -572,7 +572,7 @@ namespace Cantera {
*
* length is equal to m_numSurfPhases
*/
std::vector<int> m_spSurfLarge;
std::vector<size_t> m_spSurfLarge;
//! m_atol is the absolute tolerance in real units.
/*!

View file

@ -178,7 +178,7 @@ namespace Cantera {
void CVodeInt::initialize(double t0, FuncEval& func)
{
m_neq = func.neq();
m_neq = int(func.neq());
m_t0 = t0;
if (m_y) {

View file

@ -48,7 +48,7 @@ namespace Cantera {
/**
* Number of equations.
*/
virtual int neq()=0;
virtual size_t neq()=0;
/// Number of parameters.
virtual int nparams() { return 0; }

View file

@ -200,22 +200,25 @@ namespace Cantera {
info = f_info;
}
inline void ct_dgetrf(int m, int n,
doublereal* a, int lda, integer* ipiv, int& info) {
integer mm = m;
integer nn = n;
integer ldaa = lda;
inline void ct_dgetrf(size_t m, size_t n,
doublereal* a, size_t lda, integer* ipiv, int& info) {
integer mm = (int) m;
integer nn = (int) n;
integer ldaa = (int) lda;
integer infoo = info;
_DGETRF_(&mm, &nn, a, &ldaa, ipiv, &infoo);
info = infoo;
}
inline void ct_dgetrs(ctlapack::transpose_t trans, int n,
int nrhs, doublereal* a, int lda,
integer* ipiv, doublereal* b, int ldb, int& info)
inline void ct_dgetrs(ctlapack::transpose_t trans, size_t n,
size_t nrhs, doublereal* a, size_t lda,
integer* ipiv, doublereal* b, size_t ldb, int& info)
{
integer f_n = n, f_lda = lda, f_nrhs = nrhs, f_ldb = ldb,
f_info = info;
integer f_n = (int) n;
integer f_lda = (int) lda;
integer f_nrhs = (int) nrhs;
integer f_ldb = (int) ldb;
integer f_info = info;
char tr = no_yes[trans];
#ifdef NO_FTN_STRING_LEN_AT_END

View file

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

View file

@ -174,7 +174,7 @@ namespace Cantera {
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
*/
PDSS_SSVol(VPStandardStateTP *tp, int spindex);
PDSS_SSVol(VPStandardStateTP *tp, size_t spindex);
//! Constructor that initializes the object by examining the input file
@ -189,7 +189,7 @@ namespace Cantera {
* is the empty string, in which case the first phase in the
* file is used.
*/
PDSS_SSVol(VPStandardStateTP *tp, int spindex,
PDSS_SSVol(VPStandardStateTP *tp, size_t spindex,
std::string inputFile, std::string id = "");
//! Constructor that initializes the object by examining the input file
@ -204,7 +204,7 @@ namespace Cantera {
* @param spInstalled Boolean indicating whether the species is installed yet
* or not.
*/
PDSS_SSVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode,
PDSS_SSVol(VPStandardStateTP *vptp_ptr, size_t spindex, const XML_Node& speciesNode,
const XML_Node& phaseRef, bool spInstalled);
//! Copy Constructur
@ -505,7 +505,7 @@ namespace Cantera {
* phase. If none is given, the first XML
* phase element will be used.
*/
void constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex,
void constructPDSSFile(VPStandardStateTP *vptp_ptr, size_t spindex,
std::string inputFile, std::string id);
//! Initialization of a PDSS object using an xml tree
@ -531,7 +531,7 @@ namespace Cantera {
* @param spInstalled Boolean indicating whether the species is
* already installed.
*/
void constructPDSSXML(VPStandardStateTP *vptp_ptr, int spindex,
void constructPDSSXML(VPStandardStateTP *vptp_ptr, size_t spindex,
const XML_Node& speciesNode,
const XML_Node& phaseNode, bool spInstalled);

View file

@ -166,7 +166,7 @@ namespace Cantera {
//================================================================================================
void AqueousTransport::getBinaryDiffCoeffs(const int ld, doublereal* const d) {
void AqueousTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d) {
int i,j;
update_T();
@ -200,10 +200,9 @@ namespace Cantera {
* dimensioned at least as large as the number of species.
*/
void AqueousTransport::getMobilities(doublereal* const mobil) {
int k;
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k];
}
}
@ -211,26 +210,26 @@ namespace Cantera {
void AqueousTransport::getFluidMobilities(doublereal* const mobil) {
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = 1.0 / (GasConstant * m_temp);
for (int k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k];
}
}
//================================================================================================
void AqueousTransport::set_Grad_V(const doublereal* const grad_V) {
for (int a = 0; a < m_nDim; a++) {
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_V[a] = grad_V[a];
}
}
//================================================================================================
void AqueousTransport::set_Grad_T(const doublereal* const grad_T) {
for (int a = 0; a < m_nDim; a++) {
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_T[a] = grad_T[a];
}
}
//================================================================================================
void AqueousTransport::set_Grad_X(const doublereal* const grad_X) {
int itop = m_nDim * m_nsp;
for (int i = 0; i < itop; i++) {
size_t itop = m_nDim * m_nsp;
for (size_t i = 0; i < itop; i++) {
m_Grad_X[i] = grad_X[i];
}
}
@ -246,15 +245,13 @@ namespace Cantera {
* \]
*/
doublereal AqueousTransport::thermalConductivity() {
int k;
update_T();
update_C();
if (!m_spcond_ok) updateCond_T();
if (!m_condmix_ok) {
doublereal sum1 = 0.0, sum2 = 0.0;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
sum1 += m_molefracs[k] * m_cond[k];
sum2 += m_molefracs[k] / m_cond[k];
}
@ -273,8 +270,7 @@ namespace Cantera {
* zeros.
*/
void AqueousTransport::getThermalDiffCoeffs(doublereal* const dt) {
int k;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
@ -309,29 +305,25 @@ namespace Cantera {
* \f]
*/
void AqueousTransport::getSpeciesFluxesExt(int ldf, doublereal* fluxes) {
int n, k;
update_T();
update_C();
getMixDiffCoeffs(DATA_PTR(m_spwork));
const array_fp& mw = m_thermo->molecularWeights();
const doublereal* y = m_thermo->massFractions();
doublereal rhon = m_thermo->molarDensity();
// Unroll wrt ndim
vector_fp sum(m_nDim,0.0);
for (n = 0; n < m_nDim; n++) {
for (k = 0; k < m_nsp; k++) {
for (size_t n = 0; n < m_nDim; n++) {
for (size_t k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * m_Grad_X[n*m_nsp + k];
sum[n] += fluxes[n*ldf + k];
}
}
// add correction flux to enforce sum to zero
for (n = 0; n < m_nDim; n++) {
for (k = 0; k < m_nsp; k++) {
for (size_t n = 0; n < m_nDim; n++) {
for (size_t k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] -= y[k]*sum[n];
}
}
@ -353,7 +345,7 @@ namespace Cantera {
// update the binary diffusion coefficients if necessary
if (!m_bindiff_ok) updateDiff_T();
int k, j;
size_t k, j;
doublereal mmw = m_thermo->meanMolecularWeight();
doublereal sumxw = 0.0, sum2;
doublereal p = m_press;
@ -462,8 +454,7 @@ namespace Cantera {
// add an offset to avoid a pure species condition or
// negative mole fractions. MIN_X is 1.0E-20, a value
// which is below the additive machine precision of mole fractions.
int k;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
}
@ -480,15 +471,13 @@ namespace Cantera {
* thermal conductivity.
*/
void AqueousTransport::updateCond_T() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_cond[k] = exp(dot4(m_polytempvec, m_condcoeffs[k]));
}
}
else {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_cond[k] = m_sqrt_t*dot5(m_polytempvec, m_condcoeffs[k]);
}
}
@ -504,11 +493,10 @@ namespace Cantera {
void AqueousTransport::updateDiff_T() {
// evaluate binary diffusion coefficients at unit pressure
int i,j;
int ic = 0;
size_t ic = 0;
if (m_mode == CK_Mode) {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
for (size_t i = 0; i < m_nsp; i++) {
for (size_t j = i; j < m_nsp; j++) {
m_bdiff(i,j) = exp(dot4(m_polytempvec, m_diffcoeffs[ic]));
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
@ -516,8 +504,8 @@ namespace Cantera {
}
}
else {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
for (size_t i = 0; i < m_nsp; i++) {
for (size_t j = i; j < m_nsp; j++) {
m_bdiff(i,j) = m_temp * m_sqrt_t*dot5(m_polytempvec,
m_diffcoeffs[ic]);
m_bdiff(j,i) = m_bdiff(i,j);
@ -535,16 +523,14 @@ namespace Cantera {
* Update the pure-species viscosities.
*/
void AqueousTransport::updateSpeciesViscosities() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_visc[k] = exp(dot4(m_polytempvec, m_visccoeffs[k]));
m_sqvisc[k] = sqrt(m_visc[k]);
}
}
else {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
// the polynomial fit is done for sqrt(visc/sqrt(T))
m_sqvisc[k] = m_t14*dot5(m_polytempvec, m_visccoeffs[k]);
m_visc[k] = (m_sqvisc[k]*m_sqvisc[k]);
@ -566,9 +552,8 @@ namespace Cantera {
if (!m_spvisc_ok) updateSpeciesViscosities();
// see Eq. (9-5.15) of Reid, Prausnitz, and Poling
int j, k;
for (j = 0; j < m_nsp; j++) {
for (k = j; k < m_nsp; k++) {
for (size_t j = 0; j < m_nsp; j++) {
for (size_t k = j; k < m_nsp; k++) {
vratiokj = m_visc[k]/m_visc[j];
wratiojk = m_mw[j]/m_mw[k];
@ -607,9 +592,7 @@ namespace Cantera {
*
*/
void AqueousTransport::stefan_maxwell_solve() {
int i, j, a;
int VIM = 2;
size_t VIM = 2;
m_B.resize(m_nsp, VIM);
//! grab a local copy of the molecular weights
const vector_fp& M = m_thermo->molecularWeights();
@ -630,8 +613,8 @@ namespace Cantera {
/* electrochemical potential gradient */
for (i = 0; i < m_nsp; i++) {
for (a = 0; a < VIM; a++) {
for (size_t i = 0; i < m_nsp; i++) {
for (size_t a = 0; a < VIM; a++) {
m_Grad_mu[a*m_nsp + i] = m_chargeSpecies[i] * Faraday * m_Grad_V[a]
+ (GasConstant*T/m_molefracs[i]) * m_Grad_X[a*m_nsp+i];
}
@ -644,12 +627,12 @@ namespace Cantera {
switch ( VIM ) {
case 1: /* 1-D approximation */
m_B(0,0) = 0.0;
for (j = 0; j < m_nsp; j++) {
for (size_t j = 0; j < m_nsp; j++) {
m_A(0,j) = 1.0;
}
for (i = 1; i < m_nsp; i++){
for (size_t i = 1; i < m_nsp; i++){
m_B(i,0) = m_concentrations[i] * m_Grad_mu[i] / (GasConstant * T);
for (j = 0; j < m_nsp; j++){
for (size_t j = 0; j < m_nsp; j++){
if (j != i) {
m_A(i,j) = m_molefracs[i] / ( M[j] * m_DiffCoeff_StefMax(i,j));
m_A(i,i) -= m_molefracs[j] / ( M[i] * m_DiffCoeff_StefMax(i,j));
@ -670,13 +653,13 @@ namespace Cantera {
case 2: /* 2-D approximation */
m_B(0,0) = 0.0;
m_B(0,1) = 0.0;
for (j = 0; j < m_nsp; j++) {
for (size_t j = 0; j < m_nsp; j++) {
m_A(0,j) = 1.0;
}
for (i = 1; i < m_nsp; i++){
for (size_t i = 1; i < m_nsp; i++){
m_B(i,0) = m_concentrations[i] * m_Grad_mu[i] / (GasConstant * T);
m_B(i,1) = m_concentrations[i] * m_Grad_mu[m_nsp + i] / (GasConstant * T);
for (j = 0; j < m_nsp; j++){
for (size_t j = 0; j < m_nsp; j++){
if (j != i) {
m_A(i,j) = m_molefracs[i] / ( M[j] * m_DiffCoeff_StefMax(i,j));
m_A(i,i) -= m_molefracs[j] / ( M[i] * m_DiffCoeff_StefMax(i,j));
@ -699,14 +682,14 @@ namespace Cantera {
m_B(0,0) = 0.0;
m_B(0,1) = 0.0;
m_B(0,2) = 0.0;
for (j = 0; j < m_nsp; j++) {
for (size_t j = 0; j < m_nsp; j++) {
m_A(0,j) = 1.0;
}
for (i = 1; i < m_nsp; i++){
for (size_t i = 1; i < m_nsp; i++){
m_B(i,0) = m_concentrations[i] * m_Grad_mu[i] / (GasConstant * T);
m_B(i,1) = m_concentrations[i] * m_Grad_mu[m_nsp + i] / (GasConstant * T);
m_B(i,2) = m_concentrations[i] * m_Grad_mu[2*m_nsp + i] / (GasConstant * T);
for (j = 0; j < m_nsp; j++){
for (size_t j = 0; j < m_nsp; j++){
if (j != i) {
m_A(i,j) = m_molefracs[i] / ( M[j] * m_DiffCoeff_StefMax(i,j));
m_A(i,i) -= m_molefracs[j] / ( M[i] * m_DiffCoeff_StefMax(i,j));

View file

@ -180,7 +180,7 @@ namespace Cantera {
* @param ld
* @param d
*/
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Get the Mixture diffusion coefficients
/*!
@ -327,7 +327,7 @@ namespace Cantera {
//! Number of species in the mixture
int m_nsp;
size_t m_nsp;
//! Minimum temperature applicable to the transport property eval
doublereal m_tmin;

View file

@ -229,7 +229,7 @@ namespace Cantera {
}
}
void DustyGasTransport::getMultiDiffCoeffs(const int ld, doublereal* const d) {
void DustyGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d) {
int i,j;
updateMultiDiffCoeffs();
for (i = 0; i < m_nsp; i++) {

View file

@ -44,7 +44,7 @@ namespace Cantera {
virtual void setParameters(const int type, const int k, const doublereal* const p);
virtual void getMultiDiffCoeffs(const int ld, doublereal* const d);
virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
virtual void getMolarFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
@ -110,7 +110,7 @@ namespace Cantera {
// gas attributes
int m_nsp;
size_t m_nsp;
doublereal m_tmin, m_tmax;
vector_fp m_mw;

View file

@ -284,7 +284,7 @@ namespace Cantera {
/******************* binary diffusion coefficients **************/
void LiquidTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
void LiquidTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d) {
int i,j;
update_temp();

View file

@ -222,7 +222,7 @@ namespace Cantera {
* @param ld
* @param d
*/
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Get the Mixture diffusion coefficients
/*!
@ -373,7 +373,7 @@ namespace Cantera {
//! Number of species in the mixture
int m_nsp;
size_t m_nsp;
//! Minimum temperature applicable to the transport property eval
doublereal m_tmin;

View file

@ -64,14 +64,14 @@ namespace Cantera {
m_eps = tr.eps;
m_alpha = tr.alpha;
m_dipoleDiag.resize(m_nsp);
for (int i = 0; i < m_nsp; i++) {
for (size_t i = 0; i < m_nsp; i++) {
m_dipoleDiag[i] = tr.dipole(i,i);
}
m_phi.resize(m_nsp, m_nsp, 0.0);
m_wratjk.resize(m_nsp, m_nsp, 0.0);
m_wratkj1.resize(m_nsp, m_nsp, 0.0);
int j, k;
size_t j, k;
for (j = 0; j < m_nsp; j++)
for (k = j; k < m_nsp; k++) {
m_wratjk(j,k) = sqrt(m_mw[j]/m_mw[k]);
@ -126,20 +126,18 @@ namespace Cantera {
* @see updateViscosity_T();
*/
doublereal MixTransport::viscosity() {
update_T();
update_C();
if (m_viscmix_ok) return m_viscmix;
doublereal vismix = 0.0;
int k;
// update m_visc and m_phi if necessary
if (!m_viscwt_ok) updateViscosity_T();
multiply(m_phi, DATA_PTR(m_molefracs), DATA_PTR(m_spwork));
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
vismix += m_molefracs[k] * m_visc[k]/m_spwork[k]; //denom;
}
m_viscmix = vismix;
@ -150,9 +148,7 @@ namespace Cantera {
/******************* binary diffusion coefficients **************/
void MixTransport::getBinaryDiffCoeffs(const int ld, doublereal* const d) {
int i,j;
void MixTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d) {
update_T();
// if necessary, evaluate the binary diffusion coefficents
@ -160,18 +156,17 @@ namespace Cantera {
if (!m_bindiff_ok) updateDiff_T();
doublereal rp = 1.0/pressure_ig();
for (i = 0; i < m_nsp; i++)
for (j = 0; j < m_nsp; j++) {
for (size_t i = 0; i < m_nsp; i++)
for (size_t j = 0; j < m_nsp; j++) {
d[ld*j + i] = rp * m_bdiff(i,j);
}
}
void MixTransport::getMobilities(doublereal* const mobil) {
int k;
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k] * m_thermo->charge(k);
}
}
@ -187,15 +182,13 @@ namespace Cantera {
* \]
*/
doublereal MixTransport::thermalConductivity() {
int k;
update_T();
update_C();
if (!m_spcond_ok) updateCond_T();
if (!m_condmix_ok) {
doublereal sum1 = 0.0, sum2 = 0.0;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
sum1 += m_molefracs[k] * m_cond[k];
sum2 += m_molefracs[k] / m_cond[k];
}
@ -214,8 +207,7 @@ namespace Cantera {
* zeros.
*/
void MixTransport::getThermalDiffCoeffs(doublereal* const dt) {
int k;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
@ -232,8 +224,6 @@ namespace Cantera {
void MixTransport::getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes) {
int n, k;
update_T();
update_C();
@ -244,15 +234,15 @@ namespace Cantera {
doublereal rhon = m_thermo->molarDensity();
vector_fp sum(ndim,0.0);
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
for (size_t n = 0; n < ndim; n++) {
for (size_t k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k];
sum[n] += fluxes[n*ldf + k];
}
}
// add correction flux to enforce sum to zero
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
for (size_t n = 0; n < ndim; n++) {
for (size_t k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] -= y[k]*sum[n];
}
}
@ -267,24 +257,22 @@ namespace Cantera {
* below.
*/
void MixTransport::getMixDiffCoeffs(doublereal* const d) {
update_T();
update_C();
// update the binary diffusion coefficients if necessary
if (!m_bindiff_ok) updateDiff_T();
int k, j;
doublereal mmw = m_thermo->meanMolecularWeight();
doublereal sumxw = 0.0, sum2;
doublereal p = pressure_ig();
if (m_nsp == 1) {
d[0] = m_bdiff(0,0) / p;
} else {
for (k = 0; k < m_nsp; k++) sumxw += m_molefracs[k] * m_mw[k];
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) sumxw += m_molefracs[k] * m_mw[k];
for (size_t k = 0; k < m_nsp; k++) {
sum2 = 0.0;
for (j = 0; j < m_nsp; j++) {
for (size_t j = 0; j < m_nsp; j++) {
if (j != k) {
sum2 += m_molefracs[j] / m_bdiff(j,k);
}
@ -357,8 +345,7 @@ namespace Cantera {
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
// add an offset to avoid a pure species condition
int k;
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
}
@ -375,15 +362,13 @@ namespace Cantera {
* thermal conductivity.
*/
void MixTransport::updateCond_T() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_cond[k] = exp(dot4(m_polytempvec, m_condcoeffs[k]));
}
}
else {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_cond[k] = m_sqrt_t*dot5(m_polytempvec, m_condcoeffs[k]);
}
}
@ -399,11 +384,10 @@ namespace Cantera {
void MixTransport::updateDiff_T() {
// evaluate binary diffusion coefficients at unit pressure
int i,j;
int ic = 0;
size_t ic = 0;
if (m_mode == CK_Mode) {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
for (size_t i = 0; i < m_nsp; i++) {
for (size_t j = i; j < m_nsp; j++) {
m_bdiff(i,j) = exp(dot4(m_polytempvec, m_diffcoeffs[ic]));
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
@ -411,8 +395,8 @@ namespace Cantera {
}
}
else {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
for (size_t i = 0; i < m_nsp; i++) {
for (size_t j = i; j < m_nsp; j++) {
m_bdiff(i,j) = m_temp * m_sqrt_t*dot5(m_polytempvec,
m_diffcoeffs[ic]);
m_bdiff(j,i) = m_bdiff(i,j);
@ -430,16 +414,14 @@ namespace Cantera {
* Update the pure-species viscosities.
*/
void MixTransport::updateSpeciesViscosities() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
m_visc[k] = exp(dot4(m_polytempvec, m_visccoeffs[k]));
m_sqvisc[k] = sqrt(m_visc[k]);
}
}
else {
for (k = 0; k < m_nsp; k++) {
for (size_t k = 0; k < m_nsp; k++) {
// the polynomial fit is done for sqrt(visc/sqrt(T))
m_sqvisc[k] = m_t14*dot5(m_polytempvec, m_visccoeffs[k]);
m_visc[k] = (m_sqvisc[k]*m_sqvisc[k]);
@ -461,9 +443,8 @@ namespace Cantera {
if (!m_spvisc_ok) updateSpeciesViscosities();
// see Eq. (9-5.15) of Reid, Prausnitz, and Poling
int j, k;
for (j = 0; j < m_nsp; j++) {
for (k = j; k < m_nsp; k++) {
for (size_t j = 0; j < m_nsp; j++) {
for (size_t k = j; k < m_nsp; k++) {
vratiokj = m_visc[k]/m_visc[j];
wratiojk = m_mw[j]/m_mw[k];

View file

@ -57,7 +57,7 @@ namespace Cantera {
//! returns the mixture thermal conductivity
virtual doublereal thermalConductivity();
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Mixture-averaged diffusion coefficients [m^2/s].
@ -133,7 +133,7 @@ namespace Cantera {
}
// mixture attributes
int m_nsp;
size_t m_nsp;
doublereal m_tmin, m_tmax;
vector_fp m_mw;

View file

@ -295,7 +295,7 @@ namespace Cantera {
/******************* binary diffusion coefficients **************/
void MultiTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
void MultiTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d) {
int i,j;
// if necessary, evaluate the binary diffusion coefficents
@ -671,7 +671,7 @@ namespace Cantera {
}
}
void MultiTransport::getMultiDiffCoeffs(const int ld, doublereal* const d) {
void MultiTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d) {
int i,j;
doublereal p = pressure_ig();

View file

@ -88,8 +88,8 @@ namespace Cantera {
virtual void getThermalDiffCoeffs(doublereal* const dt);
virtual doublereal thermalConductivity();
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
virtual void getMultiDiffCoeffs(const int ld, doublereal* const d);
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
//! Although this class implements a multicomponent diffusion
//! model, it is convenient to be able to compute
@ -209,7 +209,7 @@ namespace Cantera {
m_thermal_tlast;
// mixture attributes
int m_nsp;
size_t m_nsp;
doublereal m_tmin, m_tmax;
vector_fp m_mw;

View file

@ -386,7 +386,7 @@ namespace Cantera {
copy(m_viscSpecies.begin(), m_viscSpecies.end(), visc);
}
//================================================================================================
void SimpleTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
void SimpleTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d) {
int i, j;
double bdiff;
update_T();

View file

@ -222,7 +222,7 @@ namespace Cantera {
* @param ld
* @param d
*/
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Get the Mixture diffusion coefficients
/*!

View file

@ -344,7 +344,7 @@ namespace Cantera {
* @param d Diffusion coefficient matrix (must be at least m_k * m_k
* in length.
*/
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d)
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
{ err("getBinaryDiffCoeffs"); }
@ -354,7 +354,7 @@ namespace Cantera {
* model, then this method returns the array of multicomponent
* diffusion coefficients. Otherwise it throws an exception.
*/
virtual void getMultiDiffCoeffs(const int ld, doublereal* const d)
virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d)
{ err("getMultiDiffCoeffs"); }

View file

@ -37,7 +37,7 @@ namespace CanteraZeroD {
//-----------------------------------------------------
virtual int neq() { return m_nv; }
virtual size_t neq() { return m_nv; }
virtual void initialize(doublereal t0 = 0.0);
virtual void evalEqs(doublereal t, doublereal* y,

View file

@ -87,7 +87,7 @@ namespace CanteraZeroD {
}
// overloaded methods of class FuncEval
virtual int neq() { return m_nv; }
virtual size_t neq() { return m_nv; }
virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y);

View file

@ -107,7 +107,7 @@ namespace CanteraZeroD {
//-----------------------------------------------------
// overloaded methods of class FuncEval
virtual int neq() { return m_nv; }
virtual size_t neq() { return m_nv; }
virtual void eval(doublereal t, doublereal* y,
doublereal* ydot, doublereal* p);
virtual void getInitialConditions(doublereal t0, size_t leny,