static_cast to eliminate VC++ warnings.

This commit is contained in:
Harry Moffat 2004-07-01 23:48:30 +00:00
parent 0490e50e8a
commit b78b8c85ff
7 changed files with 20 additions and 16 deletions

View file

@ -112,8 +112,8 @@ namespace Cantera {
/// output the array
inline ostream& operator<<(ostream& s, const ArrayViewer& m) {
int nr = m.nRows();
int nc = m.nColumns();
int nr = static_cast<int>(m.nRows());
int nc = static_cast<int>(m.nColumns());
int i,j;
for (i = 0; i < nr; i++) {
for (j = 0; j < nc; j++) {

View file

@ -611,9 +611,12 @@ namespace Cantera {
void GasKinetics::finalize() {
if (!m_finalized) {
int i, j, nr, np;
m_kdata->falloff_work.resize(m_falloffn.workSize());
m_kdata->concm_3b_values.resize(m_3b_concm.workSize());
m_kdata->concm_falloff_values.resize(m_falloff_concm.workSize());
m_kdata->falloff_work.resize(
static_cast<ctvector_fp::size_t>(m_falloffn.workSize()));
m_kdata->concm_3b_values.resize(
static_cast<ctvector_fp::size_t>(m_3b_concm.workSize()));
m_kdata->concm_falloff_values.resize(
static_cast<ctvector_fp::size_t>(m_falloff_concm.workSize()));
for (i = 0; i < m_ii; i++) {
nr = m_reactants[i].size();

View file

@ -84,9 +84,9 @@ namespace Cantera {
/**
* The number of phases defined within the kinetics
* object.
* object.
*/
int nPhases() const { return m_thermo.size(); }
int nPhases() const { return static_cast<int>(m_thermo.size()); }
/**
* Return the phase index of a phase in the list of phases
@ -215,7 +215,7 @@ namespace Cantera {
* - If no match is found in any phase, the value -2 is returned.
*/
int kineticsSpeciesIndex(string nm, string ph = "<any>") const {
int np = m_thermo.size();
int np = static_cast<int>(m_thermo.size());
int k;
string id;
for (int n = 0; n < np; n++) {
@ -244,7 +244,7 @@ namespace Cantera {
* Will throw an error if the species string doesn't match.
*/
thermo_t& speciesPhase(string nm) {
int np = m_thermo.size();
int np = static_cast<int>(m_thermo.size());
int k;
string id;
for (int n = 0; n < np; n++) {

View file

@ -61,7 +61,7 @@ namespace Cantera {
if (c[i] != 0.0 || R::alwaysComputeRate() ) {
m_rxn.push_back(rxnNumber);
m_rates.push_back(R(m, c));
return m_rates.size() - 1;
return static_cast<int>(m_rates.size()) - 1;
}
}
return -1;

View file

@ -63,7 +63,7 @@ namespace Cantera {
m_high.push_back(v);
m_low.push_back(v);
m_tmid.push_back(c[0]);
m_index[imid] = igrp = m_high.size();
m_index[imid] = igrp = static_cast<int>(m_high.size());
m_ngroups++;
}
doublereal tlow = minTemp;

View file

@ -466,20 +466,20 @@ namespace Cantera {
m_n[rxn] = k.size();
switch (k.size()) {
case 1:
m_loc[rxn] = m_c1_list.size();
m_loc[rxn] = static_cast<int>(m_c1_list.size());
m_c1_list.push_back(C1(rxn, k[0], order[0]));
break;
case 2:
m_loc[rxn] = m_c2_list.size();
m_loc[rxn] = static_cast<int>(m_c2_list.size());
m_c2_list.push_back(C2(rxn, k[0], k[1], order[0], order[1]));
break;
case 3:
m_loc[rxn] = m_c3_list.size();
m_loc[rxn] = static_cast<int>(m_c3_list.size());
m_c3_list.push_back(C3(rxn, k[0], k[1], k[2],
order[0], order[1], order[2]));
break;
default:
m_loc[rxn] = m_cn_list.size();
m_loc[rxn] = static_cast<int>(m_cn_list.size());
m_cn_list.push_back(C_AnyN(rxn, k, order));
}
}

View file

@ -32,7 +32,8 @@ namespace Cantera {
doublereal dflt=1.0) {
m_n++;
m_reaction_index.push_back( rxnNumber );
m_concm.push_back( _E( enhanced.size(), enhanced, dflt ) );
m_concm.push_back( _E(static_cast<int>(enhanced.size()),
enhanced, dflt ) );
}
void update(const vector_fp& conc, doublereal ctot, workPtr work) {