From 3bff32dd557fc5f64ed67b3ea718c92935d3390d Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 7 Mar 2012 00:51:13 +0000 Subject: [PATCH] Fixed problems that generated warnings with the Intel compiler --- include/cantera/base/ct_defs.h | 2 +- include/cantera/equil/MultiPhaseEquil.h | 2 +- include/cantera/kinetics/Kinetics.h | 2 +- include/cantera/kinetics/RateCoeffMgr.h | 2 +- include/cantera/kinetics/ReactionPath.h | 4 ++-- include/cantera/oneD/Domain1D.h | 12 +++++------ include/cantera/oneD/Inlet1D.h | 2 +- include/cantera/oneD/Sim1D.h | 2 +- include/cantera/oneD/StFlow.h | 4 ++-- include/cantera/thermo/FixedChemPotSSTP.h | 4 ++-- include/cantera/thermo/GeneralSpeciesThermo.h | 6 +++--- include/cantera/thermo/PureFluidPhase.h | 2 +- include/cantera/thermo/SpeciesThermo.h | 8 ++++---- include/cantera/thermo/SpeciesThermoMgr.h | 12 +++++------ include/cantera/thermo/VPSSMgr.h | 6 +++--- include/cantera/transport/LiquidTransport.h | 2 +- include/cantera/transport/SimpleTransport.h | 4 ++-- include/cantera/transport/TransportBase.h | 4 ++-- src/base/ctml.cpp | 4 ++-- src/base/stringUtils.cpp | 2 +- src/clib/ctonedim.cpp | 8 ++++---- src/converters/ck2ct.cpp | 8 ++++---- src/converters/ckr_utils.cpp | 4 ++-- src/equil/BasisOptimize.cpp | 4 ++-- src/equil/ChemEquil.cpp | 18 ++++++++--------- src/equil/MultiPhase.cpp | 6 +++--- src/equil/vcs_DoubleStarStar.cpp | 14 ++++++------- src/equil/vcs_DoubleStarStar.h | 8 ++++---- src/equil/vcs_IntStarStar.cpp | 10 +++++----- src/equil/vcs_IntStarStar.h | 6 +++--- src/equil/vcs_MultiPhaseEquil.cpp | 6 +++--- src/equil/vcs_VolPhase.cpp | 20 +++++++++---------- src/equil/vcs_VolPhase.h | 2 +- src/equil/vcs_elem.cpp | 2 +- src/equil/vcs_elem_rearrange.cpp | 2 +- src/equil/vcs_prob.cpp | 6 +++--- src/equil/vcs_solve_TP.cpp | 16 +++++++-------- src/equil/vcs_util.cpp | 2 +- src/kinetics/ImplicitSurfChem.cpp | 4 ++-- src/kinetics/Kinetics.cpp | 10 +++++----- src/kinetics/ReactionPath.cpp | 2 +- src/kinetics/StoichManager.h | 2 +- src/numerics/BEulerInt.cpp | 4 ++-- src/numerics/BEulerInt.h | 4 ++-- src/numerics/BandMatrix.cpp | 4 ++-- src/numerics/CVodesIntegrator.cpp | 2 +- src/numerics/CVodesIntegrator.h | 2 +- src/numerics/NonlinearSolver.cpp | 8 ++++---- src/numerics/solveProb.cpp | 6 +++--- src/oneD/MultiNewton.cpp | 4 ++-- src/oneD/OneDim.cpp | 6 +++--- src/oneD/StFlow.cpp | 2 +- src/thermo/Constituents.cpp | 2 +- src/thermo/DebyeHuckel.cpp | 2 +- src/thermo/Elements.cpp | 2 +- src/thermo/FixedChemPotSSTP.cpp | 4 ++-- src/thermo/HMWSoln_input.cpp | 2 +- src/thermo/IonsFromNeutralVPSSTP.cpp | 20 +++++++++---------- src/thermo/LatticeSolidPhase.cpp | 4 ++-- src/thermo/MargulesVPSSTP.cpp | 4 ++-- src/thermo/MixedSolventElectrolyte.cpp | 4 ++-- src/thermo/MolalityVPSSTP.cpp | 14 ++++++------- src/thermo/MolarityIonicVPSSTP.cpp | 10 +++++----- src/thermo/PDSS.cpp | 2 +- src/thermo/PhaseCombo_Interaction.cpp | 4 ++-- src/thermo/PseudoBinaryVPSSTP.cpp | 4 ++-- src/thermo/PureFluidPhase.cpp | 2 +- src/thermo/SpeciesThermoInterpType.cpp | 2 +- src/tpx/utils.cpp | 2 +- src/transport/LiquidTranInteraction.cpp | 4 ++-- src/transport/LiquidTransport.cpp | 2 +- src/transport/SimpleTransport.cpp | 4 ++-- src/zeroD/ConstPressureReactor.cpp | 2 +- src/zeroD/FlowReactor.cpp | 2 +- src/zeroD/Reactor.cpp | 4 ++-- 75 files changed, 195 insertions(+), 195 deletions(-) diff --git a/include/cantera/base/ct_defs.h b/include/cantera/base/ct_defs.h index 0a0765b12..a146184bb 100644 --- a/include/cantera/base/ct_defs.h +++ b/include/cantera/base/ct_defs.h @@ -199,7 +199,7 @@ typedef doublereal* workPtr; typedef const doublereal* const_workPtr; //! index returned by functions to indicate "no position" -const size_t npos = -1; +const size_t npos = static_cast(-1); } // namespace diff --git a/include/cantera/equil/MultiPhaseEquil.h b/include/cantera/equil/MultiPhaseEquil.h index 044be68ce..f1a6982ff 100644 --- a/include/cantera/equil/MultiPhaseEquil.h +++ b/include/cantera/equil/MultiPhaseEquil.h @@ -46,7 +46,7 @@ public: if (m < m_nel) { return m_order[m]; } else { - return -1; + return npos; } } diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 70cd1a1a1..e9b193430 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -243,7 +243,7 @@ public: */ size_t phaseIndex(std::string ph) { if (m_phaseindex.find(ph) == m_phaseindex.end()) { - return -1; + return npos; } else { return m_phaseindex[ph] - 1; } diff --git a/include/cantera/kinetics/RateCoeffMgr.h b/include/cantera/kinetics/RateCoeffMgr.h index ca5fad8df..8044b7317 100644 --- a/include/cantera/kinetics/RateCoeffMgr.h +++ b/include/cantera/kinetics/RateCoeffMgr.h @@ -58,7 +58,7 @@ public: return m_rates.size() - 1; } } - return -1; + return npos; } /** diff --git a/include/cantera/kinetics/ReactionPath.h b/include/cantera/kinetics/ReactionPath.h index 83a0aba49..4ca5dd38a 100644 --- a/include/cantera/kinetics/ReactionPath.h +++ b/include/cantera/kinetics/ReactionPath.h @@ -35,7 +35,7 @@ public: typedef std::vector path_list; /// Default constructor - SpeciesNode() : number(-1), name(""), value(0.0), + SpeciesNode() : number(npos), name(""), value(0.0), visible(false), m_in(0.0), m_out(0.0) {} /// Destructor @@ -218,7 +218,7 @@ public: void addNode(size_t k, std::string nm, doublereal x = 0.0); - void displayOnly(size_t k=-1) { + void displayOnly(size_t k=npos) { m_local = k; } diff --git a/include/cantera/oneD/Domain1D.h b/include/cantera/oneD/Domain1D.h index a41554f62..c02b6ee32 100644 --- a/include/cantera/oneD/Domain1D.h +++ b/include/cantera/oneD/Domain1D.h @@ -50,7 +50,7 @@ public: m_rdt(0.0), m_time(time), m_container(0), - m_index(-1), + m_index(npos), m_type(0), m_iloc(0), m_jstart(0), @@ -67,14 +67,14 @@ public: } /// Domain type flag. - const int domainType() { + int domainType() { return m_type; } /** * The left-to-right location of this domain. */ - const size_t domainIndex() { + size_t domainIndex() { return m_index; } @@ -137,7 +137,7 @@ public: virtual void init() { } virtual void setInitialState(doublereal* xlocal = 0) {} - virtual void setState(int point, const doublereal* state, doublereal* x) {} + virtual void setState(size_t point, const doublereal* state, doublereal* x) {} /** * Resize the domain to have nv components and np grid points. @@ -308,10 +308,10 @@ public: * transient mode. Used only to print diagnostic output. */ void evalss(doublereal* x, doublereal* r, integer* mask) { - eval(-1,x,r,mask,0.0); + eval(npos,x,r,mask,0.0); } - //! Evaluate the residual function at point j. If j < 0, + //! Evaluate the residual function at point j. If j == npos, //! evaluate the residual function at all points. /*! * @param j Grid point j diff --git a/include/cantera/oneD/Inlet1D.h b/include/cantera/oneD/Inlet1D.h index c6b3d1dd5..190c1227a 100644 --- a/include/cantera/oneD/Inlet1D.h +++ b/include/cantera/oneD/Inlet1D.h @@ -88,7 +88,7 @@ public: writelog("Bdry1D::_getInitialSoln called!\n"); } - virtual void setupGrid(int n, const doublereal* z) {} + virtual void setupGrid(size_t n, const doublereal* z) {} protected: diff --git a/include/cantera/oneD/Sim1D.h b/include/cantera/oneD/Sim1D.h index 2649ca5d1..f5e6c422b 100644 --- a/include/cantera/oneD/Sim1D.h +++ b/include/cantera/oneD/Sim1D.h @@ -88,7 +88,7 @@ public: void solve(int loglevel = 0, bool refine_grid = true); void eval(doublereal rdt=-1.0, int count = 1) { - OneDim::eval(-1, DATA_PTR(m_x), DATA_PTR(m_xnew), rdt, count); + OneDim::eval(npos, DATA_PTR(m_x), DATA_PTR(m_xnew), rdt, count); } /// Refine the grid in all domains. diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index 10bd237e1..cd9e95867 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -207,8 +207,8 @@ public: return ""; } - void solveEnergyEqn(int j=-1) { - if (j < 0) + void solveEnergyEqn(size_t j=npos) { + if (j == npos) for (size_t i = 0; i < m_points; i++) { m_do_energy[i] = true; } diff --git a/include/cantera/thermo/FixedChemPotSSTP.h b/include/cantera/thermo/FixedChemPotSSTP.h index c4109ad32..127cb7727 100644 --- a/include/cantera/thermo/FixedChemPotSSTP.h +++ b/include/cantera/thermo/FixedChemPotSSTP.h @@ -328,13 +328,13 @@ public: * @return * Returns The standard Concentration as 1.0 */ - virtual doublereal standardConcentration(int k=0) const; + virtual doublereal standardConcentration(size_t k=0) const; //! Natural logarithm of the standard concentration of the kth species. /*! * @param k index of the species (defaults to zero) */ - virtual doublereal logStandardConc(int k=0) const; + virtual doublereal logStandardConc(size_t k=0) const; //! Get the array of chemical potentials at unit activity for the species //! at their standard states at the current T and P of the solution. diff --git a/include/cantera/thermo/GeneralSpeciesThermo.h b/include/cantera/thermo/GeneralSpeciesThermo.h index 51a4e3239..997666952 100644 --- a/include/cantera/thermo/GeneralSpeciesThermo.h +++ b/include/cantera/thermo/GeneralSpeciesThermo.h @@ -151,7 +151,7 @@ public: * * @param k Species index */ - virtual doublereal minTemp(size_t k=-1) const; + virtual doublereal minTemp(size_t k=npos) const; //! Maximum temperature. /*! @@ -163,7 +163,7 @@ public: * * @param k Species Index */ - virtual doublereal maxTemp(size_t k=-1) const; + virtual doublereal maxTemp(size_t k=npos) const; //! The reference-state pressure for species k. /*! @@ -178,7 +178,7 @@ public: * * @param k Species Index */ - virtual doublereal refPressure(size_t k = -1) const; + virtual doublereal refPressure(size_t k=npos) const; //! This utility function reports the type of parameterization //! used for the species with index number index. diff --git a/include/cantera/thermo/PureFluidPhase.h b/include/cantera/thermo/PureFluidPhase.h index eb42783f8..7b9580115 100644 --- a/include/cantera/thermo/PureFluidPhase.h +++ b/include/cantera/thermo/PureFluidPhase.h @@ -264,7 +264,7 @@ public: * Returns the standard concentration. The units are by definition * dependent on the ThermoPhase and kinetics manager representation. */ - virtual doublereal standardConcentration(int k=0) const; + virtual doublereal standardConcentration(size_t k=0) const; //! Get the array of non-dimensional activities at //! the current solution temperature, pressure, and solution concentration. diff --git a/include/cantera/thermo/SpeciesThermo.h b/include/cantera/thermo/SpeciesThermo.h index f359e80bc..74b82a1b9 100644 --- a/include/cantera/thermo/SpeciesThermo.h +++ b/include/cantera/thermo/SpeciesThermo.h @@ -300,7 +300,7 @@ public: * * @param k Species index */ - virtual doublereal minTemp(size_t k=-1) const =0; + virtual doublereal minTemp(size_t k=npos) const =0; //! Maximum temperature. /*! @@ -312,7 +312,7 @@ public: * * @param k Species Index */ - virtual doublereal maxTemp(size_t k=-1) const =0; + virtual doublereal maxTemp(size_t k=npos) const =0; //! The reference-state pressure for species k. /*! @@ -327,7 +327,7 @@ public: * * @param k Species Index */ - virtual doublereal refPressure(size_t k=-1) const =0; + virtual doublereal refPressure(size_t k=npos) const =0; //! This utility function reports the type of parameterization //! used for the species with index number index. @@ -335,7 +335,7 @@ public: * * @param index Species index */ - virtual int reportType(size_t index = -1) const = 0; + virtual int reportType(size_t index=npos) const = 0; //! This utility function reports back the type of diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index d439f9f30..971fb9e49 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -255,7 +255,7 @@ public: * * @param k Species index */ - virtual doublereal minTemp(size_t k = -1) const; + virtual doublereal minTemp(size_t k = npos) const; //! Maximum temperature. /*! @@ -267,7 +267,7 @@ public: * * @param k index for parameterization k */ - virtual doublereal maxTemp(size_t k = -1) const; + virtual doublereal maxTemp(size_t k = npos) const; /** * The reference-state pressure for species k. @@ -282,7 +282,7 @@ public: * * @param k index for parameterization k */ - virtual doublereal refPressure(size_t k = -1) const; + virtual doublereal refPressure(size_t k = npos) const; //! This utility function reports the type of parameterization //! used for the species with index number index. @@ -434,19 +434,19 @@ public: /*! * @param k species index. Defaults to -1. */ - virtual doublereal minTemp(size_t k = -1) const; + virtual doublereal minTemp(size_t k = npos) const; //! Returns the maximum temperature /*! * @param k species index. Defaults to -1. */ - virtual doublereal maxTemp(size_t k = -1) const; + virtual doublereal maxTemp(size_t k = npos) const; //! returns the reference pressure /*! * @param k species index. Defaults to -1. */ - virtual doublereal refPressure(size_t k = -1) const; + virtual doublereal refPressure(size_t k = npos) const; //! This utility function reports the type of parameterization //! used for the species with index number index. diff --git a/include/cantera/thermo/VPSSMgr.h b/include/cantera/thermo/VPSSMgr.h index d42a0ece4..e55188a89 100644 --- a/include/cantera/thermo/VPSSMgr.h +++ b/include/cantera/thermo/VPSSMgr.h @@ -659,7 +659,7 @@ public: * * @param k Species index */ - virtual doublereal minTemp(size_t k=-1) const ; + virtual doublereal minTemp(size_t k=npos) const ; //! Maximum temperature. /*! @@ -671,7 +671,7 @@ public: * * @param k Species Index */ - virtual doublereal maxTemp(size_t k=-1) const; + virtual doublereal maxTemp(size_t k=npos) const; //! The reference-state pressure for the standard state /*! @@ -687,7 +687,7 @@ public: * @param k Species index. Default is -1, which returns * the generic answer. */ - virtual doublereal refPressure(size_t k = -1) const ; + virtual doublereal refPressure(size_t k=npos) const ; //@} diff --git a/include/cantera/transport/LiquidTransport.h b/include/cantera/transport/LiquidTransport.h index 5fa251ae7..774a93481 100644 --- a/include/cantera/transport/LiquidTransport.h +++ b/include/cantera/transport/LiquidTransport.h @@ -639,7 +639,7 @@ public: * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ - virtual void getSpeciesFluxesES(int ndim, + virtual void getSpeciesFluxesES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, diff --git a/include/cantera/transport/SimpleTransport.h b/include/cantera/transport/SimpleTransport.h index 881dafe55..b7cc663d7 100644 --- a/include/cantera/transport/SimpleTransport.h +++ b/include/cantera/transport/SimpleTransport.h @@ -432,7 +432,7 @@ public: * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ - virtual void getSpeciesVdiff(int ndim, + virtual void getSpeciesVdiff(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, @@ -465,7 +465,7 @@ public: * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ - virtual void getSpeciesVdiffES(int ndim, const doublereal* grad_T, + virtual void getSpeciesVdiffES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, const doublereal* grad_Phi, doublereal* Vdiff); diff --git a/include/cantera/transport/TransportBase.h b/include/cantera/transport/TransportBase.h index 8b6c50185..8c5e2cd43 100644 --- a/include/cantera/transport/TransportBase.h +++ b/include/cantera/transport/TransportBase.h @@ -581,7 +581,7 @@ public: * length = ldx * ndim * units are m / s. */ - virtual void getSpeciesVdiff(int ndim, + virtual void getSpeciesVdiff(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, @@ -613,7 +613,7 @@ public: * length = ldx * ndim * units are m / s. */ - virtual void getSpeciesVdiffES(int ndim, + virtual void getSpeciesVdiffES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, diff --git a/src/base/ctml.cpp b/src/base/ctml.cpp index 3cc3d8f52..a8ca49eb1 100644 --- a/src/base/ctml.cpp +++ b/src/base/ctml.cpp @@ -1539,8 +1539,8 @@ void getMatrixValues(const Cantera::XML_Node& node, key2 = rmm.substr(0,icolon); val = rmm.substr(icolon+1, rmm.size()); - size_t icol = -1; - size_t irow = -1; + size_t icol = npos; + size_t irow = npos; for (size_t j = 0; j < szKey1; j++) { if (key1 == keyStringRow[j]) { irow = j; diff --git a/src/base/stringUtils.cpp b/src/base/stringUtils.cpp index d4769c22e..e96168838 100644 --- a/src/base/stringUtils.cpp +++ b/src/base/stringUtils.cpp @@ -105,7 +105,7 @@ std::string lowercase(const std::string& s) int n = static_cast(s.size()); std::string lc(s); for (int i = 0; i < n; i++) { - lc[i] = tolower(s[i]); + lc[i] = (char) tolower(s[i]); } return lc; } diff --git a/src/clib/ctonedim.cpp b/src/clib/ctonedim.cpp index 839e0accd..db9f845ae 100644 --- a/src/clib/ctonedim.cpp +++ b/src/clib/ctonedim.cpp @@ -443,9 +443,9 @@ extern "C" { { try { if (flag > 0) { - _stflow(i)->solveSpecies(-1); + _stflow(i)->solveSpecies(npos); } else { - _stflow(i)->fixSpecies(-1); + _stflow(i)->fixSpecies(npos); } return 0; } catch (...) { @@ -458,9 +458,9 @@ extern "C" { { try { if (flag > 0) { - _stflow(i)->solveEnergyEqn(-1); + _stflow(i)->solveEnergyEqn(npos); } else { - _stflow(i)->fixTemperature(-1); + _stflow(i)->fixTemperature(npos); } return 0; } catch (...) { diff --git a/src/converters/ck2ct.cpp b/src/converters/ck2ct.cpp index d2eb89c30..104928da0 100644 --- a/src/converters/ck2ct.cpp +++ b/src/converters/ck2ct.cpp @@ -278,9 +278,9 @@ static void addSpecies(FILE* f, string idtag, const ckr::Species& sp) * second letter, if needed. */ nm = sp.elements[m].name; - nm[0] = toupper(nm[0]); + nm[0] = (char) toupper(nm[0]); if (nm.size() == 2) { - nm[1] = tolower(nm[1]); + nm[1] = (char) tolower(nm[1]); } /* * Obtain the current number of atoms in the species. @@ -480,9 +480,9 @@ void ck2ct(FILE* f, string idtag, ckr::CKReader& r, bool hastransport) string elnm; for (i = 0; i < nel; i++) { elnm = r.elements[i].name; - elnm[0] = toupper(elnm[0]); + elnm[0] = (char) toupper(elnm[0]); if (elnm.size() == 2) { - elnm[1] = tolower(elnm[1]); + elnm[1] = (char) tolower(elnm[1]); } emap[r.elements[i].name] = elnm; enames += " "+elnm+" "; diff --git a/src/converters/ckr_utils.cpp b/src/converters/ckr_utils.cpp index 4bb1918f6..99fb878a3 100644 --- a/src/converters/ckr_utils.cpp +++ b/src/converters/ckr_utils.cpp @@ -155,9 +155,9 @@ string capitalize(const std::string& word) string cap = word; int n = static_cast(word.size()); if (n > 0) { - cap[0] = toupper(word[0]); + cap[0] = (char) toupper(word[0]); for (int m = 1; m < n; m++) { - cap[m] = tolower(word[m]); + cap[m] = (char) tolower(word[m]); } } return cap; diff --git a/src/equil/BasisOptimize.cpp b/src/equil/BasisOptimize.cpp index 0259c23b0..f94ab87e4 100644 --- a/src/equil/BasisOptimize.cpp +++ b/src/equil/BasisOptimize.cpp @@ -237,7 +237,7 @@ size_t Cantera::BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, #endif - size_t jr = -1; + size_t jr = npos; /* * Top of a loop of some sort based on the index JR. JR is the * current number of component species found. @@ -752,7 +752,7 @@ size_t Cantera::ElemRearrange(size_t nComponents, const vector_fp& elementAbunda * Top of a loop of some sort based on the index JR. JR is the * current number independent elements found. */ - jr = -1; + jr = npos; do { ++jr; /* diff --git a/src/equil/ChemEquil.cpp b/src/equil/ChemEquil.cpp index bda0d18a0..acf76824c 100644 --- a/src/equil/ChemEquil.cpp +++ b/src/equil/ChemEquil.cpp @@ -64,8 +64,8 @@ int _equilflag(const char* xy) /// Default Constructor. -ChemEquil::ChemEquil() : m_skip(-1), m_p1(0), m_p2(0), m_elementTotalSum(1.0), - m_p0(OneAtm), m_eloc(-1), +ChemEquil::ChemEquil() : m_skip(npos), m_p1(0), m_p2(0), m_elementTotalSum(1.0), + m_p0(OneAtm), m_eloc(npos), m_elemFracCutoff(1.0E-100), m_doResPerturb(false) {} @@ -77,9 +77,9 @@ ChemEquil::ChemEquil() : m_skip(-1), m_p1(0), m_p2(0), m_elementTotalSum(1.0), * @param s ThermoPhase object that will be used in the equilibrium calls. */ ChemEquil::ChemEquil(thermo_t& s) : - m_skip(-1), m_p1(0), m_p2(0), + m_skip(npos), m_p1(0), m_p2(0), m_elementTotalSum(1.0), - m_p0(OneAtm), m_eloc(-1), + m_p0(OneAtm), m_eloc(npos), m_elemFracCutoff(1.0E-100), m_doResPerturb(false) { @@ -128,7 +128,7 @@ void ChemEquil::initialize(thermo_t& s) m_grt.resize(m_kk); m_mu_RT.resize(m_kk); m_muSS_RT.resize(m_kk); - m_component.resize(m_mm,-2); + m_component.resize(m_mm,npos); m_orderVectorElements.resize(m_mm); for (size_t m = 0; m < m_mm; m++) { @@ -140,7 +140,7 @@ void ChemEquil::initialize(thermo_t& s) } // set up elemental composition matrix - size_t mneg = -1; + size_t mneg = npos; doublereal na, ewt; for (size_t m = 0; m < m_mm; m++) { for (size_t k = 0; k < m_kk; k++) { @@ -1530,7 +1530,7 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x, /* * Decide if we are to do a normal step or a modified step */ - size_t iM = -1; + size_t iM = npos; for (m = 0; m < m_mm; m++) { if (elMoles[m] > 0.001 * elMolesTotal) { if (eMolesCalc[m] > 1000. * elMoles[m]) { @@ -1615,8 +1615,8 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x, } #endif for (m = 0; m < m_mm; m++) { - size_t kMSp = -1; - size_t kMSp2 = -1; + size_t kMSp = npos; + size_t kMSp2 = npos; int nSpeciesWithElem = 0; for (k = 0; k < m_kk; k++) { if (n_i_calc[k] > nCutoff) { diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index 48e7cbf40..86adfbed7 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -25,7 +25,7 @@ MultiPhase::MultiPhase() : m_nel(0), m_nsp(0), m_init(false), - m_eloc(-1), + m_eloc(npos), m_Tmin(1.0), m_Tmax(100000.0) { @@ -42,7 +42,7 @@ MultiPhase::MultiPhase(const MultiPhase& right) : m_nel(0), m_nsp(0), m_init(false), - m_eloc(-1), + m_eloc(npos), m_Tmin(1.0), m_Tmax(100000.0) { @@ -1022,7 +1022,7 @@ size_t MultiPhase::elementIndex(std::string name) const return e; } } - return -1; + return npos; } //==================================================================================================================== // Name of species with global index \a k. diff --git a/src/equil/vcs_DoubleStarStar.cpp b/src/equil/vcs_DoubleStarStar.cpp index 174017c70..ac5ed177f 100644 --- a/src/equil/vcs_DoubleStarStar.cpp +++ b/src/equil/vcs_DoubleStarStar.cpp @@ -119,24 +119,24 @@ void DoubleStarStar::resize(size_t m, size_t n, double v) } } -double* const DoubleStarStar::operator[](size_t jcol) +double* DoubleStarStar::operator[](size_t jcol) { return m_colAddr[jcol]; } -const double* const DoubleStarStar::operator[](size_t jcol) const +const double* DoubleStarStar::operator[](size_t jcol) const { - return (const double * const) m_colAddr[jcol]; + return (const double*) m_colAddr[jcol]; } -double* const* const DoubleStarStar::baseDataAddr() +double* const* DoubleStarStar::baseDataAddr() { - return (double * const * const) &(m_colAddr[0]); + return (double* const*) &(m_colAddr[0]); } -double const* const* const DoubleStarStar::constBaseDataAddr() const +double const* const* DoubleStarStar::constBaseDataAddr() const { - return (double const * const * const) &(m_colAddr[0]); + return (double const* const*) &(m_colAddr[0]); } // Number of rows diff --git a/src/equil/vcs_DoubleStarStar.h b/src/equil/vcs_DoubleStarStar.h index 4c68fd1c8..4e1875495 100644 --- a/src/equil/vcs_DoubleStarStar.h +++ b/src/equil/vcs_DoubleStarStar.h @@ -71,7 +71,7 @@ public: * * @return returns the pointer to the top of the jth column */ - double* const operator[](size_t jcol); + double* operator[](size_t jcol); //! Returns a const Pointer to the top of the jth column /*! @@ -79,7 +79,7 @@ public: * * @return returns the pointer to the top of the jth column */ - const double* const operator[](size_t jcol) const; + const double* operator[](size_t jcol) const; //! Returns a double ** pointer to the base address /*! @@ -87,7 +87,7 @@ public: * This returns a double ** which can later be used in * Dmatrix[icol][irow] notation to get to the data */ - double* const* const baseDataAddr(); + double* const* baseDataAddr(); //! Returns a const double ** pointer to the base address /*! @@ -95,7 +95,7 @@ public: * This returns a double ** which can later be used in * Dmatrix[icol][irow] notation to get to the data */ - double const* const* const constBaseDataAddr() const; + double const* const* constBaseDataAddr() const; //! Number of rows size_t nRows() const; diff --git a/src/equil/vcs_IntStarStar.cpp b/src/equil/vcs_IntStarStar.cpp index 582c7271e..de8c04ab2 100644 --- a/src/equil/vcs_IntStarStar.cpp +++ b/src/equil/vcs_IntStarStar.cpp @@ -119,19 +119,19 @@ void IntStarStar::resize(size_t m, size_t n, int v) } } -int* const IntStarStar::operator[](size_t jcol) +int* IntStarStar::operator[](size_t jcol) { return m_colAddr[jcol]; } -const int* const IntStarStar::operator[](size_t jcol) const +const int* IntStarStar::operator[](size_t jcol) const { - return (const int * const) m_colAddr[jcol]; + return (const int*) m_colAddr[jcol]; } -int* const* const IntStarStar::baseDataAddr() +int* const* IntStarStar::baseDataAddr() { - return (int * const * const) &(m_colAddr[0]); + return (int* const*) &(m_colAddr[0]); } /// Number of rows diff --git a/src/equil/vcs_IntStarStar.h b/src/equil/vcs_IntStarStar.h index cb20f2c87..bb8f4ef77 100644 --- a/src/equil/vcs_IntStarStar.h +++ b/src/equil/vcs_IntStarStar.h @@ -59,13 +59,13 @@ public: /*! * @param jcol Pointer to the top of the jth column */ - int* const operator[](size_t jcol); + int* 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[](size_t jcol) const; + const int* operator[](size_t jcol) const; //! Returns a int ** pointer to the base address /*! @@ -73,7 +73,7 @@ public: * This returns a int ** which can later be used in * Imatrix[icol][irow] notation to get to the data */ - int* const* const baseDataAddr(); + int* const* baseDataAddr(); //! Number of rows size_t nRows() const; diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 0854e0f47..9c38e9344 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -1488,7 +1488,7 @@ void vcs_MultiPhaseEquil::getStoichVector(index_t rxn, Cantera::vector_fp& nu) size_t vcs_MultiPhaseEquil::numComponents() const { - size_t nc = -1; + size_t nc = npos; if (m_vsolvePtr) { nc = m_vsolvePtr->m_numComponents; } @@ -1497,7 +1497,7 @@ size_t vcs_MultiPhaseEquil::numComponents() const size_t vcs_MultiPhaseEquil::numElemConstraints() const { - size_t nec = -1; + size_t nec = npos; if (m_vsolvePtr) { nec = m_vsolvePtr->m_numElemConstraints; } @@ -1511,7 +1511,7 @@ size_t vcs_MultiPhaseEquil::component(size_t m) const if (m < nc) { return m_vsolvePtr->m_speciesMapIndex[m]; } else { - return -1; + return npos; } } diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index 0a2316bd9..55611aaa1 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -31,12 +31,12 @@ namespace VCSnonideal */ vcs_VolPhase::vcs_VolPhase(VCS_SOLVE* owningSolverObject) : m_owningSolverObject(0), - VP_ID_(-1), + VP_ID_(npos), Domain_ID(-1), m_singleSpecies(true), m_gasPhase(false), m_eqnState(VCS_EOS_CONSTANT), - ChargeNeutralityElement(-1), + ChargeNeutralityElement(npos), p_VCS_UnitsFormat(VCS_UNITS_MKS), p_activityConvention(0), m_numElemConstraints(0), @@ -52,7 +52,7 @@ vcs_VolPhase::vcs_VolPhase(VCS_SOLVE* owningSolverObject) : v_totalMoles(0.0), creationMoleNumbers_(0), creationGlobalRxnNumbers_(0), - m_phiVarIndex(-1), + m_phiVarIndex(npos), m_totalVol(0.0), m_vcsStateStatus(VCS_STATECALC_OLD), m_phi(0.0), @@ -114,7 +114,7 @@ vcs_VolPhase::vcs_VolPhase(const vcs_VolPhase& b) : v_totalMoles(b.v_totalMoles), creationMoleNumbers_(0), creationGlobalRxnNumbers_(0), - m_phiVarIndex(-1), + m_phiVarIndex(npos), m_totalVol(b.m_totalVol), m_vcsStateStatus(VCS_STATECALC_OLD), m_phi(b.m_phi), @@ -251,7 +251,7 @@ void vcs_VolPhase::resize(const size_t phaseNum, const size_t nspecies, #endif setTotalMolesInert(molesInert); m_phi = 0.0; - m_phiVarIndex = -1; + m_phiVarIndex = npos; if (phaseNum == VP_ID_) { if (strcmp(PhaseName.c_str(), phaseName)) { @@ -285,7 +285,7 @@ void vcs_VolPhase::resize(const size_t phaseNum, const size_t nspecies, } - IndSpecies.resize(nspecies, -1); + IndSpecies.resize(nspecies, npos); if (ListSpeciesPtr.size() >= m_numSpecies) { for (size_t i = 0; i < m_numSpecies; i++) { @@ -302,7 +302,7 @@ void vcs_VolPhase::resize(const size_t phaseNum, const size_t nspecies, Xmol_.resize(nspecies, 0.0); creationMoleNumbers_.resize(nspecies, 0.0); - creationGlobalRxnNumbers_.resize(nspecies, -1); + creationGlobalRxnNumbers_.resize(nspecies, npos); for (size_t i = 0; i < nspecies; i++) { Xmol_[i] = 1.0/nspecies; creationMoleNumbers_[i] = 1.0/nspecies; @@ -342,7 +342,7 @@ void vcs_VolPhase::elemResize(const size_t numElemConstraints) m_formulaMatrix.resize(numElemConstraints, m_numSpecies, 0.0); m_elementNames.resize(numElemConstraints, ""); - m_elemGlobalIndex.resize(numElemConstraints, -1); + m_elemGlobalIndex.resize(numElemConstraints, npos); m_numElemConstraints = numElemConstraints; } @@ -1700,9 +1700,9 @@ void vcs_VolPhase::setElementType(const size_t e, const int eType) } /***************************************************************************/ -double const* const* const vcs_VolPhase::getFormulaMatrix() const +double const* const* vcs_VolPhase::getFormulaMatrix() const { - double const* const* const fm = m_formulaMatrix.constBaseDataAddr(); + double const* const* fm = m_formulaMatrix.constBaseDataAddr(); return fm; } /***************************************************************************/ diff --git a/src/equil/vcs_VolPhase.h b/src/equil/vcs_VolPhase.h index 01199e7f5..85e7b7a0b 100644 --- a/src/equil/vcs_VolPhase.h +++ b/src/equil/vcs_VolPhase.h @@ -567,7 +567,7 @@ public: * * fm[e][f] is the formula matrix entry for element e for species k */ - double const* const* const getFormulaMatrix() const; + double const* const* getFormulaMatrix() const; //! Returns the type of the species unknown /*! diff --git a/src/equil/vcs_elem.cpp b/src/equil/vcs_elem.cpp index 551f7b575..3b36af3b8 100644 --- a/src/equil/vcs_elem.cpp +++ b/src/equil/vcs_elem.cpp @@ -263,7 +263,7 @@ int VCS_SOLVE::vcs_elcorr(double aa[], double x[]) } } else { int numCompNonZero = 0; - size_t compID = -1; + size_t compID = npos; for (size_t kspec = 0; kspec < m_numComponents; kspec++) { if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { double eval = m_formulaMatrix[i][kspec]; diff --git a/src/equil/vcs_elem_rearrange.cpp b/src/equil/vcs_elem_rearrange.cpp index 05fd5bf85..a8db229c5 100644 --- a/src/equil/vcs_elem_rearrange.cpp +++ b/src/equil/vcs_elem_rearrange.cpp @@ -98,7 +98,7 @@ int VCS_SOLVE::vcs_elem_rearrange(double* const aw, double* const sa, * Top of a loop of some sort based on the index JR. JR is the * current number independent elements found. */ - jr = -1; + jr = npos; do { ++jr; /* diff --git a/src/equil/vcs_prob.cpp b/src/equil/vcs_prob.cpp index ae321fc2e..05c762421 100644 --- a/src/equil/vcs_prob.cpp +++ b/src/equil/vcs_prob.cpp @@ -80,7 +80,7 @@ VCS_PROB::VCS_PROB(size_t nsp, size_t nel, size_t nph) : FormulaMatrix.resize(ne, nspecies, 0.0); SpeciesUnknownType.resize(nspecies, VCS_SPECIES_TYPE_MOLNUM); VolPM.resize(nspecies, 0.0); - PhaseID.resize(nspecies, -1); + PhaseID.resize(nspecies, npos); SpName.resize(nspecies, ""); ElName.resize(ne, ""); m_elType.resize(ne, VCS_ELEM_TYPE_ABSPOS); @@ -387,7 +387,7 @@ void VCS_PROB::prob_report(int print_lvl) void VCS_PROB::addPhaseElements(vcs_VolPhase* volPhase) { size_t e, eVP; - size_t foundPos = -1; + size_t foundPos = npos; size_t neVP = volPhase->nElemConstraints(); std::string en; std::string enVP; @@ -395,7 +395,7 @@ void VCS_PROB::addPhaseElements(vcs_VolPhase* volPhase) * Loop through the elements in the vol phase object */ for (eVP = 0; eVP < neVP; eVP++) { - foundPos = -1; + foundPos = npos; enVP = volPhase->elementName(eVP); /* * Search for matches with the existing elements. diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 13d929dbf..229494061 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -436,13 +436,13 @@ L_MAINLOOP_ALL_SPECIES: /* * Don't do this step if there is a phase pop */ - iphaseDelete = -1; + iphaseDelete = npos; if (iphasePop == npos) { /* * Figure out the new reaction step sizes * for the major species (do minor species in the future too) */ - kspec = -1; + kspec = npos; iphaseDelete = vcs_RxnStepSizes(forceComponentCalc, kspec); } #ifdef DEBUG_MODE @@ -3207,8 +3207,8 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], size_t j, k, l, i, jl, ml, jr, irxn, kspec; bool lindep; size_t ncTrial; - size_t juse = -1; - size_t jlose = -1; + size_t juse = npos; + size_t jlose = npos; double* dptr, *scrxn_ptr; Cantera::clockWC tickTock; #ifdef DEBUG_MODE @@ -3274,7 +3274,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], } } - jr = -1; + jr = npos; /* * Top of a loop of some sort based on the index JR. JR is the * current number of component species found. @@ -3336,7 +3336,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], double maxConcPossKspec = 0.0; double maxConcPoss = 0.0; - size_t kfound = -1; + size_t kfound = npos; int minNonZeroes = 100000; int nonZeroesKspec = 0; for (kspec = ncTrial; kspec < m_numSpeciesTot; kspec++) { @@ -3569,8 +3569,8 @@ L_END_LOOP: * was just wrong -> hopefully it didn't blow up. Redo the problem. * Search for inactive E */ - juse = -1; - jlose = -1; + juse = npos; + jlose = npos; for (j = 0; j < m_numElemConstraints; j++) { if (!(m_elementActive[j])) { if (!strcmp((m_elementName[j]).c_str(), "E")) { diff --git a/src/equil/vcs_util.cpp b/src/equil/vcs_util.cpp index ffa8642cb..3f0bb16ae 100644 --- a/src/equil/vcs_util.cpp +++ b/src/equil/vcs_util.cpp @@ -642,7 +642,7 @@ int vcsUtil_gaussj(double* c, size_t idem, size_t n, double* b, size_t m) } } if (needInverse) { - for (l = n-1; l >= 0; l--) { + for (l = n-1; l != npos; l--) { if (indxr[l] != indxc[l]) { for (k = 0; k < n; k++) { std::swap(c[k + idem * indxr[l]], c[k + idem * indxr[l]]); diff --git a/src/kinetics/ImplicitSurfChem.cpp b/src/kinetics/ImplicitSurfChem.cpp index 7ed469c22..b4d402e0f 100644 --- a/src/kinetics/ImplicitSurfChem.cpp +++ b/src/kinetics/ImplicitSurfChem.cpp @@ -60,11 +60,11 @@ ImplicitSurfChem::ImplicitSurfChem(vector k) : size_t nPhases = kinPtr->nPhases(); vector_int pLocTmp(nPhases); - size_t imatch = -1; + size_t imatch = npos; for (size_t ip = 0; ip < nPhases; ip++) { if (ip != ns) { ThermoPhase* thPtr = & kinPtr->thermo(ip); - if ((imatch = checkMatch(m_bulkPhases, thPtr)) == -1) { + if ((imatch = checkMatch(m_bulkPhases, thPtr)) == npos) { m_bulkPhases.push_back(thPtr); m_numBulkPhases++; nsp = thPtr->nSpecies(); diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 268030677..2afdcc0df 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -32,8 +32,8 @@ Kinetics::Kinetics() : m_thermo(0), m_start(0), m_phaseindex(), - m_surfphase(-1), - m_rxnphase(-1), + m_surfphase(npos), + m_rxnphase(npos), m_mindim(4), m_dummygroups(0) { @@ -56,8 +56,8 @@ Kinetics::Kinetics(const Kinetics& right) : m_thermo(0), m_start(0), m_phaseindex(), - m_surfphase(-1), - m_rxnphase(-1), + m_surfphase(npos), + m_rxnphase(npos), m_mindim(4), m_dummygroups(0) { @@ -297,7 +297,7 @@ size_t Kinetics::speciesPhaseIndex(size_t k) } } throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(k)); - return -1; + return npos; } /* diff --git a/src/kinetics/ReactionPath.cpp b/src/kinetics/ReactionPath.cpp index d07270c5f..89fe3bba1 100644 --- a/src/kinetics/ReactionPath.cpp +++ b/src/kinetics/ReactionPath.cpp @@ -117,7 +117,7 @@ ReactionPathDiagram::ReactionPathDiagram() show_details = false; arrow_hue = 0.6666; title = ""; - m_local = -1; + m_local = npos; } diff --git a/src/kinetics/StoichManager.h b/src/kinetics/StoichManager.h index 95fd3b737..314ebd6cb 100644 --- a/src/kinetics/StoichManager.h +++ b/src/kinetics/StoichManager.h @@ -456,7 +456,7 @@ public: C_AnyN() : m_n(0), - m_rxn(-1) { + m_rxn(npos) { } C_AnyN(size_t rxn, const std::vector& ic, const vector_fp& order, const vector_fp& stoich) : diff --git a/src/numerics/BEulerInt.cpp b/src/numerics/BEulerInt.cpp index 29c598f7f..b7f12e02a 100644 --- a/src/numerics/BEulerInt.cpp +++ b/src/numerics/BEulerInt.cpp @@ -125,13 +125,13 @@ BEulerInt::~BEulerInt() SAFE_DELETE(tdjac_ptr); } //================================================================================================ -void BEulerInt::setTolerances(double reltol, int n, double* abstol) +void BEulerInt::setTolerances(double reltol, size_t n, double* abstol) { m_itol = 1; if (!m_abstol) { m_abstol = mdp_alloc_dbl_1(m_neq, MDP_DBL_NOINIT); } - if (n != m_neq) { + if (static_cast(n) != m_neq) { printf("ERROR n is wrong\n"); exit(-1); } diff --git a/src/numerics/BEulerInt.h b/src/numerics/BEulerInt.h index 2279042cf..f54688d5f 100644 --- a/src/numerics/BEulerInt.h +++ b/src/numerics/BEulerInt.h @@ -71,7 +71,7 @@ public: BEulerInt(); //! Destructor virtual ~BEulerInt(); - virtual void setTolerances(double reltol, int n, double* abstol); + virtual void setTolerances(double reltol, size_t n, double* abstol); virtual void setTolerances(double reltol, double abstol); virtual void setProblemType(int probtype); virtual void initializeRJE(double t0, ResidJacEval& func); @@ -79,7 +79,7 @@ public: virtual double integrateRJE(double tout, double tinit = 0.0); virtual doublereal step(double tout); virtual void setSolnWeights(); - virtual double& solution(int k) { + virtual double& solution(size_t k) { return m_y_n[k]; } double* solution() { diff --git a/src/numerics/BandMatrix.cpp b/src/numerics/BandMatrix.cpp index 2fb3e6cd5..43db2a058 100644 --- a/src/numerics/BandMatrix.cpp +++ b/src/numerics/BandMatrix.cpp @@ -441,7 +441,7 @@ size_t BandMatrix::checkRows(doublereal& valueSmall) const for (size_t i = 0; i < m_n; i++) { double valueS = 0.0; for (size_t j = i - m_kl; j <= i + m_ku; j++) { - if (j >= 0 && (j < m_n)) { + if (j < m_n) { vv = fabs(value(i,j)); if (vv > valueS) { valueS = vv; @@ -467,7 +467,7 @@ size_t BandMatrix::checkColumns(doublereal& valueSmall) const for (size_t j = 0; j < m_n; j++) { double valueS = 0.0; for (size_t i = j - m_ku; i <= j + m_kl; i++) { - if (i >= 0 && (i < m_n)) { + if (i < m_n) { vv = fabs(value(i,j)); if (vv > valueS) { valueS = vv; diff --git a/src/numerics/CVodesIntegrator.cpp b/src/numerics/CVodesIntegrator.cpp index be19ce192..42bd0238a 100644 --- a/src/numerics/CVodesIntegrator.cpp +++ b/src/numerics/CVodesIntegrator.cpp @@ -160,7 +160,7 @@ CVodesIntegrator::~CVodesIntegrator() //delete[] m_iopt; } -double& CVodesIntegrator::solution(int k) +double& CVodesIntegrator::solution(size_t k) { return NV_Ith_S(nv(m_y),k); } diff --git a/src/numerics/CVodesIntegrator.h b/src/numerics/CVodesIntegrator.h index 352b394ba..fcd0a5044 100644 --- a/src/numerics/CVodesIntegrator.h +++ b/src/numerics/CVodesIntegrator.h @@ -56,7 +56,7 @@ public: virtual void reinitialize(double t0, FuncEval& func); virtual void integrate(double tout); virtual doublereal step(double tout); - virtual double& solution(int k); + virtual double& solution(size_t k); virtual double* solution(); virtual int nEquations() const { return m_neq; diff --git a/src/numerics/NonlinearSolver.cpp b/src/numerics/NonlinearSolver.cpp index 331f6336c..eb016aa08 100644 --- a/src/numerics/NonlinearSolver.cpp +++ b/src/numerics/NonlinearSolver.cpp @@ -788,7 +788,7 @@ void NonlinearSolver::scaleMatrix(GeneralMatrix& jac, doublereal* const y_comm, for (jcol = 0; jcol < neq_; jcol++) { colP_j = (doublereal*) jac.ptrColumn(jcol); for (irow = jcol - ku; irow <= jcol + kl; irow++) { - if (irow >= 0 && irow < neq_) { + if (irow < neq_) { colP_j[kl + ku + irow - jcol] *= m_colScales[jcol]; } } @@ -833,7 +833,7 @@ void NonlinearSolver::scaleMatrix(GeneralMatrix& jac, doublereal* const y_comm, for (jcol = 0; jcol < neq_; jcol++) { colP_j = (doublereal*) jac.ptrColumn(jcol); for (irow = jcol - ku; irow <= jcol + kl; irow++) { - if (irow >= 0 && irow < neq_) { + if (irow < neq_) { double vv = fabs(colP_j[kl + ku + irow - jcol]); if (m_rowScaling) { m_rowScales[irow] += vv; @@ -876,7 +876,7 @@ void NonlinearSolver::scaleMatrix(GeneralMatrix& jac, doublereal* const y_comm, for (jcol = 0; jcol < neq_; jcol++) { colP_j = (doublereal*) jac.ptrColumn(jcol); for (irow = jcol - ku; irow <= jcol + kl; irow++) { - if (irow >= 0 && irow < neq_) { + if (irow < neq_) { colP_j[kl + ku + irow - jcol] *= m_rowScales[irow]; } } @@ -3879,7 +3879,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f, for (size_t i = j - ku; i <= j + kl; i++) { - if (i >= 0 && i < neq_) { + if (i < neq_) { diff = subtractRD(m_wksp[i], f[i]); col_j[kl + ku + i - j] = diff / dy; } diff --git a/src/numerics/solveProb.cpp b/src/numerics/solveProb.cpp index 340a9a327..12f338cc8 100644 --- a/src/numerics/solveProb.cpp +++ b/src/numerics/solveProb.cpp @@ -554,7 +554,7 @@ doublereal solveProb::calc_damping(doublereal x[], doublereal dxneg[], size_t di */ if (damp > damp_old*3) { damp = damp_old*3; - *label = -1; + *label = npos; } /* @@ -840,7 +840,7 @@ void solveProb::printIteration(int ioflag, doublereal damp, size_t label_d, printf(" "); } } - if (label_d >= 0) { + if (label_d != npos) { k = label_d; printf(" %s", int2str(k).c_str()); } @@ -930,7 +930,7 @@ void solveProb::printFinal(int ioflag, doublereal damp, size_t label_d, size_t l printf(" "); } } - if (label_d >= 0) { + if (label_d != npos) { k = label_d; printf(" %s", int2str(k).c_str()); diff --git a/src/oneD/MultiNewton.cpp b/src/oneD/MultiNewton.cpp index 419a49970..b40ce8185 100644 --- a/src/oneD/MultiNewton.cpp +++ b/src/oneD/MultiNewton.cpp @@ -109,7 +109,7 @@ void MultiNewton::step(doublereal* x, doublereal* step, { size_t iok; size_t sz = r.size(); - r.eval(-1, x, step); + r.eval(npos, x, step); #undef DEBUG_STEP #ifdef DEBUG_STEP vector_fp ssave(sz, 0.0); @@ -324,7 +324,7 @@ int MultiNewton::solve(doublereal* x0, doublereal* x1, } if (forceNewJac) { - r.eval(-1, x, stp, 0.0, 0); + r.eval(npos, x, stp, 0.0, 0); jac.eval(x, stp, 0.0); jac.updateTransient(rdt, DATA_PTR(r.transientMask())); forceNewJac = false; diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index b318d3f1b..06a9b9c0b 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -232,7 +232,7 @@ void OneDim::resize() int OneDim::solve(doublereal* x, doublereal* xnew, int loglevel) { if (!m_jac_ok) { - eval(-1, x, xnew, 0.0, 0); + eval(npos, x, xnew, 0.0, 0); m_jac->eval(x, xnew, 0.0); m_jac->updateTransient(m_rdt, DATA_PTR(m_mask)); m_jac_ok = true; @@ -246,7 +246,7 @@ void OneDim::evalSSJacobian(doublereal* x, doublereal* xnew) doublereal rdt_save = m_rdt; m_jac_ok = false; setSteadyMode(); - eval(-1, x, xnew, 0.0, 0); + eval(npos, x, xnew, 0.0, 0); m_jac->eval(x, xnew, 0.0); m_rdt = rdt_save; } @@ -313,7 +313,7 @@ void OneDim::eval(size_t j, double* x, double* r, doublereal rdt, int count) */ doublereal OneDim::ssnorm(doublereal* x, doublereal* r) { - eval(-1, x, r, 0.0, 0); + eval(npos, x, r, 0.0, 0); doublereal ss = 0.0; for (size_t i = 0; i < m_size; i++) { ss = std::max(fabs(r[i]),ss); diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index af2e7476e..e35bdebad 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -1026,7 +1026,7 @@ size_t StFlow::componentIndex(string name) const } } - return -1; + return npos; } diff --git a/src/thermo/Constituents.cpp b/src/thermo/Constituents.cpp index 9645276ac..2ef323da9 100644 --- a/src/thermo/Constituents.cpp +++ b/src/thermo/Constituents.cpp @@ -422,7 +422,7 @@ size_t Constituents::speciesIndex(std::string name) const } ++it; } - return -1; + return npos; } /* diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index c71674bed..12b50d16c 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -1517,7 +1517,7 @@ initThermoXML(XML_Node& phaseNode, std::string id) std::string kname, jname; size_t jj = xspecies.size(); for (size_t k = 0; k < m_kk; k++) { - size_t jmap = -1; + size_t jmap = npos; kname = speciesName(k); for (size_t j = 0; j < jj; j++) { const XML_Node& sp = *xspecies[j]; diff --git a/src/thermo/Elements.cpp b/src/thermo/Elements.cpp index 7c021266b..f1669d800 100644 --- a/src/thermo/Elements.cpp +++ b/src/thermo/Elements.cpp @@ -311,7 +311,7 @@ size_t Elements::elementIndex(std::string name) const return i; } } - return -1; + return npos; } #endif diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index 2a0e573f1..80d072029 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -294,7 +294,7 @@ getActivityConcentrations(doublereal* c) const * by which the generalized concentration is normalized to produce * the activity. */ -doublereal FixedChemPotSSTP::standardConcentration(int k) const +doublereal FixedChemPotSSTP::standardConcentration(size_t k) const { return 1.0; } @@ -303,7 +303,7 @@ doublereal FixedChemPotSSTP::standardConcentration(int k) const * Returns the natural logarithm of the standard * concentration of the kth species */ -doublereal FixedChemPotSSTP::logStandardConc(int k) const +doublereal FixedChemPotSSTP::logStandardConc(size_t k) const { return 0.0; } diff --git a/src/thermo/HMWSoln_input.cpp b/src/thermo/HMWSoln_input.cpp index 115880a54..0f3dd1b8e 100644 --- a/src/thermo/HMWSoln_input.cpp +++ b/src/thermo/HMWSoln_input.cpp @@ -1499,7 +1499,7 @@ initThermoXML(XML_Node& phaseNode, std::string id) string kname, jname; size_t jj = xspecies.size(); for (size_t k = 0; k < m_kk; k++) { - size_t jmap = -1; + size_t jmap = npos; kname = speciesName(k); for (size_t j = 0; j < jj; j++) { const XML_Node& sp = *xspecies[j]; diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index 09635584e..fd05bfc5f 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -40,8 +40,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), numNeutralMoleculeSpecies_(0), - indexSpecialSpecies_(-1), - indexSecondSpecialSpecies_(-1), + indexSpecialSpecies_(npos), + indexSecondSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -84,8 +84,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(std::string inputFile, std::string GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), numNeutralMoleculeSpecies_(0), - indexSpecialSpecies_(-1), - indexSecondSpecialSpecies_(-1), + indexSpecialSpecies_(npos), + indexSecondSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -106,8 +106,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, std::string id GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), numNeutralMoleculeSpecies_(0), - indexSpecialSpecies_(-1), - indexSecondSpecialSpecies_(-1), + indexSpecialSpecies_(npos), + indexSecondSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -136,8 +136,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b) : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), numNeutralMoleculeSpecies_(0), - indexSpecialSpecies_(-1), - indexSecondSpecialSpecies_(-1), + indexSpecialSpecies_(npos), + indexSecondSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -1233,7 +1233,7 @@ void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) } PDSS_IonsFromNeutral* speciesSS = 0; - indexSpecialSpecies_ = -1; + indexSpecialSpecies_ = npos; for (k = 0; k < m_kk; k++) { speciesSS = dynamic_cast(providePDSS(k)); if (!speciesSS) { @@ -1259,7 +1259,7 @@ void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) vector fm_tmp(m_kk); for (size_t k = 0; k < m_kk; k++) { - fm_invert_ionForNeutral[k] = -1; + fm_invert_ionForNeutral[k] = npos; } /* for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) { fm_invert_ionForNeutral[jNeut] = -1; diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 33c0890a8..2a3bc2cda 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -128,7 +128,7 @@ doublereal LatticeSolidPhase::minTemp(size_t k) const } doublereal mm = 1.0E300; for (size_t n = 0; n < m_nlattice; n++) { - double ml = (m_lattice[n])->minTemp(-1); + double ml = (m_lattice[n])->minTemp(); mm = std::min(mm, ml); } return mm; @@ -158,7 +158,7 @@ doublereal LatticeSolidPhase::maxTemp(size_t k) const } doublereal mm = -1.0E300; for (size_t n = 0; n < m_nlattice; n++) { - double ml = (m_lattice[n])->maxTemp(-1); + double ml = (m_lattice[n])->maxTemp(); mm = std::max(mm, ml); } return mm; diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index 4d25f7c0c..bdb60babe 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -1077,8 +1077,8 @@ void MargulesVPSSTP::resizeNumInteractions(const size_t num) m_VSE_c_ij.resize(num, 0.0); m_VSE_d_ij.resize(num, 0.0); - m_pSpecies_A_ij.resize(num, -1); - m_pSpecies_B_ij.resize(num, -1); + m_pSpecies_A_ij.resize(num, npos); + m_pSpecies_B_ij.resize(num, npos); } //==================================================================================================================== diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index 24ca6e30b..88fc284e6 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -1079,8 +1079,8 @@ void MixedSolventElectrolyte::resizeNumInteractions(const size_t num) m_VSE_c_ij.resize(num, 0.0); m_VSE_d_ij.resize(num, 0.0); - m_pSpecies_A_ij.resize(num, -1); - m_pSpecies_B_ij.resize(num, -1); + m_pSpecies_A_ij.resize(num, npos); + m_pSpecies_B_ij.resize(num, npos); } //==================================================================================================================== diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index 404c5ca76..948740f54 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -37,7 +37,7 @@ MolalityVPSSTP::MolalityVPSSTP() : VPStandardStateTP(), m_indexSolvent(0), m_pHScalingType(PHSCALE_PITZER), - m_indexCLM(-1), + m_indexCLM(npos), m_weightSolvent(18.01528), m_xmolSolventMIN(0.01), m_Mnaught(18.01528E-3) @@ -334,9 +334,9 @@ void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) /* * check charge neutrality */ - size_t largePos = -1; + size_t largePos = npos; double cPos = 0.0; - size_t largeNeg = -1; + size_t largeNeg = npos; double cNeg = 0.0; double sum = 0.0; for (size_t k = 0; k < kk; k++) { @@ -735,9 +735,9 @@ void MolalityVPSSTP::applyphScale(doublereal* acMolality) const */ size_t MolalityVPSSTP::findCLMIndex() const { - size_t indexCLM = -1; - size_t eCl = -1; - size_t eE = -1; + size_t indexCLM = npos; + size_t eCl = npos; + size_t eE = npos; size_t ne = nElements(); string sn; for (size_t e = 0; e < ne; e++) { @@ -749,7 +749,7 @@ size_t MolalityVPSSTP::findCLMIndex() const } // We have failed if we can't find the Cl element index if (eCl == npos) { - return -1; + return npos; } for (size_t e = 0; e < ne; e++) { sn = elementName(e); diff --git a/src/thermo/MolarityIonicVPSSTP.cpp b/src/thermo/MolarityIonicVPSSTP.cpp index 1c767de5e..eedde4b5a 100644 --- a/src/thermo/MolarityIonicVPSSTP.cpp +++ b/src/thermo/MolarityIonicVPSSTP.cpp @@ -40,7 +40,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP() : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -60,7 +60,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(std::string inputFile, std::string id) GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -73,7 +73,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, std::string id) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -92,7 +92,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -510,7 +510,7 @@ void MolarityIonicVPSSTP::calcPseudoBinaryMoleFractions() const for (k = 0; k < m_kk; k++) { moleFractionsTmp_[k] = moleFractions_[k]; } - kMax = -1; + kMax = npos; sumMax = 0.0; for (k = 0; k < cationList_.size(); k++) { kCat = cationList_[k]; diff --git a/src/thermo/PDSS.cpp b/src/thermo/PDSS.cpp index 6f0c659a9..12ef83f48 100644 --- a/src/thermo/PDSS.cpp +++ b/src/thermo/PDSS.cpp @@ -34,7 +34,7 @@ PDSS::PDSS() : m_tp(0), m_vpssmgr_ptr(0), m_mw(0.0), - m_spindex(-1), + m_spindex(npos), m_spthermo(0), m_h0_RT_ptr(0), m_cp0_R_ptr(0), diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index bf0d1ffb9..c0db6e66c 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -1143,8 +1143,8 @@ void PhaseCombo_Interaction::resizeNumInteractions(const size_t num) m_VSE_c_ij.resize(num, 0.0); m_VSE_d_ij.resize(num, 0.0); - m_pSpecies_A_ij.resize(num, -1); - m_pSpecies_B_ij.resize(num, -1); + m_pSpecies_A_ij.resize(num, npos); + m_pSpecies_B_ij.resize(num, npos); } //==================================================================================================================== diff --git a/src/thermo/PseudoBinaryVPSSTP.cpp b/src/thermo/PseudoBinaryVPSSTP.cpp index 68e62d192..36618eea8 100644 --- a/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/src/thermo/PseudoBinaryVPSSTP.cpp @@ -33,7 +33,7 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), @@ -53,7 +53,7 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), - indexSpecialSpecies_(-1), + indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), diff --git a/src/thermo/PureFluidPhase.cpp b/src/thermo/PureFluidPhase.cpp index 6fbc757d3..a817d7cc4 100644 --- a/src/thermo/PureFluidPhase.cpp +++ b/src/thermo/PureFluidPhase.cpp @@ -314,7 +314,7 @@ void PureFluidPhase::getActivityConcentrations(doublereal* c) const c[0] = 1.0; } //==================================================================================================================== -doublereal PureFluidPhase::standardConcentration(int k) const +doublereal PureFluidPhase::standardConcentration(size_t k) const { return 1.0; } diff --git a/src/thermo/SpeciesThermoInterpType.cpp b/src/thermo/SpeciesThermoInterpType.cpp index 42f0df876..457bd41a6 100644 --- a/src/thermo/SpeciesThermoInterpType.cpp +++ b/src/thermo/SpeciesThermoInterpType.cpp @@ -48,7 +48,7 @@ void SpeciesThermoInterpType::modifyOneHf298(const int k, const doublereal Hf298 //! Constructor STITbyPDSS::STITbyPDSS() : - m_speciesIndex(-1) + m_speciesIndex(npos) { } diff --git a/src/tpx/utils.cpp b/src/tpx/utils.cpp index 2005af52c..ebfcd207c 100644 --- a/src/tpx/utils.cpp +++ b/src/tpx/utils.cpp @@ -11,7 +11,7 @@ static string lowercase(string s) size_t i, n = s.size(); string lc(s); for (i = 0; i < n; i++) { - lc[i] = tolower(s[i]); + lc[i] = (char) tolower(s[i]); } return lc; } diff --git a/src/transport/LiquidTranInteraction.cpp b/src/transport/LiquidTranInteraction.cpp index cc6d3277c..79da5788b 100644 --- a/src/transport/LiquidTranInteraction.cpp +++ b/src/transport/LiquidTranInteraction.cpp @@ -123,12 +123,12 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode, speciesA = xmlChild.attrib("speciesA"); speciesB = xmlChild.attrib("speciesB"); size_t iSpecies = m_thermo->speciesIndex(speciesA); - if (iSpecies < 0) { + if (iSpecies == npos) { throw CanteraError("TransportFactory::getLiquidInteractionsTransportData", "Unknown species " + speciesA); } size_t jSpecies = m_thermo->speciesIndex(speciesB); - if (jSpecies < 0) { + if (jSpecies == npos) { throw CanteraError("TransportFactory::getLiquidInteractionsTransportData", "Unknown species " + speciesB); } diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index cbd23dbe6..9c5813d7d 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -1151,7 +1151,7 @@ void LiquidTransport::getSpeciesFluxes(size_t ndim, * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ -void LiquidTransport::getSpeciesFluxesES(int ndim, +void LiquidTransport::getSpeciesFluxesES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, diff --git a/src/transport/SimpleTransport.cpp b/src/transport/SimpleTransport.cpp index aba3cfd87..52a85df1c 100644 --- a/src/transport/SimpleTransport.cpp +++ b/src/transport/SimpleTransport.cpp @@ -636,7 +636,7 @@ void SimpleTransport::getThermalDiffCoeffs(doublereal* const dt) * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ -void SimpleTransport::getSpeciesVdiff(int ndim, +void SimpleTransport::getSpeciesVdiff(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, @@ -687,7 +687,7 @@ void SimpleTransport::getSpeciesVdiff(int ndim, * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ -void SimpleTransport::getSpeciesVdiffES(int ndim, const doublereal* grad_T, +void SimpleTransport::getSpeciesVdiffES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, const doublereal* grad_Phi, doublereal* Vdiff) diff --git a/src/zeroD/ConstPressureReactor.cpp b/src/zeroD/ConstPressureReactor.cpp index cb9a6f7a6..1fb9a15d7 100644 --- a/src/zeroD/ConstPressureReactor.cpp +++ b/src/zeroD/ConstPressureReactor.cpp @@ -307,7 +307,7 @@ size_t ConstPressureReactor::componentIndex(string nm) const } } } - return -1; + return npos; } } diff --git a/src/zeroD/FlowReactor.cpp b/src/zeroD/FlowReactor.cpp index f98801fd3..24a6dfad3 100644 --- a/src/zeroD/FlowReactor.cpp +++ b/src/zeroD/FlowReactor.cpp @@ -140,7 +140,7 @@ size_t FlowReactor::componentIndex(string nm) const if (k != npos) { return k + 2; } else { - return -1; + return npos; } } diff --git a/src/zeroD/Reactor.cpp b/src/zeroD/Reactor.cpp index a8ab19b33..5a716878d 100644 --- a/src/zeroD/Reactor.cpp +++ b/src/zeroD/Reactor.cpp @@ -28,7 +28,7 @@ Reactor::Reactor() : ReactorBase(), m_Q(0.0), m_rtol(1.e-9), m_chem(true), - m_energy(true), m_nsens(-1) + m_energy(true), m_nsens(npos) {} // overloaded method of FuncEval. Called by the integrator to @@ -376,7 +376,7 @@ size_t Reactor::componentIndex(string nm) const } } } - return -1; + return npos; } }