diff --git a/Cantera/src/Func1.h b/Cantera/src/Func1.h index 5ec3ab4b8..47fdbf5ba 100644 --- a/Cantera/src/Func1.h +++ b/Cantera/src/Func1.h @@ -32,7 +32,7 @@ namespace Cantera { /** * Base class for 'functor' classes that evaluate a function of - * one variable. + * one variable. */ class Func1 { public: @@ -47,26 +47,26 @@ namespace Cantera { /** - * A Gaussian. + * A Gaussian. * \f[ * f(t) = A e^{-[(t - t_0)/\tau]^2} * \f] * where \f[ \tau = \frac{fwhm}{2\sqrt{\ln 2}} \f] * @param A peak value * @param t0 offset - * @param fwhm full width at half max + * @param fwhm full width at half max */ class Gaussian : public Func1 { public: Gaussian(double A, double t0, double fwhm) { m_A = A; m_t0 = t0; - m_tau = fwhm/(2.0*sqrt(log(2.0))); + m_tau = fwhm/(2.0*std::sqrt(std::log(2.0))); } virtual ~Gaussian() {} virtual doublereal eval(doublereal t) { doublereal x = (t - m_t0)/m_tau; - return m_A*exp(-x*x); + return m_A*std::exp(-x*x); } protected: doublereal m_A, m_t0, m_tau; @@ -75,14 +75,14 @@ namespace Cantera { /** - * Polynomial of degree n. - */ + * Polynomial of degree n. + */ class Poly1 : public Func1 { public: Poly1(int n, doublereal* c) { m_n = n+1; m_c.resize(n+1); - copy(c, c+m_n, m_c.begin()); + std::copy(c, c+m_n, m_c.begin()); } virtual ~Poly1() {} @@ -104,23 +104,23 @@ namespace Cantera { /** * Fourier cosine/sine series. - * + * * \f[ - * f(t) = \frac{A_0}{2} + + * f(t) = \frac{A_0}{2} + * \sum_{n=1}^N A_n \cos (n \omega t) + B_n \sin (n \omega t) * \f] */ class Fourier1 : public Func1 { public: - Fourier1(int n, doublereal omega, doublereal a0, + Fourier1(int n, doublereal omega, doublereal a0, doublereal* a, doublereal* b) { m_n = n; m_omega = omega; m_a0_2 = 0.5*a0; m_ccos.resize(n); m_csin.resize(n); - copy(a, a+n, m_ccos.begin()); - copy(b, b+n, m_csin.begin()); + std::copy(a, a+n, m_ccos.begin()); + std::copy(b, b+n, m_csin.begin()); } virtual ~Fourier1() {} @@ -129,8 +129,8 @@ namespace Cantera { doublereal sum = m_a0_2; for (n = 0; n < m_n; n++) { nn = n + 1; - sum += m_ccos[n]*cos(m_omega*nn*t) - + m_csin[n]*sin(m_omega*nn*t); + sum += m_ccos[n]*std::cos(m_omega*nn*t) + + m_csin[n]*std::sin(m_omega*nn*t); } return sum; } @@ -169,7 +169,7 @@ namespace Cantera { int n; doublereal sum = 0.0; for (n = 0; n < m_n; n++) { - sum += m_A[n]*pow(t,m_b[n])*exp(-m_E[n]/t); + sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t); } return sum; } @@ -201,7 +201,7 @@ namespace Cantera { private: }; - + /** * Sum of two functions. diff --git a/Cantera/src/GasKinetics.h b/Cantera/src/GasKinetics.h index 07ff045e9..142be865e 100755 --- a/Cantera/src/GasKinetics.h +++ b/Cantera/src/GasKinetics.h @@ -47,7 +47,7 @@ namespace Cantera { m_logp_ref(0.0), m_logc_ref(0.0), m_logStandConc(0.0), - m_ROP_ok(false), + m_ROP_ok(false), m_temp(0.0) {} virtual ~GasKineticsData(){} @@ -107,9 +107,9 @@ namespace Cantera { * must be dimensioned at least as large as the total number * of reactions. */ - virtual void getFwdRatesOfProgress(doublereal* fwdROP) { - updateROP(); - copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); + virtual void getFwdRatesOfProgress(doublereal* fwdROP) { + updateROP(); + std::copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); } /** * Reverse rates of progress. @@ -117,9 +117,9 @@ namespace Cantera { * must be dimensioned at least as large as the total number * of reactions. */ - virtual void getRevRatesOfProgress(doublereal* revROP) { - updateROP(); - copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); + virtual void getRevRatesOfProgress(doublereal* revROP) { + updateROP(); + std::copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); } /** * Net rates of progress. Return the net (forward - reverse) @@ -127,9 +127,9 @@ namespace Cantera { * dimensioned at least as large as the total number of * reactions. */ - virtual void getNetRatesOfProgress(doublereal* netROP) { - updateROP(); - copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); + virtual void getNetRatesOfProgress(doublereal* netROP) { + updateROP(); + std::copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); } @@ -138,7 +138,7 @@ namespace Cantera { * the reactions in concentration units in array kc, which * must be dimensioned at least as large as the total number * of reactions. - */ + */ virtual void getEquilibriumConstants(doublereal* kc); /** @@ -172,7 +172,7 @@ namespace Cantera { virtual void getDeltaEntropy(doublereal* deltaS); /** - * Return the vector of values for the reaction + * Return the vector of values for the reaction * standard state gibbs free energy change. * These values don't depend upon the concentration * of the solution. @@ -212,40 +212,40 @@ namespace Cantera { * net production rates (creation - destruction) in array * wdot, which must be dimensioned at least as large as the * total number of species. - */ + */ virtual void getNetProductionRates(doublereal* net) { updateROP(); #ifdef HWMECH get_wdot(&m_kdata->m_ropnet[0], net); #else - m_rxnstoich->getNetProductionRates(m_kk, &m_kdata->m_ropnet[0], net); + m_rxnstoich->getNetProductionRates(m_kk, &m_kdata->m_ropnet[0], net); #endif } /** - * Species creation rates [kmol/m^3]. Return the species + * Species creation rates [kmol/m^3]. Return the species * creation rates in array cdot, which must be * dimensioned at least as large as the total number of * species. - * - */ + * + */ virtual void getCreationRates(doublereal* cdot) { updateROP(); - m_rxnstoich->getCreationRates(m_kk, &m_kdata->m_ropf[0], - &m_kdata->m_ropr[0], cdot); + m_rxnstoich->getCreationRates(m_kk, &m_kdata->m_ropf[0], + &m_kdata->m_ropr[0], cdot); } /** - * Species destruction rates [kmol/m^3]. Return the species + * Species destruction rates [kmol/m^3]. Return the species * destruction rates in array ddot, which must be * dimensioned at least as large as the total number of * species. - * - */ + * + */ virtual void getDestructionRates(doublereal* ddot) { updateROP(); - m_rxnstoich->getDestructionRates(m_kk, &m_kdata->m_ropf[0], - &m_kdata->m_ropr[0], ddot); + m_rxnstoich->getDestructionRates(m_kk, &m_kdata->m_ropf[0], + &m_kdata->m_ropr[0], ddot); // fill(ddot, ddot + m_kk, 0.0); //m_revProductStoich.incrementSpecies( // m_kdata->m_ropr.begin(), ddot); @@ -278,7 +278,7 @@ namespace Cantera { * for reaction i is always zero. */ virtual bool isReversible(int i) { - if (find(m_revindex.begin(), m_revindex.end(), i) + if (std::find(m_revindex.begin(), m_revindex.end(), i) < m_revindex.end()) return true; else return false; } @@ -299,7 +299,7 @@ namespace Cantera { * for irreversible reactions if the default for * doIrreversible is overridden. */ - virtual void getRevRateConstants(doublereal *krev, + virtual void getRevRateConstants(doublereal *krev, bool doIrreversible = false); //@} @@ -319,7 +319,7 @@ namespace Cantera { virtual void init(); - /// Add a reaction to the mechanism. + /// Add a reaction to the mechanism. void addReaction(const ReactionData& r); virtual void finalize(); @@ -350,16 +350,16 @@ namespace Cantera { doublereal m_dt_threshold; Rate1 m_falloff_low_rates; - Rate1 m_falloff_high_rates; - Rate1 m_rates; - + Rate1 m_falloff_high_rates; + Rate1 m_rates; + mutable std::map > m_index; - + FalloffMgr m_falloffn; - + ThirdBodyMgr m_3b_concm; ThirdBodyMgr m_falloff_concm; - + std::vector m_irrev; ReactionStoichMgr* m_rxnstoich; @@ -403,8 +403,8 @@ namespace Cantera { void addElementaryReaction(const ReactionData& r); void addThreeBodyReaction(const ReactionData& r); void addFalloffReaction(const ReactionData& r); - - void installReagents(const ReactionData& r); + + void installReagents(const ReactionData& r); void installGroups(int irxn, const std::vector& r, const std::vector& p); diff --git a/Cantera/src/InterfaceKinetics.h b/Cantera/src/InterfaceKinetics.h index ac55ff3e9..c1cafc232 100644 --- a/Cantera/src/InterfaceKinetics.h +++ b/Cantera/src/InterfaceKinetics.h @@ -36,12 +36,12 @@ namespace Cantera { /** - * Holds mechanism-specific data. + * Holds mechanism-specific data. */ class InterfaceKineticsData { public: InterfaceKineticsData() : - m_ROP_ok(false), + m_ROP_ok(false), m_temp(0.0), m_logtemp(0.0) {} virtual ~InterfaceKineticsData(){} @@ -67,7 +67,7 @@ namespace Cantera { public: /** - * Constructor + * Constructor * * @param thermo The optional parameter may be used to initialize * the object with one ThermoPhase object. @@ -88,22 +88,22 @@ namespace Cantera { /// /// @name Reaction Rates Of Progress /// - //@{ + //@{ - virtual void getFwdRatesOfProgress(doublereal* fwdROP) { - updateROP(); - copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); + virtual void getFwdRatesOfProgress(doublereal* fwdROP) { + updateROP(); + std::copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); } - virtual void getRevRatesOfProgress(doublereal* revROP) { - updateROP(); - copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); + virtual void getRevRatesOfProgress(doublereal* revROP) { + updateROP(); + std::copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); } - virtual void getNetRatesOfProgress(doublereal* netROP) { - updateROP(); - copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); + virtual void getNetRatesOfProgress(doublereal* netROP) { + updateROP(); + std::copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); } virtual void getEquilibriumConstants(doublereal* kc); @@ -132,7 +132,7 @@ namespace Cantera { virtual void getDeltaEntropy(doublereal* deltaS); /** - * Return the vector of values for the reaction + * Return the vector of values for the reaction * standard state gibbs free energy change. * These values don't depend upon the concentration * of the solution. @@ -169,31 +169,31 @@ namespace Cantera { //@{ /** - * Species creation rates [kmol/m^2/s]. Return the species + * Species creation rates [kmol/m^2/s]. Return the species * creation rates in array cdot, which must be * dimensioned at least as large as the total number of * species in all phases of the kinetics * model - * - */ + * + */ virtual void getCreationRates(doublereal* cdot) { updateROP(); - m_rxnstoich.getCreationRates(m_kk, &m_kdata->m_ropf[0], - &m_kdata->m_ropr[0], cdot); + m_rxnstoich.getCreationRates(m_kk, &m_kdata->m_ropf[0], + &m_kdata->m_ropr[0], cdot); } /** - * Species destruction rates [kmol/m^2/s]. Return the species + * Species destruction rates [kmol/m^2/s]. Return the species * destruction rates in array ddot, which must be * dimensioned at least as large as the total number of * species in all phases of the kinetics * model - * - */ + * + */ virtual void getDestructionRates(doublereal* ddot) { updateROP(); - m_rxnstoich.getDestructionRates(m_kk, &m_kdata->m_ropf[0], - &m_kdata->m_ropr[0], ddot); + m_rxnstoich.getDestructionRates(m_kk, &m_kdata->m_ropf[0], + &m_kdata->m_ropr[0], ddot); } /** @@ -202,12 +202,12 @@ namespace Cantera { * wdot, which must be dimensioned at least as large as the * total number of species in all phases of the kinetics * model - */ + */ virtual void getNetProductionRates(doublereal* net) { updateROP(); - m_rxnstoich.getNetProductionRates(m_kk, + m_rxnstoich.getNetProductionRates(m_kk, &m_kdata->m_ropnet[0], - net); + net); } //@} @@ -218,7 +218,7 @@ namespace Cantera { /** * Stoichiometric coefficient of species k as a reactant in - * reaction i. + * reaction i. */ virtual doublereal reactantStoichCoeff(int k, int i) const { return m_rrxn[k][i]; @@ -226,7 +226,7 @@ namespace Cantera { /** * Stoichiometric coefficient of species k as a product in - * reaction i. + * reaction i. */ virtual doublereal productStoichCoeff(int k, int i) const { return m_prxn[k][i]; @@ -247,7 +247,7 @@ namespace Cantera { * for reaction i is always zero. */ virtual bool isReversible(int i) { - if (find(m_revindex.begin(), m_revindex.end(), i) + if (std::find(m_revindex.begin(), m_revindex.end(), i) < m_revindex.end()) return true; else return false; } @@ -261,7 +261,7 @@ namespace Cantera { virtual void getFwdRateConstants(doublereal* kfwd); - virtual void getRevRateConstants(doublereal* krev, + virtual void getRevRateConstants(doublereal* krev, bool doIrreversible = false); virtual void getActivationEnergies(doublereal *E); @@ -277,7 +277,7 @@ namespace Cantera { * any reactions are actually added to the mechanism. * This function calculates m_kk the number of species in all * phases participating in the reaction mechanism. We don't know - * m_kk previously, before all phases have been added. + * m_kk previously, before all phases have been added. */ virtual void init(); @@ -289,7 +289,7 @@ namespace Cantera { /** * Finish adding reactions and prepare for use. This function * must be called after all reactions are entered into the mechanism - * and before the mechanism is used to calculate reaction rates. + * and before the mechanism is used to calculate reaction rates. */ virtual void finalize(); virtual bool ready() const; @@ -320,7 +320,7 @@ namespace Cantera { int m_kk; vector_int m_revindex; - Rate1 m_rates; + Rate1 m_rates; bool m_redo_rates; /** @@ -348,7 +348,7 @@ namespace Cantera { /** * m_rrxn is a vector of maps. m_rrxn has a length * equal to the total number of species in the kinetics - * object. For each species, there exists a map, with the + * object. For each species, there exists a map, with the * reaction number being the key, and the * reactant stoichiometric coefficient being the value. * HKM -> mutable because search sometimes creates extra @@ -359,7 +359,7 @@ namespace Cantera { /** * m_rrxn is a vector of maps. m_rrxn has a length * equal to the total number of species in the kinetics - * object. For each species, there exists a map, with the + * object. For each species, there exists a map, with the * reaction number being the key, and the * product stoichiometric coefficient being the value. */ diff --git a/Cantera/src/ShomatePoly.h b/Cantera/src/ShomatePoly.h index 4c5815256..10cd82b6c 100755 --- a/Cantera/src/ShomatePoly.h +++ b/Cantera/src/ShomatePoly.h @@ -49,7 +49,7 @@ namespace Cantera { m_Pref (pref), m_index (n) { m_coeff.resize(7); - copy(coeffs, coeffs + 7, m_coeff.begin()); + std::copy(coeffs, coeffs + 7, m_coeff.begin()); } ShomatePoly(const ShomatePoly& b) : @@ -58,7 +58,7 @@ namespace Cantera { m_Pref (b.m_Pref), m_coeff (array_fp(7)), m_index (b.m_index) { - copy(b.m_coeff.begin(), + std::copy(b.m_coeff.begin(), b.m_coeff.begin() + 7, m_coeff.begin()); } @@ -69,7 +69,7 @@ namespace Cantera { m_highT = b.m_highT; m_Pref = b.m_Pref; m_index = b.m_index; - copy(b.m_coeff.begin(), + std::copy(b.m_coeff.begin(), b.m_coeff.begin() + 7, m_coeff.begin()); } @@ -148,7 +148,7 @@ namespace Cantera { tPoly[1] = tt * tt; tPoly[2] = tPoly[1] * tt; tPoly[3] = 1.0/tPoly[1]; - tPoly[4] = log(tt); + tPoly[4] = std::log(tt); tPoly[5] = 1.0/GasConstant; tPoly[6] = 1.0/(GasConstant * temp); updateProperties(tPoly, cp_R, h_RT, s_R); @@ -204,7 +204,7 @@ namespace Cantera { msp_high(0), m_index (n) { m_coeff.resize(15); - copy(coeffs, coeffs + 15, m_coeff.begin()); + std::copy(coeffs, coeffs + 15, m_coeff.begin()); m_midT = coeffs[0]; msp_low = new ShomatePoly(n, tlow, m_midT, pref, coeffs+1); msp_high = new ShomatePoly(n, m_midT, thigh, pref, coeffs+8); @@ -219,7 +219,7 @@ namespace Cantera { msp_high(0), m_coeff (array_fp(15)), m_index (b.m_index) { - copy(b.m_coeff.begin(), + std::copy(b.m_coeff.begin(), b.m_coeff.begin() + 15, m_coeff.begin()); msp_low = new ShomatePoly(m_index, m_lowT, m_midT, @@ -235,7 +235,7 @@ namespace Cantera { m_highT = b.m_highT; m_Pref = b.m_Pref; m_index = b.m_index; - copy(b.m_coeff.begin(), + std::copy(b.m_coeff.begin(), b.m_coeff.begin() + 15, m_coeff.begin()); if (msp_low) delete msp_low; @@ -274,7 +274,7 @@ namespace Cantera { * m_t[1] = tt*tt; * m_t[2] = m_t[1]*tt; * m_t[3] = 1.0/m_t[1]; - * m_t[4] = log(tt); + * m_t[4] = std::log(tt); * m_t[5] = 1.0/GasConstant; * m_t[6] = 1.0/(GasConstant * T); */ diff --git a/Cantera/src/ct_defs.h b/Cantera/src/ct_defs.h index cb38784cc..5fcceba65 100755 --- a/Cantera/src/ct_defs.h +++ b/Cantera/src/ct_defs.h @@ -50,7 +50,7 @@ namespace Cantera { const doublereal Pi = 3.1415926; - const doublereal SqrtPi = sqrt(Pi); + const doublereal SqrtPi = std::sqrt(Pi); // use kg-moles, rather than g-moles. // Note: this constant is a relic of old versions, @@ -111,8 +111,8 @@ namespace Cantera { const doublereal OneThird = 1.0/3.0; const doublereal FiveSixteenths = 5.0/16.0; - const doublereal SqrtTen = sqrt(10.0); - const doublereal SqrtEight = sqrt(8.0); + const doublereal SqrtTen = std::sqrt(10.0); + const doublereal SqrtEight = std::sqrt(8.0); const doublereal SmallNumber = 1.e-300; const doublereal BigNumber = 1.e300; @@ -175,7 +175,7 @@ namespace Cantera { // template //inline doublereal operator*(const vector& u, const vector& v) { - // return inner_product(u.begin(), u.end(), v.begin(), 0.0); + // return std::inner_product(u.begin(), u.end(), v.begin(), 0.0); // } diff --git a/Cantera/src/utilities.h b/Cantera/src/utilities.h index e95c5256b..b0118456c 100755 --- a/Cantera/src/utilities.h +++ b/Cantera/src/utilities.h @@ -233,7 +233,7 @@ namespace Cantera { inline doublereal sum_xlogx(InputIter begin, InputIter end) { doublereal sum = 0.0; for (; begin != end; ++begin) { - sum += (*begin) * log(*begin + Tiny); + sum += (*begin) * std::log(*begin + Tiny); } return sum; } @@ -247,7 +247,7 @@ namespace Cantera { InputIter2 Q_begin) { doublereal sum = 0.0; for (; begin != end; ++begin, ++Q_begin) { - sum += (*begin) * log(*Q_begin + Tiny); + sum += (*begin) * std::log(*Q_begin + Tiny); } return sum; } diff --git a/Cantera/src/xml.h b/Cantera/src/xml.h index 25e796c54..1247124c1 100755 --- a/Cantera/src/xml.h +++ b/Cantera/src/xml.h @@ -79,10 +79,10 @@ namespace Cantera { void setLineNumber(int n) {m_linenum = n;} int lineNumber() const {return m_linenum;} doublereal fp_value() const { - return atof(m_value.c_str()); + return std::atof(m_value.c_str()); } integer int_value() const { - return atoi(m_value.c_str()); + return std::atoi(m_value.c_str()); } std::string operator()() const { return m_value; } std::string operator()(std::string loc) const { return value(loc); }