From abb33063d23548bc19c442660370d6d819e5acaa Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Fri, 2 Jul 2004 15:26:01 +0000 Subject: [PATCH] static_cast to eliminate VC++ warnings. --- Cantera/src/oneD/MultiNewton.cpp | 4 ++-- Cantera/src/oneD/Sim1D.cpp | 12 ++++++------ Cantera/src/oneD/StFlow.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cantera/src/oneD/MultiNewton.cpp b/Cantera/src/oneD/MultiNewton.cpp index f2948ac08..2774640bb 100644 --- a/Cantera/src/oneD/MultiNewton.cpp +++ b/Cantera/src/oneD/MultiNewton.cpp @@ -69,7 +69,7 @@ namespace Cantera { } MultiNewton::~MultiNewton() { - int n = m_workarrays.size(); + int n = static_cast(m_workarrays.size()); int i; for (i = 0; i < n; i++) { delete[] m_workarrays[i]; @@ -81,7 +81,7 @@ namespace Cantera { */ void MultiNewton::resize(int sz) { m_n = sz; - int n = m_workarrays.size(); + int n = static_cast(m_workarrays.size()); int i; for (i = 0; i < n; i++) { delete[] m_workarrays[i]; diff --git a/Cantera/src/oneD/Sim1D.cpp b/Cantera/src/oneD/Sim1D.cpp index 8946e019b..8c4d617be 100644 --- a/Cantera/src/oneD/Sim1D.cpp +++ b/Cantera/src/oneD/Sim1D.cpp @@ -55,8 +55,8 @@ namespace Cantera { * @param value the value. */ void Sim1D::setValue(int dom, int comp, int localPoint, doublereal value) { - int iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); - m_x[iloc] = value; + size_t iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); + m_x[static_cast(iloc)] = value; } @@ -67,13 +67,13 @@ namespace Cantera { * the leftmost grid point in the domain. */ doublereal Sim1D::value(int dom, int comp, int localPoint) const { - int iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); - return m_x[iloc]; + size_t iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); + return m_x[static_cast(iloc)]; } doublereal Sim1D::workValue(int dom, int comp, int localPoint) const { - int iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); - return m_xnew[iloc]; + size_t iloc = domain(dom).loc() + domain(dom).index(comp, localPoint); + return m_xnew[static_cast(iloc)]; } diff --git a/Cantera/src/oneD/StFlow.cpp b/Cantera/src/oneD/StFlow.cpp index 05227acc7..deade2bac 100644 --- a/Cantera/src/oneD/StFlow.cpp +++ b/Cantera/src/oneD/StFlow.cpp @@ -22,7 +22,7 @@ #include "StFlow.h" #include "../ArrayViewer.h" -#include "ctml.h" +#include "../ctml.h" #include "MultiJac.h" using namespace ctml; @@ -758,7 +758,7 @@ namespace Cantera { vector str; dom.getChildren("string",str); - int nstr = str.size(); + int nstr = static_cast(str.size()); for (int istr = 0; istr < nstr; istr++) { const XML_Node& nd = *str[istr]; writelog(nd["title"]+": "+nd.value()+"\n"); @@ -772,7 +772,7 @@ namespace Cantera { vector d; dom.child("grid_data").getChildren("floatArray",d); - int nd = d.size(); + int nd = static_cast(d.size()); vector_fp x; int n, np = 0, j, ks, k; @@ -866,7 +866,7 @@ namespace Cantera { if (ignored.size() != 0) { writelog("\n\n"); writelog("Ignoring datasets:\n"); - int nn = ignored.size(); + int nn = static_cast(ignored.size()); for (int n = 0; n < nn; n++) { writelog(ignored[n]+" "); } @@ -905,7 +905,7 @@ namespace Cantera { addFloat(flow, "pressure", m_press, "Pa", "pressure"); addFloatArray(gv,"z",m_z.size(),m_z.begin(), "m","length"); - vector_fp x(soln.nColumns()); + vector_fp x(static_cast(soln.nColumns())); soln.getRow(0,x.begin()); addFloatArray(gv,"u",x.size(),x.begin(),"m/s","velocity");