solaris port

std:: additions
This commit is contained in:
Harry Moffat 2006-12-14 18:29:40 +00:00
parent 10609920f7
commit f7eedd6855
7 changed files with 104 additions and 104 deletions

View file

@ -61,12 +61,12 @@ namespace Cantera {
Gaussian(double A, double t0, double fwhm) { Gaussian(double A, double t0, double fwhm) {
m_A = A; m_A = A;
m_t0 = t0; 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 ~Gaussian() {}
virtual doublereal eval(doublereal t) { virtual doublereal eval(doublereal t) {
doublereal x = (t - m_t0)/m_tau; doublereal x = (t - m_t0)/m_tau;
return m_A*exp(-x*x); return m_A*std::exp(-x*x);
} }
protected: protected:
doublereal m_A, m_t0, m_tau; doublereal m_A, m_t0, m_tau;
@ -82,7 +82,7 @@ namespace Cantera {
Poly1(int n, doublereal* c) { Poly1(int n, doublereal* c) {
m_n = n+1; m_n = n+1;
m_c.resize(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() {} virtual ~Poly1() {}
@ -119,8 +119,8 @@ namespace Cantera {
m_a0_2 = 0.5*a0; m_a0_2 = 0.5*a0;
m_ccos.resize(n); m_ccos.resize(n);
m_csin.resize(n); m_csin.resize(n);
copy(a, a+n, m_ccos.begin()); std::copy(a, a+n, m_ccos.begin());
copy(b, b+n, m_csin.begin()); std::copy(b, b+n, m_csin.begin());
} }
virtual ~Fourier1() {} virtual ~Fourier1() {}
@ -129,8 +129,8 @@ namespace Cantera {
doublereal sum = m_a0_2; doublereal sum = m_a0_2;
for (n = 0; n < m_n; n++) { for (n = 0; n < m_n; n++) {
nn = n + 1; nn = n + 1;
sum += m_ccos[n]*cos(m_omega*nn*t) sum += m_ccos[n]*std::cos(m_omega*nn*t)
+ m_csin[n]*sin(m_omega*nn*t); + m_csin[n]*std::sin(m_omega*nn*t);
} }
return sum; return sum;
} }
@ -169,7 +169,7 @@ namespace Cantera {
int n; int n;
doublereal sum = 0.0; doublereal sum = 0.0;
for (n = 0; n < m_n; n++) { 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; return sum;
} }

View file

@ -109,7 +109,7 @@ namespace Cantera {
*/ */
virtual void getFwdRatesOfProgress(doublereal* fwdROP) { virtual void getFwdRatesOfProgress(doublereal* fwdROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); std::copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP);
} }
/** /**
* Reverse rates of progress. * Reverse rates of progress.
@ -119,7 +119,7 @@ namespace Cantera {
*/ */
virtual void getRevRatesOfProgress(doublereal* revROP) { virtual void getRevRatesOfProgress(doublereal* revROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); std::copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP);
} }
/** /**
* Net rates of progress. Return the net (forward - reverse) * Net rates of progress. Return the net (forward - reverse)
@ -129,7 +129,7 @@ namespace Cantera {
*/ */
virtual void getNetRatesOfProgress(doublereal* netROP) { virtual void getNetRatesOfProgress(doublereal* netROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); std::copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP);
} }
@ -278,7 +278,7 @@ namespace Cantera {
* for reaction i is always zero. * for reaction i is always zero.
*/ */
virtual bool isReversible(int i) { 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; < m_revindex.end()) return true;
else return false; else return false;
} }

View file

@ -93,17 +93,17 @@ namespace Cantera {
virtual void getFwdRatesOfProgress(doublereal* fwdROP) { virtual void getFwdRatesOfProgress(doublereal* fwdROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP); std::copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP);
} }
virtual void getRevRatesOfProgress(doublereal* revROP) { virtual void getRevRatesOfProgress(doublereal* revROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP); std::copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP);
} }
virtual void getNetRatesOfProgress(doublereal* netROP) { virtual void getNetRatesOfProgress(doublereal* netROP) {
updateROP(); updateROP();
copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP); std::copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP);
} }
virtual void getEquilibriumConstants(doublereal* kc); virtual void getEquilibriumConstants(doublereal* kc);
@ -247,7 +247,7 @@ namespace Cantera {
* for reaction i is always zero. * for reaction i is always zero.
*/ */
virtual bool isReversible(int i) { 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; < m_revindex.end()) return true;
else return false; else return false;
} }

View file

@ -49,7 +49,7 @@ namespace Cantera {
m_Pref (pref), m_Pref (pref),
m_index (n) { m_index (n) {
m_coeff.resize(7); m_coeff.resize(7);
copy(coeffs, coeffs + 7, m_coeff.begin()); std::copy(coeffs, coeffs + 7, m_coeff.begin());
} }
ShomatePoly(const ShomatePoly& b) : ShomatePoly(const ShomatePoly& b) :
@ -58,7 +58,7 @@ namespace Cantera {
m_Pref (b.m_Pref), m_Pref (b.m_Pref),
m_coeff (array_fp(7)), m_coeff (array_fp(7)),
m_index (b.m_index) { m_index (b.m_index) {
copy(b.m_coeff.begin(), std::copy(b.m_coeff.begin(),
b.m_coeff.begin() + 7, b.m_coeff.begin() + 7,
m_coeff.begin()); m_coeff.begin());
} }
@ -69,7 +69,7 @@ namespace Cantera {
m_highT = b.m_highT; m_highT = b.m_highT;
m_Pref = b.m_Pref; m_Pref = b.m_Pref;
m_index = b.m_index; m_index = b.m_index;
copy(b.m_coeff.begin(), std::copy(b.m_coeff.begin(),
b.m_coeff.begin() + 7, b.m_coeff.begin() + 7,
m_coeff.begin()); m_coeff.begin());
} }
@ -148,7 +148,7 @@ namespace Cantera {
tPoly[1] = tt * tt; tPoly[1] = tt * tt;
tPoly[2] = tPoly[1] * tt; tPoly[2] = tPoly[1] * tt;
tPoly[3] = 1.0/tPoly[1]; tPoly[3] = 1.0/tPoly[1];
tPoly[4] = log(tt); tPoly[4] = std::log(tt);
tPoly[5] = 1.0/GasConstant; tPoly[5] = 1.0/GasConstant;
tPoly[6] = 1.0/(GasConstant * temp); tPoly[6] = 1.0/(GasConstant * temp);
updateProperties(tPoly, cp_R, h_RT, s_R); updateProperties(tPoly, cp_R, h_RT, s_R);
@ -204,7 +204,7 @@ namespace Cantera {
msp_high(0), msp_high(0),
m_index (n) { m_index (n) {
m_coeff.resize(15); m_coeff.resize(15);
copy(coeffs, coeffs + 15, m_coeff.begin()); std::copy(coeffs, coeffs + 15, m_coeff.begin());
m_midT = coeffs[0]; m_midT = coeffs[0];
msp_low = new ShomatePoly(n, tlow, m_midT, pref, coeffs+1); msp_low = new ShomatePoly(n, tlow, m_midT, pref, coeffs+1);
msp_high = new ShomatePoly(n, m_midT, thigh, pref, coeffs+8); msp_high = new ShomatePoly(n, m_midT, thigh, pref, coeffs+8);
@ -219,7 +219,7 @@ namespace Cantera {
msp_high(0), msp_high(0),
m_coeff (array_fp(15)), m_coeff (array_fp(15)),
m_index (b.m_index) { m_index (b.m_index) {
copy(b.m_coeff.begin(), std::copy(b.m_coeff.begin(),
b.m_coeff.begin() + 15, b.m_coeff.begin() + 15,
m_coeff.begin()); m_coeff.begin());
msp_low = new ShomatePoly(m_index, m_lowT, m_midT, msp_low = new ShomatePoly(m_index, m_lowT, m_midT,
@ -235,7 +235,7 @@ namespace Cantera {
m_highT = b.m_highT; m_highT = b.m_highT;
m_Pref = b.m_Pref; m_Pref = b.m_Pref;
m_index = b.m_index; m_index = b.m_index;
copy(b.m_coeff.begin(), std::copy(b.m_coeff.begin(),
b.m_coeff.begin() + 15, b.m_coeff.begin() + 15,
m_coeff.begin()); m_coeff.begin());
if (msp_low) delete msp_low; if (msp_low) delete msp_low;
@ -274,7 +274,7 @@ namespace Cantera {
* m_t[1] = tt*tt; * m_t[1] = tt*tt;
* m_t[2] = m_t[1]*tt; * m_t[2] = m_t[1]*tt;
* m_t[3] = 1.0/m_t[1]; * 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[5] = 1.0/GasConstant;
* m_t[6] = 1.0/(GasConstant * T); * m_t[6] = 1.0/(GasConstant * T);
*/ */

View file

@ -50,7 +50,7 @@
namespace Cantera { namespace Cantera {
const doublereal Pi = 3.1415926; const doublereal Pi = 3.1415926;
const doublereal SqrtPi = sqrt(Pi); const doublereal SqrtPi = std::sqrt(Pi);
// use kg-moles, rather than g-moles. // use kg-moles, rather than g-moles.
// Note: this constant is a relic of old versions, // Note: this constant is a relic of old versions,
@ -111,8 +111,8 @@ namespace Cantera {
const doublereal OneThird = 1.0/3.0; const doublereal OneThird = 1.0/3.0;
const doublereal FiveSixteenths = 5.0/16.0; const doublereal FiveSixteenths = 5.0/16.0;
const doublereal SqrtTen = sqrt(10.0); const doublereal SqrtTen = std::sqrt(10.0);
const doublereal SqrtEight = sqrt(8.0); const doublereal SqrtEight = std::sqrt(8.0);
const doublereal SmallNumber = 1.e-300; const doublereal SmallNumber = 1.e-300;
const doublereal BigNumber = 1.e300; const doublereal BigNumber = 1.e300;
@ -175,7 +175,7 @@ namespace Cantera {
// template<class A, class B> // template<class A, class B>
//inline doublereal operator*(const vector<A>& u, const vector<B>& v) { //inline doublereal operator*(const vector<A>& u, const vector<B>& v) {
// return inner_product(u.begin(), u.end(), v.begin(), 0.0); // return std::inner_product(u.begin(), u.end(), v.begin(), 0.0);
// } // }

View file

@ -233,7 +233,7 @@ namespace Cantera {
inline doublereal sum_xlogx(InputIter begin, InputIter end) { inline doublereal sum_xlogx(InputIter begin, InputIter end) {
doublereal sum = 0.0; doublereal sum = 0.0;
for (; begin != end; ++begin) { for (; begin != end; ++begin) {
sum += (*begin) * log(*begin + Tiny); sum += (*begin) * std::log(*begin + Tiny);
} }
return sum; return sum;
} }
@ -247,7 +247,7 @@ namespace Cantera {
InputIter2 Q_begin) { InputIter2 Q_begin) {
doublereal sum = 0.0; doublereal sum = 0.0;
for (; begin != end; ++begin, ++Q_begin) { for (; begin != end; ++begin, ++Q_begin) {
sum += (*begin) * log(*Q_begin + Tiny); sum += (*begin) * std::log(*Q_begin + Tiny);
} }
return sum; return sum;
} }

View file

@ -79,10 +79,10 @@ namespace Cantera {
void setLineNumber(int n) {m_linenum = n;} void setLineNumber(int n) {m_linenum = n;}
int lineNumber() const {return m_linenum;} int lineNumber() const {return m_linenum;}
doublereal fp_value() const { doublereal fp_value() const {
return atof(m_value.c_str()); return std::atof(m_value.c_str());
} }
integer int_value() const { 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()() const { return m_value; }
std::string operator()(std::string loc) const { return value(loc); } std::string operator()(std::string loc) const { return value(loc); }