From 8ed67089e5c472c475b8ac2108f119c5fdfb376a Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 26 Dec 2012 23:56:13 +0000 Subject: [PATCH] Fixed some compiler warnings in the regression tests --- test_problems/PecosTransport/PecosTransport.cpp | 4 ++-- .../dustyGasTransport/dustyGasTransportTest.cpp | 14 +++++++------- .../simpleTransport/simpleTransportTest.cpp | 12 ++++++------ .../stoichSolidKinetics/stoichSolidKinetics.cpp | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test_problems/PecosTransport/PecosTransport.cpp b/test_problems/PecosTransport/PecosTransport.cpp index af9534106..1c3bdf717 100644 --- a/test_problems/PecosTransport/PecosTransport.cpp +++ b/test_problems/PecosTransport/PecosTransport.cpp @@ -47,14 +47,14 @@ void printDbl(double val) { } int main(int argc, char** argv) { - int k; + size_t k; string infile = "diamond.xml"; try { IdealGasMix g("gri30.xml", "gri30_mix"); - int nsp = g.nSpecies(); + size_t nsp = g.nSpecies(); double pres = 1.0E5; vector_fp Xset(nsp, 0.0); Xset[0] = 0.269205 ; diff --git a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp index 5940d777e..8ca6dcf67 100644 --- a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp +++ b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp @@ -16,7 +16,7 @@ int main(int argc, char** argv) auto_ptr tran(newTransportMgr("DustyGas", g.get(), log_level)); DustyGasTransport* tranDusty = dynamic_cast(tran.get()); - int nsp = g->nSpecies(); + size_t nsp = g->nSpecies(); vector_fp multiD(nsp*nsp); double T = 500; @@ -30,8 +30,8 @@ int main(int argc, char** argv) tranDusty->getMultiDiffCoeffs(nsp, DATA_PTR(multiD)); printf("MultiDiffusion coefficients: \n"); - for (int i = 0; i < nsp; i++) { - for (int j = 0; j < nsp; j++) { + for (size_t i = 0; i < nsp; i++) { + for (size_t j = 0; j < nsp; j++) { printf(" %15.8E,", multiD[nsp*j + i]); } printf("\n"); @@ -47,12 +47,12 @@ int main(int argc, char** argv) fluxes.resize(nsp); tranDusty->getMolarFluxes(&state1[0], &state1[0], delta, &fluxes[0]); - for (int i = 0; i < nsp; i++) { - printf(" flux[%d] = %13.8E\n", i, fluxes[i]); + for (size_t i = 0; i < nsp; i++) { + printf(" flux[%d] = %13.8E\n", int(i), fluxes[i]); } tranDusty->getMolarFluxes(&state1[0], &state2[0], delta, &fluxes[0]); - for (int i = 0; i < nsp; i++) { - printf(" flux[%d] = %13.8E\n", i, fluxes[i]); + for (size_t i = 0; i < nsp; i++) { + printf(" flux[%d] = %13.8E\n", int(i), fluxes[i]); } Cantera::appdelete(); diff --git a/test_problems/simpleTransport/simpleTransportTest.cpp b/test_problems/simpleTransport/simpleTransportTest.cpp index 4f22e57a4..3d5c50779 100644 --- a/test_problems/simpleTransport/simpleTransportTest.cpp +++ b/test_problems/simpleTransport/simpleTransportTest.cpp @@ -18,7 +18,7 @@ int main(int argc, char **argv) auto_ptr tran(newDefaultTransportMgr(&HMW, log_level)); SimpleTransport& tranSimple = dynamic_cast(*tran.get()); - int nsp = HMW.nSpecies(); + size_t nsp = HMW.nSpecies(); HMW.setState_TP(30+273.13, OneAtm); @@ -28,7 +28,7 @@ int main(int argc, char **argv) vector_fp x(nsp, 0.0); tranSimple.getSpeciesViscosities(&x[0]); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { printf("sp visc (%s) = %g\n", HMW.speciesName(k).c_str(), x[k]); } @@ -36,12 +36,12 @@ int main(int argc, char **argv) printf("cond = %g\n", cond); tranSimple.getMixDiffCoeffs(&x[0]); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { printf("sp diff (%s) = %g\n", HMW.speciesName(k).c_str(), x[k]); } tranSimple.getMobilities(&x[0]); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { printf("Mobility (%s) = %g\n", HMW.speciesName(k).c_str(), x[k]); } @@ -50,7 +50,7 @@ int main(int argc, char **argv) double gradT = 0.0; tranSimple.getSpeciesFluxes(1, &gradT, 5, &gradX[0], 5, &x[0]); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { string spName = HMW.speciesName(k); printf("SpeciesFlux (%s) = %g\n", spName.c_str(), x[k]); } @@ -63,7 +63,7 @@ int main(int argc, char **argv) tranSimple.set_Grad_X(&gradX[0]); tranSimple.getSpeciesFluxesExt(5, &x[0]); - for (int k = 0; k < nsp; k++) { + for (size_t k = 0; k < nsp; k++) { printf("SpeciesFlux (%s) = %g\n", HMW.speciesName(k).c_str(), x[k]); } diff --git a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp index 11366922b..fa9300e2c 100644 --- a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp +++ b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp @@ -70,9 +70,9 @@ void testProblem() importKinetics(*xg, phaseList, &iKin); vector_fp mll(gasTP->nSpecies(), 0.0); - int igco2 = gasTP->speciesIndex("CO2"); - int igo2 = gasTP->speciesIndex("O2"); - int ign2 = gasTP->speciesIndex("N2"); + size_t igco2 = gasTP->speciesIndex("CO2"); + size_t igo2 = gasTP->speciesIndex("O2"); + size_t ign2 = gasTP->speciesIndex("N2"); mll[igco2] = 0.2; mll[igo2] = 0.1; @@ -131,13 +131,13 @@ void testProblem() printRates(iKin); cout << "*** Setting CaO(S) phase to nonexistent:" << endl; - int ip_cao = iKin.phaseIndex("CaO(S)"); + size_t ip_cao = iKin.phaseIndex("CaO(S)"); iKin.setPhaseExistence(ip_cao, false); iKin.setPhaseStability(ip_cao, true); printRates(iKin); cout << "*** Setting CaCO3(S) phase to nonexistent:" << endl; - int ip_caco3 = iKin.phaseIndex("CaCO3(S)"); + size_t ip_caco3 = iKin.phaseIndex("CaCO3(S)"); iKin.setPhaseExistence(ip_caco3, false); iKin.setPhaseStability(ip_caco3, true); printRates(iKin); @@ -147,7 +147,7 @@ void testProblem() printRates(iKin); cout << "*** Setting Gas phase to nonexistent, CaCO3 nonexistent:" << endl; - int ip_gas = iKin.phaseIndex("air"); + size_t ip_gas = iKin.phaseIndex("air"); iKin.setPhaseExistence(ip_gas, false); iKin.setPhaseStability(ip_gas, true); printRates(iKin);