Skip cast from size_t to int when calling int2str

This commit is contained in:
Ray Speth 2012-02-27 18:14:17 +00:00
parent af6303a67e
commit b955395ed1
21 changed files with 38 additions and 38 deletions

View file

@ -187,7 +187,7 @@ public:
if (m_name[n] != "") {
return m_name[n];
} else {
return "component " + int2str(int(n));
return "component " + int2str(n);
}
}
@ -221,7 +221,7 @@ public:
if (nl < m_nv || nu < m_nv)
throw CanteraError("Domain1D::setBounds",
"wrong array size for solution bounds. "
"Size should be at least "+int2str(int(m_nv)));
"Size should be at least "+int2str(m_nv));
std::copy(upper, upper + m_nv, m_max.begin());
std::copy(lower, lower + m_nv, m_min.begin());
}
@ -477,7 +477,7 @@ public:
if (m_id != "") {
return m_id;
} else {
return std::string("domain ") + int2str(int(m_index));
return std::string("domain ") + int2str(m_index);
}
}

View file

@ -42,8 +42,8 @@ public:
*
*/
SpeciesRangeError(std::string func, size_t k, size_t kmax) :
CanteraError(func, "Species index " + int2str(int(k)) +
" outside valid range of 0 to " + int2str(int(kmax)-1)) {}
CanteraError(func, "Species index " + int2str(k) +
" outside valid range of 0 to " + int2str(kmax-1)) {}
};
/******************************************************************/

View file

@ -1046,7 +1046,7 @@ void Application::thread_complete()
XML_Node* get_XML_File(std::string file, int debug)
{
XML_Node* xtmp = app()->get_XML_File(file, debug) ;
//writelog("get_XML_File: returned from app:get_XML_FILE " + int2str(int(xtmp)) + "\n");
//writelog("get_XML_File: returned from app:get_XML_FILE " + int2str(xtmp) + "\n");
return xtmp;
}
@ -1626,12 +1626,12 @@ CanteraError::~CanteraError() throw()
ArraySizeError::ArraySizeError(std::string proc, size_t sz, size_t reqd) :
CanteraError(proc, "Array size ("+int2str(int(sz))+
") too small. Must be at least "+int2str(int(reqd))) {}
CanteraError(proc, "Array size ("+int2str(sz)+
") too small. Must be at least "+int2str(reqd)) {}
ElementRangeError::ElementRangeError(std::string func, size_t m, size_t mmax) :
CanteraError(func, "Element index " + int2str(int(m)) +
" outside valid range of 0 to " + int2str(int(mmax-1))) {}
CanteraError(func, "Element index " + int2str(m) +
" outside valid range of 0 to " + int2str(mmax-1)) {}

View file

@ -163,7 +163,7 @@ public:
if (n < data.size()) {
return *data[n];
} else {
throw Cantera::CanteraError("item","index out of range"+Cantera::int2str(int(n)));
throw Cantera::CanteraError("item","index out of range"+Cantera::int2str(n));
}
}

View file

@ -22,7 +22,7 @@ static bool checkSpecies(int i, size_t k)
try {
if (k >= mixCabinet::item(i).nSpecies())
throw CanteraError("checkSpecies",
"illegal species index ("+int2str(int(k))+") ");
"illegal species index ("+int2str(k)+") ");
return true;
} catch (CanteraError) {
return false;
@ -34,7 +34,7 @@ static bool checkElement(int i, size_t m)
try {
if (m >= mixCabinet::item(i).nElements())
throw CanteraError("checkElement",
"illegal element index ("+int2str(int(m))+") ");
"illegal element index ("+int2str(m)+") ");
return true;
} catch (CanteraError) {
return false;

View file

@ -294,7 +294,7 @@ extern "C" {
// array not big enough
if (n < nv) {
throw CanteraError("ctml_getFloatArray",
"array must be dimensioned at least "+int2str(int(nv)));
"array must be dimensioned at least "+int2str(nv));
}
for (size_t i = 0; i < nv; i++) {

View file

@ -635,7 +635,7 @@ void AqueousKinetics::installGroups(size_t irxn,
const vector<grouplist_t>& p)
{
if (!r.empty()) {
writelog("installing groups for reaction "+int2str(int(reactionNumber())));
writelog("installing groups for reaction "+int2str(reactionNumber()));
m_rgroups[reactionNumber()] = r;
m_pgroups[reactionNumber()] = p;
}

View file

@ -837,7 +837,7 @@ void GasKinetics::installGroups(size_t irxn,
const vector<grouplist_t>& r, const vector<grouplist_t>& p)
{
if (!r.empty()) {
writelog("installing groups for reaction "+int2str(int(reactionNumber())));
writelog("installing groups for reaction "+int2str(reactionNumber()));
m_rgroups[reactionNumber()] = r;
m_pgroups[reactionNumber()] = p;
}

View file

@ -390,7 +390,7 @@ void InterfaceKinetics::updateKc()
size_t irxn = m_revindex[i];
if (irxn == npos || irxn >= nReactions()) {
throw CanteraError("InterfaceKinetics",
"illegal value: irxn = "+int2str(int(irxn)));
"illegal value: irxn = "+int2str(irxn));
}
m_rkc[irxn] = exp(m_rkc[irxn]*rrt);
}
@ -1322,7 +1322,7 @@ void InterfaceKinetics::finalize()
if (m_surf->nDim() != 2)
throw CanteraError("InterfaceKinetics::finalize",
"expected interface dimension = 2, but got dimension = "
+int2str(int(m_surf->nDim())));
+int2str(m_surf->nDim()));
@ -1477,7 +1477,7 @@ void EdgeKinetics::finalize()
if (m_surf->nDim() != 1)
throw CanteraError("EdgeKinetics::finalize",
"expected interface dimension = 1, but got dimension = "
+int2str(int(m_surf->nDim())));
+int2str(m_surf->nDim()));
m_finalized = true;
}
//================================================================================================

View file

@ -280,7 +280,7 @@ size_t Kinetics::speciesPhaseIndex(size_t k)
return n;
}
}
throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(int(k)));
throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(k));
return -1;
}

View file

@ -152,7 +152,7 @@ static doublereal ppow(doublereal x, doublereal order)
inline static std::string fmt(std::string r, size_t n)
{
return r + "[" + int2str(int(n)) + "]";
return r + "[" + int2str(n) + "]";
}

View file

@ -873,7 +873,7 @@ bool rxninfo::installReaction(int i, const XML_Node& r, Kinetics* k,
|| (c < 0.0 && m_rev[nn])) {
if ((!dup || !m_dup[nn])) {
string msg = string("Undeclared duplicate reactions detected: \n")
+"Reaction "+int2str(int(nn)+1)+": "+m_eqn[nn]
+"Reaction "+int2str(nn+1)+": "+m_eqn[nn]
+"\nReaction "+int2str(i+1)+": "+eqn+"\n";
throw CanteraError("installReaction", msg);
}

View file

@ -17,7 +17,7 @@ setTolerances(size_t nr, const doublereal* rtol,
if (nr < m_nv || na < m_nv)
throw CanteraError("Domain1D::setTolerances",
"wrong array size for solution error tolerances. "
"Size should be at least "+int2str(int(m_nv)));
"Size should be at least "+int2str(m_nv));
if (ts >= 0) {
copy(rtol, rtol + m_nv, m_rtol_ss.begin());
copy(atol, atol + m_nv, m_atol_ss.begin());

View file

@ -142,11 +142,11 @@ void MultiNewton::step(doublereal* x, doublereal* step,
"Jacobian is singular for domain "+
dom.id() + ", component "
+dom.componentName(comp)+" at point "
+int2str(int(pt))+"\n(Matrix row "
+int2str(int(iok))+") \nsee file bandmatrix.csv\n");
+int2str(pt)+"\n(Matrix row "
+int2str(iok)+") \nsee file bandmatrix.csv\n");
} else if (int(iok) < 0)
throw CanteraError("MultiNewton::step",
"iok = "+int2str(int(iok)));
"iok = "+int2str(iok));
#ifdef DEBUG_STEP
bool ok = false;

View file

@ -97,7 +97,7 @@ doublereal Sim1D::value(size_t dom, size_t comp, size_t localPoint) const
}
if (j >= (int) m_x.size()) {
throw CanteraError("Sim1D::value", "exceeded top of bounds: " + int2str(j) +
" >= " + int2str(int(m_x.size())));
" >= " + int2str(m_x.size()));
}
#endif
return m_x[iloc];
@ -291,7 +291,7 @@ void Sim1D::solve(int loglevel, bool refine_grid)
writelog(" success.\n\n");
writelog("Problem solved on [");
for (size_t mm = 1; mm < nDomains(); mm+=2) {
writelog(int2str(int(domain(mm).nPoints())));
writelog(int2str(domain(mm).nPoints()));
if (mm + 2 < nDomains()) {
writelog(", ");
}

View file

@ -39,7 +39,7 @@ void importSolution(size_t points,
if (size_new < nv_new*points) {
throw CanteraError("importSolution",
"new solution array must have length "+
int2str(int(nv_new*points)));
int2str(nv_new*points));
}
size_t n, j, knew;
@ -1068,7 +1068,7 @@ void StFlow::restore(const XML_Node& dom, doublereal* soln)
if (nm == "z") {
getFloatArray(fa,x,false);
np = x.size();
writelog("Grid contains "+int2str(int(np))+
writelog("Grid contains "+int2str(np)+
" points.\n");
readgrid = true;
setupGrid(np, DATA_PTR(x));

View file

@ -53,7 +53,7 @@ int Refiner::analyze(size_t n, const doublereal* z,
{
if (n >= m_npmax) {
writelog("max number of grid points reached ("+int2str(int(m_npmax))+".\n");
writelog("max number of grid points reached ("+int2str(m_npmax)+".\n");
return -2;
}
@ -183,11 +183,11 @@ int Refiner::analyze(size_t n, const doublereal* z,
dz[j] = z[j+1] - z[j];
if (dz[j] > m_ratio*dz[j-1]) {
m_loc[j] = 1;
m_c["point "+int2str(int(j))] = 1;
m_c["point "+int2str(j)] = 1;
}
if (dz[j] < dz[j-1]/m_ratio) {
m_loc[j-1] = 1;
m_c["point "+int2str(int(j)-1)] = 1;
m_c["point "+int2str(j-1)] = 1;
}
//if (m_loc.size() + n > m_npmax) goto done;
}
@ -212,7 +212,7 @@ void Refiner::show()
+" New points inserted after grid points ");
map<size_t, int>::const_iterator b = m_loc.begin();
for (; b != m_loc.end(); ++b) {
writelog(int2str(int(b->first))+" ");
writelog(int2str(b->first)+" ");
}
writelog("\n");
writelog(" to resolve ");

View file

@ -199,7 +199,7 @@ void GeneralSpeciesThermo::install_STIT(SpeciesThermoInterpType* stit_ptr)
m_kk = index+1;
}
AssertThrow(m_sp[index] == 0,
"Index position isn't null, duplication of assignment: " + int2str(int(index)));
"Index position isn't null, duplication of assignment: " + int2str(index));
/*
* Now, simply assign the position
*/

View file

@ -275,7 +275,7 @@ void State::init(const vector_fp& mw)
if (m_molwts[k] < 0.0) {
throw CanteraError("State::init",
"negative molecular weight for species number "
+ int2str(int(k)));
+ int2str(k));
}
/*
* Some surface phases may define species representing

View file

@ -343,7 +343,7 @@ void Reactor::addSensitivityReaction(size_t rxn)
m_mult_save.push_back(1.0);
if (rxn >= m_kin->nReactions())
throw CanteraError("Reactor::addSensitivityReaction",
"Reaction number out of range ("+int2str(int(rxn))+")");
"Reaction number out of range ("+int2str(rxn)+")");
}

View file

@ -139,7 +139,7 @@ void Wall::addSensitivityReaction(int leftright, size_t rxn)
{
if (rxn >= m_chem[leftright]->nReactions())
throw CanteraError("Wall::addSensitivityReaction",
"Reaction number out of range ("+int2str(int(rxn))+")");
"Reaction number out of range ("+int2str(rxn)+")");
if (leftright == 0) {
m_pleft.push_back(rxn);
m_leftmult_save.push_back(1.0);