removed using namespace statements from Cantera header files, and fully qualified most members of std (string, vector< >, etc.) in header files. User programs may need to have "using namespace" statements added.

This commit is contained in:
Dave Goodwin
2006-11-27 21:43:30 +00:00
parent 85151c2a98
commit ce73f8bacd
150 changed files with 900 additions and 890 deletions

View File

@@ -19,7 +19,7 @@
* is retrieved from the list by the interface function, the desired
* method is invoked, and the result returned to the non-C++ calling
* procedure. By storing the pointers in a 'cabinet', there is no need
* to encode them in a string or integer and pass them out to the
* to encode them in a std::string or integer and pass them out to the
* non-C++ calling routine, as some other interfacing schemes do.
*
* The Cabinet<M> class can be used to store pointers to any class
@@ -102,7 +102,7 @@ public:
__table.push_back(new M(*old));
return static_cast<int>(__table.size()) - 1;
}
catch (CanteraError) {return -1;}
catch (Cantera::CanteraError) {return -1;}
catch (...) {return -999;}
}
@@ -119,7 +119,7 @@ public:
*dest = *src;
return 0;
}
catch (CanteraError) {return -1;}
catch (Cantera::CanteraError) {return -1;}
catch (...) {return -999;}
}
@@ -150,7 +150,7 @@ public:
__table[n] = __table[0];
}
else {
throw CanteraError("Cabinet<M>::del",
throw Cantera::CanteraError("Cabinet<M>::del",
"Attempt made to delete an already-deleted object.");
}
}
@@ -163,7 +163,7 @@ public:
if (n >= 0 && n < int(__table.size()))
return __table[n];
else {
throw CanteraError("item","index out of range"+int2str(n));
throw Cantera::CanteraError("item","index out of range"+Cantera::int2str(n));
return __table[0];
}
}

View File

@@ -19,11 +19,11 @@ public:
virtual ~Storage();
// vectors to hold pointers to objects
vector<Kinetics*> __ktable;
vector<thermo_t*> __thtable;
vector<Transport*> __trtable;
std::vector<Cantera::Kinetics*> __ktable;
std::vector<Cantera::thermo_t*> __thtable;
std::vector<Cantera::Transport*> __trtable;
map<string, int> __thmap;
std::map<std::string, int> __thmap;
static Storage* storage() {
if (__storage == 0) {
@@ -33,9 +33,9 @@ public:
}
int addThermo(ThermoPhase* th);
int addKinetics(Kinetics* kin);
int addTransport(Transport* tr);
int addThermo(Cantera::ThermoPhase* th);
int addKinetics(Cantera::Kinetics* kin);
int addTransport(Cantera::Transport* tr);
// int addNewTransport(int model, char* dbase, int th, int loglevel);
int clear();
void deleteKinetics(int n);
@@ -45,23 +45,23 @@ public:
static Storage* __storage;
};
inline ThermoPhase* ph(int n) {
inline Cantera::ThermoPhase* ph(int n) {
return Storage::__storage->__thtable[n];
}
inline Kinetics* kin(int n) {
inline Cantera::Kinetics* kin(int n) {
return Storage::__storage->__ktable[n];
}
inline ThermoPhase* th(int n) {
inline Cantera::ThermoPhase* th(int n) {
return Storage::__storage->__thtable[n];
}
inline int thermo_index(string id) {
inline int thermo_index(std::string id) {
return Storage::__storage->__thmap[id];
}
inline Transport* trans(int n) {
inline Cantera::Transport* trans(int n) {
return Storage::__storage->__trtable[n];
}

View File

@@ -17,4 +17,9 @@
#define ERR -999
#define DERR -999.999
namespace Cantera {}
using namespace Cantera;
namespace std {}
using namespace std;
#endif

View File

@@ -29,6 +29,9 @@
#include "clib_defs.h"
using namespace std;
using namespace Cantera;
inline XML_Node* _xml(int i) {
return Cabinet<XML_Node>::cabinet(false)->item(i);
}

View File

@@ -4,6 +4,13 @@
#include <cantera/kernel/Array.h>
#include <cantera/kernel/plots.h>
namespace Cantera{}
using namespace Cantera;
namespace std{}
using namespace std;
namespace CanteraZeroD{}
using namespace CanteraZeroD;
// Save the temperature, density, pressure, and mole fractions at one
// time
template<class G, class A>

View File

@@ -7,6 +7,7 @@
#include <cantera/PureFluid.h> // defines class Water
using namespace Cantera;
using namespace std;
map<string,double> h;
map<string,double> s;

View File

@@ -2,9 +2,6 @@
#ifndef CANTERA_H_INCL
#define CANTERA_H_INCL
namespace std{}
using namespace std;
// definitions
#define CANTERA_APP
#include "kernel/ct_defs.h"
@@ -21,8 +18,6 @@ using namespace std;
// The Cantera logger class
#include "kernel/logger.h"
//using namespace Cantera;
#endif

View File

@@ -13,7 +13,7 @@ namespace Cantera {
public EdgePhase, public EdgeKinetics
{
public:
Edge(string infile, string id, vector<ThermoPhase*> phases)
Edge(std::string infile, std::string id, std::vector<ThermoPhase*> phases)
: m_ok(false), m_r(0) {
m_r = get_XML_File(infile);

View File

@@ -28,8 +28,8 @@ namespace Cantera {
bool operator!() { return !m_ok;}
bool ready() const { return m_ok; }
friend ostream& operator<<(ostream& s, GRI30& mix) {
string r = report(mix, true);
friend std::ostream& operator<<(std::ostream& s, GRI30& mix) {
std::string r = report(mix, true);
s << r;
return s;
}

View File

@@ -16,7 +16,7 @@ namespace Cantera {
IdealGasMix() : m_ok(false), m_r(0) {}
IdealGasMix(string infile, string id="") : m_ok(false), m_r(0) {
IdealGasMix(std::string infile, std::string id="") : m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
if (id == "-") id = "";
@@ -26,7 +26,7 @@ namespace Cantera {
}
IdealGasMix(XML_Node& root, string id) : m_ok(false), m_r(0) {
IdealGasMix(XML_Node& root, std::string id) : m_ok(false), m_r(0) {
m_ok = buildSolutionFromXML(root, id, "phase", this, this);
}
@@ -34,8 +34,8 @@ namespace Cantera {
bool operator!() { return !m_ok;}
bool ready() const { return m_ok; }
friend ostream& operator<<(ostream& s, IdealGasMix& mix) {
string r = report(mix, true);
friend std::ostream& operator<<(std::ostream& s, IdealGasMix& mix) {
std::string r = report(mix, true);
s << r;
return s;
}

View File

@@ -11,7 +11,7 @@ namespace Cantera {
class IncompressibleSolid : public ConstDensityThermo
{
public:
IncompressibleSolid(string infile, string id="") : m_ok(false), m_r(0) {
IncompressibleSolid(std::string infile, std::string id="") : m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
if (id == "-") id = "";
@@ -26,8 +26,8 @@ namespace Cantera {
bool operator!() { return !m_ok;}
bool ready() { return m_ok; }
//friend ostream& operator<<(ostream& s, IdealGasMix& mix) {
// string r = report(mix, true);
//friend std::ostream& operator<<(std::ostream& s, IdealGasMix& mix) {
// std::string r = report(mix, true);
// s << r;
// return s;

View File

@@ -13,7 +13,7 @@ namespace Cantera {
public SurfPhase, public InterfaceKinetics
{
public:
Interface(string infile, string id, vector<ThermoPhase*> phases)
Interface(std::string infile, std::string id, std::vector<ThermoPhase*> phases)
: m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
@@ -41,8 +41,8 @@ namespace Cantera {
private:
};
inline Interface* importInterface(string infile, string id,
vector<ThermoPhase*> phases) {
inline Interface* importInterface(std::string infile, std::string id,
std::vector<ThermoPhase*> phases) {
return new Interface(infile, id, phases);
}

View File

@@ -11,7 +11,7 @@ namespace Cantera {
class Metal : public MetalPhase
{
public:
Metal(string infile, string id="") : m_ok(false), m_r(0) {
Metal(std::string infile, std::string id="") : m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
if (id == "-") id = "";
@@ -26,8 +26,8 @@ namespace Cantera {
bool operator!() { return !m_ok;}
bool ready() { return m_ok; }
//friend ostream& operator<<(ostream& s, IdealGasMix& mix) {
// string r = report(mix, true);
//friend std::ostream& operator<<(std::ostream& s, IdealGasMix& mix) {
// std::string r = report(mix, true);
// s << r;
// return s;

View File

@@ -17,7 +17,7 @@ namespace Cantera {
PureFluid() : m_ok(false), m_r(0) {}
PureFluid(string infile, string id="") : m_ok(false), m_r(0) {
PureFluid(std::string infile, std::string id="") : m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
if (id == "-") id = "";
@@ -27,7 +27,7 @@ namespace Cantera {
}
PureFluid(XML_Node& root, string id) : m_ok(false), m_r(0) {
PureFluid(XML_Node& root, std::string id) : m_ok(false), m_r(0) {
m_ok = buildSolutionFromXML(root, id, "phase", this, 0);
}
@@ -35,8 +35,8 @@ namespace Cantera {
bool operator!() { return !m_ok;}
bool ready() const { return m_ok; }
friend ostream& operator<<(ostream& s, PureFluid& mix) {
string r = report(mix, true);
friend std::ostream& operator<<(std::ostream& s, PureFluid& mix) {
std::string r = report(mix, true);
s << r;
return s;
}
@@ -50,7 +50,7 @@ namespace Cantera {
class Water : public PureFluid {
public:
Water() : PureFluid(string("liquidvapor.cti"),string("water")) {}
Water() : PureFluid(std::string("liquidvapor.cti"),std::string("water")) {}
virtual ~Water() {}
};

View File

@@ -8,7 +8,7 @@
namespace Cantera {
ThermoPhase* importPhase(string infile, string id="") {
ThermoPhase* importPhase(std::string infile, std::string id="") {
ThermoPhase* p = newPhase(infile, id);
return p;
}

View File

@@ -8,7 +8,7 @@
#include "kernel/zeroD/FlowReactor.h"
#include "kernel/zeroD/ConstPressureReactor.h"
using namespace CanteraZeroD;
//using namespace CanteraZeroD;
#endif

View File

@@ -7,6 +7,8 @@
#include "ThermoPhase.h"
#include <stdio.h>
using namespace std;
namespace Cantera {
/**

View File

@@ -20,4 +20,9 @@
typedef integer status_t;
namespace Cantera {}
using namespace Cantera;
namespace std{}
using namespace std;
#endif

View File

@@ -131,9 +131,6 @@ namespace Cantera {
* Evaluate a*x + y.
*/
void axpy(doublereal a, const Array2D& x, const Array2D& y) {
//const doublereal* xb = x.begin();
//const doublereal* yb = y.begin();
//doublereal* b = begin();
iterator b = begin();
const_iterator xb = x.begin();
const_iterator yb = y.begin();
@@ -189,7 +186,7 @@ namespace Cantera {
};
/// output the array
inline ostream& operator<<(ostream& s, const Array2D& m) {
inline std::ostream& operator<<(std::ostream& s, const Array2D& m) {
int nr = static_cast<int>(m.nRows());
int nc = static_cast<int>(m.nColumns());
int i,j;
@@ -197,7 +194,7 @@ namespace Cantera {
for (j = 0; j < nc; j++) {
s << m(i,j) << ", ";
}
s << endl;
s << std::endl;
}
return s;
}

View File

@@ -122,7 +122,7 @@ namespace Cantera {
};
/// output the array
inline ostream& operator<<(ostream& s, const ArrayViewer& m) {
inline std::ostream& operator<<(std::ostream& s, const ArrayViewer& m) {
int nr = static_cast<int>(m.nRows());
int nc = static_cast<int>(m.nColumns());
int i,j;
@@ -130,7 +130,7 @@ namespace Cantera {
for (j = 0; j < nc; j++) {
s << m(i,j) << ", ";
}
s << endl;
s << std::endl;
}
return s;
}

View File

@@ -11,11 +11,6 @@
#pragma warning(disable:4503)
#endif
//#include <iostream>
//#include <vector>
//using namespace std;
#include "BandMatrix.h"
#include "ctlapack.h"
#include "utilities.h"
@@ -23,6 +18,8 @@
#include "stringUtils.h"
#include "global.h"
using namespace std;
namespace Cantera {
@@ -140,42 +137,11 @@ namespace Cantera {
ofstream fout("bandmatrix.csv");
fout << *this << endl;
fout.close();
//error("DGBTRF returned info = "+int2str(info)+".\n"
// +"Matrix written to file bandmatrix.csv\n");
//throw CanteraError("BandMatrix::factor",
// "DGBTRF returned info = "+int2str(info)+".\n"
// +"Matrix written to file bandmatrix.csv\n");
}
return info;
}
/**
* Solve the linear system Ax = b, where A is this matrix.
* Calls LAPACK subroutine DGBTRS.
*/
// void BandMatrix::solve(const vector_fp& b, vector_fp& x) {
// int info = 0;
// copy(b.begin(), b.end(), x.begin()); // b -> x
// // If the matrix has been modified since the last LU decomposition,
// // then do it now.
// if (!m_factored) factor();
// ct_dgbtrs(ctlapack::NoTranspose, columns(), nSubDiagonals(),
// nSuperDiagonals(), 1, ludata.begin(), ldim(), ipiv().begin(),
// x.begin(), columns(), info);
// // error handling
// if (info != 0) {
// ofstream fout("bandmatrix.csv");
// fout << *this << endl;
// fout.close();
// throw CanteraError("BandMatrix::solve",
// "DGBTRS returned info = "+int2str(info)+".\n"
// +"Matrix written to file bandmatrix.csv\n");
// }
// }
int BandMatrix::solve(int n, const doublereal* b, doublereal* x) {
copy(b, b+n, x);
@@ -195,9 +161,6 @@ namespace Cantera {
ofstream fout("bandmatrix.csv");
fout << *this << endl;
fout.close();
//throw CanteraError("BandMatrix::solve",
// "DGBTRS returned info = "+int2str(info)+".\n"
// +"Matrix written to file bandmatrix.csv\n");
}
return info;
}
@@ -207,7 +170,6 @@ namespace Cantera {
int nc = m.columns();
int i,j;
for (i = 0; i < nr; i++) {
//s << "Row " << i+1 << ": ";
for (j = 0; j < nc; j++) {
s << m(i,j) << ", ";
}
@@ -215,18 +177,5 @@ namespace Cantera {
}
return s;
}
/**
* Solve Ax = b. Array b is overwritten on exit with x.
*/
// int bsolve(BandMatrix& A, double* b) {
// int info=0;
// A.ludata = A.data;
// ct_dgbsv(A.columns(), A.nSubDiagonals(), A.nSuperDiagonals(),
// 1, A.ludata.begin(), A.ldim(), A.ipiv().begin(), b,
// A.columns(), info);
// A.m_factored = true;
// return info;
// }
}

View File

@@ -146,12 +146,7 @@ namespace Cantera {
};
ostream& operator<<(ostream& s, const BandMatrix& m);
/**
* Solve Ax = b. Array b is overwritten on exit with x.
*/
// int bsolve(BandMatrix& A, double* b);
std::ostream& operator<<(std::ostream& s, const BandMatrix& m);
}

View File

@@ -28,7 +28,6 @@
#ifdef SUNDIALS_VERSION_22
#include <nvector_serial.h>
#else
//#include <sundials/config.h>
#include <sundials/sundials_nvector.h>
#endif
@@ -41,7 +40,7 @@ namespace Cantera {
*/
class CVodesErr : public CanteraError {
public:
CVodesErr(string msg) : CanteraError("CVodesIntegrator", msg){}
CVodesErr(std::string msg) : CanteraError("CVodesIntegrator", msg){}
};

View File

@@ -17,7 +17,7 @@
#include "ct_defs.h"
using namespace std;
//using namespace std;
#include "SpeciesThermo.h"
#include "ctexceptions.h"
@@ -33,7 +33,7 @@ namespace Cantera {
class SpeciesRangeError : public CanteraError {
public:
SpeciesRangeError(string func, int k, int kmax) :
SpeciesRangeError(std::string func, int k, int kmax) :
CanteraError(func, "Species index " + int2str(k) +
" outside valid range of 0 to " + int2str(kmax-1)) {}
};
@@ -75,7 +75,7 @@ namespace Cantera {
/// \param m Element index.
/// \exception If m < 0 or m >= nElements(), the
/// exception, ElementRangeError, is thrown.
string elementName(int m) const;
std::string elementName(int m) const;
/// Index of element named 'name'.
@@ -87,7 +87,7 @@ namespace Cantera {
/// If 'name' is not
/// the name of an element in the set, then the value -1 is
/// returned.
int elementIndex(string name) const;
int elementIndex(std::string name) const;
/// Atomic weight of element m.
@@ -97,11 +97,11 @@ namespace Cantera {
int atomicNumber(int m) const;
/// Return a read-only reference to the vector of element names.
const vector<string>& elementNames() const;
const std::vector<std::string>& elementNames() const;
/// Return a read-only reference to the vector of atomic weights.
const array_fp& atomicWeights() const;
const vector_fp& atomicWeights() const;
/// Number of elements.
@@ -122,14 +122,14 @@ namespace Cantera {
//@{
/// Add an element.
/// @param symbol Atomic symbol string.
/// @param symbol Atomic symbol std::string.
/// @param weight Atomic mass in amu.
void addElement(const string& symbol, doublereal weight);
void addElement(const std::string& symbol, doublereal weight);
/// Add an element from an XML specification.
void addElement(const XML_Node& e);
void addUniqueElement(const string& symbol, doublereal weight);
void addUniqueElement(const std::string& symbol, doublereal weight);
void addUniqueElement(const XML_Node& e);
@@ -159,7 +159,7 @@ namespace Cantera {
* Return a const reference to the vector of molecular weights
* of the species
*/
const array_fp& molecularWeights() const;
const vector_fp& molecularWeights() const;
/// Electrical charge of one species k molecule, divided by
@@ -173,21 +173,21 @@ namespace Cantera {
* They are not usually called by user programs.
*/
//@{
void addSpecies(const string& name, const doublereal* comp,
void addSpecies(const std::string& name, const doublereal* comp,
doublereal charge = 0.0, doublereal size = 1.0);
void addUniqueSpecies(const string& name, const doublereal* comp,
void addUniqueSpecies(const std::string& name, const doublereal* comp,
doublereal charge = 0.0,
doublereal size = 1.0);
/**
* Index of species named 'name'. The first species added
* will have index 0, and the last one index nSpecies() - 1.
*/
int speciesIndex(string name) const;
int speciesIndex(std::string name) const;
/// Name of the species with index k
string speciesName(int k) const;
std::string speciesName(int k) const;
/// Return a const referernce to the vector of species names
const vector<string>& speciesNames() const;
const std::vector<std::string>& speciesNames() const;
/**
* size():
* This routine returns the size of species k
@@ -235,7 +235,7 @@ namespace Cantera {
*/
Elements * m_Elements;
vector<string> m_speciesNames;
std::vector<std::string> m_speciesNames;
vector_fp m_speciesComp;
/**
* m_speciesCharge: Vector of species charges

View File

@@ -206,7 +206,7 @@ namespace Cantera {
private:
void warn(string msg) const {
void warn(std::string msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"DAE_Solver called. Nothing done.\n");
}

View File

@@ -158,7 +158,7 @@ namespace Cantera {
*/
virtual void getCreationRates(doublereal* cdot) {
updateROP();
fill(cdot, cdot + m_kk, 0.0);
std::fill(cdot, cdot + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
&m_kdata->m_ropf[0], cdot);
m_irrevProductStoich.incrementSpecies(
@@ -177,7 +177,7 @@ namespace Cantera {
*/
virtual void getDestructionRates(doublereal* ddot) {
updateROP();
fill(ddot, ddot + m_kk, 0.0);
std::fill(ddot, ddot + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
&m_kdata->m_ropr[0], ddot);
m_reactantStoich.incrementSpecies(
@@ -193,7 +193,7 @@ namespace Cantera {
*/
virtual void getNetProductionRates(doublereal* net) {
updateROP();
fill(net, net + m_kk, 0.0);
std::fill(net, net + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
&m_kdata->m_ropnet[0], net);
m_irrevProductStoich.incrementSpecies(
@@ -247,7 +247,7 @@ namespace Cantera {
/**
* Return a string representing the reaction.
*/
virtual string reactionString(int i) const {
virtual std::string reactionString(int i) const {
return m_rxneqn[i];
}
@@ -284,9 +284,9 @@ namespace Cantera {
void updateROP();
const vector<grouplist_t>& reactantGroups(int i)
const std::vector<grouplist_t>& reactantGroups(int i)
{ return m_rgroups[i]; }
const vector<grouplist_t>& productGroups(int i)
const std::vector<grouplist_t>& productGroups(int i)
{ return m_pgroups[i]; }
void _update_rates_T();
@@ -312,9 +312,9 @@ namespace Cantera {
* The first pair is the reactionType of the reaction.
* The second pair is ...
*/
mutable map<int, pair<int, int> > m_index;
mutable std::map<int, std::pair<int, int> > m_index;
vector<int> m_irrev;
std::vector<int> m_irrev;
StoichManagerN m_reactantStoich;
StoichManagerN m_revProductStoich;
@@ -329,16 +329,16 @@ namespace Cantera {
*/
int m_nrev;
map<int, vector<grouplist_t> > m_rgroups;
map<int, vector<grouplist_t> > m_pgroups;
std::map<int, std::vector<grouplist_t> > m_rgroups;
std::map<int, std::vector<grouplist_t> > m_pgroups;
vector<int> m_rxntype;
std::vector<int> m_rxntype;
mutable vector<map<int, doublereal> > m_rrxn;
mutable vector<map<int, doublereal> > m_prxn;
mutable std::vector<std::map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<int, doublereal> > m_prxn;
vector_int m_revindex;
vector<string> m_rxneqn;
std::vector<std::string> m_rxneqn;
/**
* Temporary data storage used in calculating the rates of
@@ -376,12 +376,12 @@ namespace Cantera {
void addGlobalReaction(const ReactionData& r);
void installReagents(const ReactionData& r);
void installGroups(int irxn, const vector<grouplist_t>& r,
const vector<grouplist_t>& p);
void installGroups(int irxn, const std::vector<grouplist_t>& r,
const std::vector<grouplist_t>& p);
void updateKc();
void registerReaction(int rxnNumber, int type, int loc) {
m_index[rxnNumber] = pair<int, int>(type, loc);
m_index[rxnNumber] = std::pair<int, int>(type, loc);
}
void applyButlerVolmerCorrection(doublereal* kf);
bool m_finalized;

View File

@@ -26,6 +26,7 @@
#include "ctexceptions.h"
using namespace ctml;
using namespace std;
#ifdef USE_DGG_CODE
#include <map>

View File

@@ -44,7 +44,7 @@ namespace Cantera {
Elements();
~Elements();
static double LookupWtElements(const string &);
static double LookupWtElements(const std::string &);
/// Atomic weight of element m.
doublereal atomicWeight(int m) const { return m_atomicWeights[m]; }
@@ -73,13 +73,13 @@ namespace Cantera {
*
* @param name String containing the index.
*/
int elementIndex(string name) const;
int elementIndex(std::string name) const;
/*
* Name of the element with index \c m. @param m Element 11111
* index. If m < 0 or m >= nElements() an exception is thrown.
*/
string elementName(int m) const;
std::string elementName(int m) const;
/* elementNames() */
/** Returns a string vector containing the element names
@@ -88,12 +88,12 @@ namespace Cantera {
* @return <tt> const vector<string>& </tt>: The vector contains
* the element names in their indexed order.
*/
const vector<string>& elementNames() const {
const std::vector<std::string>& elementNames() const {
return m_elementNames;
}
/// Add an element.
void addElement(const string& symbol,
void addElement(const std::string& symbol,
doublereal weight = -12345.0);
void addElement(const XML_Node& e);
@@ -101,7 +101,7 @@ namespace Cantera {
* Add an element only if the element hasn't been added before.
* This is accomplished via a string match on symbol.
*/
void addUniqueElement(const string& symbol,
void addUniqueElement(const std::string& symbol,
doublereal weight = -12345.0, int atomicNumber = 0);
void addUniqueElement(const XML_Node& e);
@@ -166,7 +166,7 @@ namespace Cantera {
*
* Note, a string search is the primary way to identify elements.
*/
vector<string> m_elementNames;
std::vector<std::string> m_elementNames;
/**
* Number of Constituents Objects that use this object
@@ -184,7 +184,7 @@ namespace Cantera {
/** Vector of pointers to Elements Objects
*
*/
static vector<Elements *> Global_Elements_List;
static std::vector<Elements *> Global_Elements_List;
};

View File

@@ -27,9 +27,9 @@ namespace Cantera {
Enhanced3BConc() : m_n (0), m_deflt (1.0) {}
Enhanced3BConc(int n, const map<int, doublereal>& enhanced,
Enhanced3BConc(int n, const std::map<int, doublereal>& enhanced,
doublereal deflt = 1.0) {
map<int, doublereal>::const_iterator iter;
std::map<int, doublereal>::const_iterator iter;
for (iter = enhanced.begin(); iter != enhanced.end(); ++iter) {
m_index.push_back( iter->first );
m_eff.push_back( iter->second - deflt);

View File

@@ -111,11 +111,11 @@ namespace Cantera {
protected:
vector_int m_rxn, m_rxn0;
vector<Falloff*> m_falloff;
std::vector<Falloff*> m_falloff;
FalloffFactory* m_factory;
vector_int m_loc;
int m_n, m_n0;
vector<vector_fp::difference_type> m_offset;
std::vector<vector_fp::difference_type> m_offset;
size_t m_worksize;
};
}

View File

@@ -219,13 +219,6 @@ namespace Cantera {
get_wdot(&m_kdata->m_ropnet[0], net);
#else
m_rxnstoich->getNetProductionRates(m_kk, &m_kdata->m_ropnet[0], net);
//fill(net, net + m_kk, 0.0);
//m_revProductStoich.incrementSpecies(
// m_kdata->m_ropnet.begin(), net);
//m_irrevProductStoich.incrementSpecies(
// m_kdata->m_ropnet.begin(), net);
//m_reactantStoich.decrementSpecies(
// m_kdata->m_ropnet.begin(), net);
#endif
}
@@ -240,13 +233,6 @@ namespace Cantera {
updateROP();
m_rxnstoich->getCreationRates(m_kk, &m_kdata->m_ropf[0],
&m_kdata->m_ropr[0], cdot);
//fill(cdot, cdot + m_kk, 0.0);
//m_revProductStoich.incrementSpecies(
// m_kdata->m_ropf.begin(), cdot);
//m_irrevProductStoich.incrementSpecies(
// m_kdata->m_ropf.begin(), cdot);
//m_reactantStoich.incrementSpecies(
// m_kdata->m_ropr.begin(), cdot);
}
/**
@@ -282,7 +268,7 @@ namespace Cantera {
return m_index[i].first;
}
virtual string reactionString(int i) const {
virtual std::string reactionString(int i) const {
return m_rxneqn[i];
}
@@ -345,9 +331,9 @@ namespace Cantera {
void updateROP();
const vector<grouplist_t>& reactantGroups(int i)
const std::vector<grouplist_t>& reactantGroups(int i)
{ return m_rgroups[i]; }
const vector<grouplist_t>& productGroups(int i)
const std::vector<grouplist_t>& productGroups(int i)
{ return m_pgroups[i]; }
@@ -367,33 +353,29 @@ namespace Cantera {
Rate1<Arrhenius> m_falloff_high_rates;
Rate1<Arrhenius> m_rates;
mutable map<int, pair<int, int> > m_index;
mutable std::map<int, std::pair<int, int> > m_index;
FalloffMgr m_falloffn;
ThirdBodyMgr<Enhanced3BConc> m_3b_concm;
ThirdBodyMgr<Enhanced3BConc> m_falloff_concm;
vector<int> m_irrev;
//StoichManagerN m_reactantStoich;
//StoichManagerN m_revProductStoich;
//StoichManagerN m_irrevProductStoich;
std::vector<int> m_irrev;
ReactionStoichMgr* m_rxnstoich;
vector<int> m_fwdOrder;
std::vector<int> m_fwdOrder;
int m_nirrev;
int m_nrev;
map<int, vector<grouplist_t> > m_rgroups;
map<int, vector<grouplist_t> > m_pgroups;
std::map<int, std::vector<grouplist_t> > m_rgroups;
std::map<int, std::vector<grouplist_t> > m_pgroups;
vector<int> m_rxntype;
std::vector<int> m_rxntype;
mutable vector<map<int, doublereal> > m_rrxn;
mutable vector<map<int, doublereal> > m_prxn;
mutable std::vector<std::map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<int, doublereal> > m_prxn;
/**
* Difference between the input global reactants order
@@ -404,7 +386,7 @@ namespace Cantera {
vector_fp m_dn;
vector_int m_revindex;
vector<string> m_rxneqn;
std::vector<std::string> m_rxneqn;
GasKineticsData* m_kdata;
@@ -416,22 +398,20 @@ namespace Cantera {
private:
int reactionNumber(){ return m_ii;}
vector<map<int, doublereal> > m_stoich;
std::vector<std::map<int, doublereal> > m_stoich;
void addElementaryReaction(const ReactionData& r);
void addThreeBodyReaction(const ReactionData& r);
void addFalloffReaction(const ReactionData& r);
void installReagents(const ReactionData& r);
//const vector_int& r,
// const vector_int& p, bool reversible);
void installGroups(int irxn, const vector<grouplist_t>& r,
const vector<grouplist_t>& p);
void installGroups(int irxn, const std::vector<grouplist_t>& r,
const std::vector<grouplist_t>& p);
void updateKc();
void registerReaction(int rxnNumber, int type, int loc) {
m_index[rxnNumber] = pair<int, int>(type, loc);
m_index[rxnNumber] = std::pair<int, int>(type, loc);
}
bool m_finalized;
};

View File

@@ -47,7 +47,7 @@ namespace Cantera {
* - c[1] - c[7] coefficients for low T range
* - c[8] - c[14] coefficients for high T range
*/
virtual void install(string name, int index, int type,
virtual void install(std::string name, int index, int type,
const doublereal* c,
doublereal minTemp, doublereal maxTemp,
doublereal refPressure);
@@ -100,7 +100,7 @@ namespace Cantera {
* Note, this object owns the objects, so they are deleted
* in the destructor of this object.
*/
vector<SpeciesThermoInterpType *> m_sp;
std::vector<SpeciesThermoInterpType *> m_sp;
doublereal m_tlow_max;
doublereal m_thigh_min;
doublereal m_p0;

View File

@@ -53,7 +53,8 @@ namespace Cantera {
if (!ok) { m_sign = -999; m_comp.resize(n,0); }
}
ostream& Group::fmt(ostream& s, const vector<string>& esymbols) const {
std::ostream& Group::fmt(std::ostream& s,
const std::vector<std::string>& esymbols) const {
s << "(";
int nm;
bool first = true;

View File

@@ -14,7 +14,7 @@
#include "ct_defs.h"
using namespace std;
//using namespace std;
namespace Cantera {
/**
@@ -86,9 +86,9 @@ namespace Cantera {
friend void verifyInputs(const Group& g1, const Group& g2) {
// if (Debug::on) {
// if (g1.size() != g2.size()) {
// cerr << "Group: size mismatch!" << endl;
// cerr << " group 1 = " << g1 << endl;
// cerr << " group 2 = " << g2 << endl;
// cerr << "Group: size mismatch!" << std::endl;
// cerr << " group 1 = " << g1 << std::endl;
// cerr << " group 2 = " << g2 << std::endl;
// }
// }
}
@@ -116,7 +116,7 @@ namespace Cantera {
return m_comp[m];
}
ostream& fmt(ostream& s, const vector<string>& esymbols) const;
std::ostream& fmt(std::ostream& s, const std::vector<std::string>& esymbols) const;
friend std::ostream& operator<<(std::ostream& s,
const Group& g);

View File

@@ -17,9 +17,10 @@
#endif
#include "ImplicitSurfChem.h"
#include "Integrator.h"
using namespace std;
namespace Cantera {
ImplicitSurfChem::ImplicitSurfChem(vector<InterfaceKinetics*> k)

View File

@@ -43,7 +43,7 @@ namespace Cantera {
/**
* Constructor for multiple surfaces.
*/
ImplicitSurfChem(vector<InterfaceKinetics*> k);
ImplicitSurfChem(std::vector<InterfaceKinetics*> k);
/**
* Destructor. Deletes the integrator.
@@ -96,8 +96,8 @@ namespace Cantera {
*/
void updateState(doublereal* y);
vector<SurfPhase*> m_surf;
vector<InterfaceKinetics*> m_kin;
std::vector<SurfPhase*> m_surf;
std::vector<InterfaceKinetics*> m_kin;
vector_int m_nsp;
vector_int m_surfindex;
int m_nsurf;

View File

@@ -173,7 +173,7 @@ namespace Cantera {
private:
doublereal m_dummy;
void warn(string msg) const {
void warn(std::string msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"Integrator called. Nothing done.\n");
}
@@ -181,7 +181,7 @@ namespace Cantera {
};
// defined in ODE_integrators.cpp
Integrator* newIntegrator(string itype);
Integrator* newIntegrator(std::string itype);
} // namespace

View File

@@ -20,6 +20,8 @@
#include "ImplicitSurfChem.h"
using namespace std;
namespace Cantera {
//////////////////////////////////////////////////////////////////

View File

@@ -85,19 +85,6 @@ namespace Cantera {
virtual int ID() { return cInterfaceKinetics; }
virtual int type() { return cInterfaceKinetics; }
/**
* Set the electric potential in the nth phase.
* @deprecated
*
* @param n phase Index in this kinetics object.
* @param V Electric potential (volts)
*/
// void setElectricPotential(int n, doublereal V) {
// thermo(n).setElectricPotential(V);
// m_redo_rates = true;
// }
///
/// @name Reaction Rates Of Progress
///
@@ -268,7 +255,7 @@ namespace Cantera {
/**
* Return a string representing the reaction.
*/
virtual string reactionString(int i) const {
virtual std::string reactionString(int i) const {
return m_rxneqn[i];
}
@@ -311,9 +298,9 @@ namespace Cantera {
void updateROP();
//const vector<grouplist_t>& reactantGroups(int i)
//const std::vector<grouplist_t>& reactantGroups(int i)
// { return m_rgroups[i]; }
//const vector<grouplist_t>& productGroups(int i)
//const std::vector<grouplist_t>& productGroups(int i)
// { return m_pgroups[i]; }
void _update_rates_T();
@@ -334,7 +321,6 @@ namespace Cantera {
vector_int m_revindex;
Rate1<SurfaceArrhenius> m_rates;
//Rate1<Arrhenius> m_rates;
bool m_redo_rates;
/**
@@ -344,15 +330,10 @@ namespace Cantera {
* The first pair is the reactionType of the reaction.
* The second pair is ...
*/
mutable map<int, pair<int, int> > m_index;
mutable std::map<int, std::pair<int, int> > m_index;
vector<int> m_irrev;
std::vector<int> m_irrev;
// StoichManagerN m_reactantStoich;
//StoichManagerN m_revProductStoich;
//StoichManagerN m_irrevProductStoich;
//StoichManagerN m_globalReactantStoich;
ReactionStoichMgr m_rxnstoich;
int m_nirrev;
@@ -362,10 +343,7 @@ namespace Cantera {
*/
int m_nrev;
// map<int, vector<grouplist_t> > m_rgroups;
//map<int, vector<grouplist_t> > m_pgroups;
vector<int> m_rxntype;
std::vector<int> m_rxntype;
/**
* m_rrxn is a vector of maps. m_rrxn has a length
@@ -376,7 +354,7 @@ namespace Cantera {
* HKM -> mutable because search sometimes creates extra
* entries. To be fixed in future...
*/
mutable vector<map<int, doublereal> > m_rrxn;
mutable std::vector<std::map<int, doublereal> > m_rrxn;
/**
* m_rrxn is a vector of maps. m_rrxn has a length
@@ -385,10 +363,10 @@ namespace Cantera {
* reaction number being the key, and the
* product stoichiometric coefficient being the value.
*/
mutable vector<map<int, doublereal> > m_prxn;
mutable std::vector<std::map<int, doublereal> > m_prxn;
vector<string> m_rxneqn;
std::vector<std::string> m_rxneqn;
/**
* Temporary data storage used in calculating the rates of
@@ -427,12 +405,10 @@ namespace Cantera {
void addGlobalReaction(const ReactionData& r);
void installReagents(const ReactionData& r);
//void installGroups(int irxn, const vector<grouplist_t>& r,
// const vector<grouplist_t>& p);
void updateKc();
void registerReaction(int rxnNumber, int type, int loc) {
m_index[rxnNumber] = pair<int, int>(type, loc);
m_index[rxnNumber] = std::pair<int, int>(type, loc);
}
void applyButlerVolmerCorrection(doublereal* kf);
bool m_finalized;

View File

@@ -171,12 +171,12 @@ namespace Cantera {
* Return the phase index of a phase in the list of phases
* defined within the object.
*
* @param ph string name of the phase
* @param ph std::string name of the phase
*
* If a -1 is returned, then the phase is not defined in
* the Kinetics object.
*/
int phaseIndex(string ph) {
int phaseIndex(std::string ph) {
if (m_phaseindex.find(ph) == m_phaseindex.end()) {
return -1;
}
@@ -285,20 +285,20 @@ namespace Cantera {
}
/**
* Return the string name of the kth species in the kinetics
* Return the std::string name of the kth species in the kinetics
* manager. k is an integer from 0 to ktot - 1, where ktot is
* the number of species in the kinetics manager, which is the
* sum of the number of species in all phases participating in
* the kinetics manager. If k is out of bounds, the string
* the kinetics manager. If k is out of bounds, the std::string
* "<unknown>" is returned.
*/
string kineticsSpeciesName(int k) const;
std::string kineticsSpeciesName(int k) const;
/**
* This routine will look up a species number based on
* the input string nm. The lookup of species will
* the input std::string nm. The lookup of species will
* occur for all phases listed in the kinetics object,
* unless the string ph refers to a specific phase of
* unless the std::string ph refers to a specific phase of
* the object.
*
* return
@@ -308,15 +308,15 @@ namespace Cantera {
* the value -1 is returned.
* - If no match is found in any phase, the value -2 is returned.
*/
int kineticsSpeciesIndex(string nm, string ph = "<any>") const;
int kineticsSpeciesIndex(std::string nm, std::string ph = "<any>") const;
/**
* This function looks up the string name of a species and
* This function looks up the std::string name of a species and
* returns a reference to the ThermoPhase object of the
* phase where the species resides.
* Will throw an error if the species string doesn't match.
* Will throw an error if the species std::string doesn't match.
*/
thermo_t& speciesPhase(string nm);
thermo_t& speciesPhase(std::string nm);
/**
* This function takes as an argument the kineticsSpecies index
@@ -573,10 +573,10 @@ namespace Cantera {
}
/**
* Return a string representing the reaction.
* Return a std::string representing the reaction.
*/
virtual string reactionString(int i) const {
err("reactionString"); return "<null>";
virtual std::string reactionString(int i) const {
err("reactionStd::String"); return "<null>";
}
/**
@@ -633,7 +633,7 @@ namespace Cantera {
* m_thermo -> vector of pointers to ThermoPhase phases
* that participate in the kinetics
* mechanism.
* m_phaseindex -> map containing the string id of each
* m_phaseindex -> map containing the std::string id of each
* ThermoPhase phase as a key and the
* index of the phase within the kinetics
* manager object as the value.
@@ -670,12 +670,12 @@ namespace Cantera {
err("addReaction");
}
virtual const vector<grouplist_t>& reactantGroups(int i) {
virtual const std::vector<grouplist_t>& reactantGroups(int i) {
//err("reactantGroups");
return m_dummygroups;
}
virtual const vector<grouplist_t>& productGroups(int i) {
virtual const std::vector<grouplist_t>& productGroups(int i) {
//err("productGroups");
return m_dummygroups;
}
@@ -752,7 +752,7 @@ namespace Cantera {
* NOTE: These vectors will be wrong if there are real
* stoichiometric coefficients in the expression.
*/
vector<vector_int> m_reactants;
std::vector<vector_int> m_reactants;
/**
* This is a vector of vectors containing the products for
@@ -765,7 +765,7 @@ namespace Cantera {
* NOTE: These vectors will be wrong if there are real
* stoichiometric coefficients in the expression.
*/
vector<vector_int> m_products;
std::vector<vector_int> m_products;
/**
* m_thermo is a vector of pointers to ThermoPhase
@@ -778,7 +778,7 @@ namespace Cantera {
* the source term vector, originating from the reaction
* mechanism.
*/
vector<thermo_t*> m_thermo;
std::vector<thermo_t*> m_thermo;
/**
* m_start is a vector of integers specifying the beginning position
@@ -795,7 +795,7 @@ namespace Cantera {
* returning the index value, so that missing phases return
* -1.
*/
map<string, int> m_phaseindex;
std::map<std::string, int> m_phaseindex;
int m_index;
/**
@@ -814,8 +814,8 @@ namespace Cantera {
private:
vector<grouplist_t> m_dummygroups;
void err(string m) const;
std::vector<grouplist_t> m_dummygroups;
void err(std::string m) const;
};

View File

@@ -23,6 +23,8 @@
#include "EdgeKinetics.h"
#include "importCTML.h"
using namespace std;
namespace Cantera {
KineticsFactory* KineticsFactory::s_factory = 0;

View File

@@ -22,7 +22,7 @@ namespace Cantera {
class UnknownKineticsModel : public CanteraError {
public:
UnknownKineticsModel(string proc, string kineticsModel) :
UnknownKineticsModel(std::string proc, std::string kineticsModel) :
CanteraError(proc, "Specified Kinetics model "
+ kineticsModel +
" does not match any known type.") {}
@@ -51,9 +51,9 @@ namespace Cantera {
* Create a new kinetics manager.
*/
virtual Kinetics* newKinetics(XML_Node& phase,
vector<ThermoPhase*> th);
std::vector<ThermoPhase*> th);
virtual Kinetics* newKinetics(string model);
virtual Kinetics* newKinetics(std::string model);
private:
@@ -66,7 +66,7 @@ namespace Cantera {
* Create a new kinetics manager.
*/
inline Kinetics* newKineticsMgr(XML_Node& phase,
vector<ThermoPhase*> th, KineticsFactory* f=0) {
std::vector<ThermoPhase*> th, KineticsFactory* f=0) {
if (f == 0) {
f = KineticsFactory::factory();
}
@@ -77,7 +77,7 @@ namespace Cantera {
/**
* Create a new kinetics manager.
*/
inline Kinetics* newKineticsMgr(string model, KineticsFactory* f=0) {
inline Kinetics* newKineticsMgr(std::string model, KineticsFactory* f=0) {
if (f == 0) {
f = KineticsFactory::factory();
}

View File

@@ -138,7 +138,7 @@ namespace Cantera {
mutable array_fp m_g0_RT;
mutable array_fp m_s0_R;
doublereal m_press;
string m_vacancy;
std::string m_vacancy;
doublereal m_molar_density;
private:

View File

@@ -17,6 +17,9 @@
#include "SpeciesThermo.h"
#include "importCTML.h"
#include <string>
using namespace std;
namespace Cantera {
doublereal LatticeSolidPhase::

View File

@@ -70,7 +70,7 @@ namespace Cantera {
virtual void setParametersFromXML(const XML_Node& eosdata);
void setLatticeMoleFractions(int n, string x);
void setLatticeMoleFractions(int n, std::string x);
protected:
@@ -80,7 +80,7 @@ namespace Cantera {
doublereal m_press;
doublereal m_molar_density;
int m_nlattice;
vector<LatticePhase*> m_lattice;
std::vector<LatticePhase*> m_lattice;
mutable vector_fp m_x;
private:

View File

@@ -14,6 +14,7 @@
#include "xml.h"
#include "ctml.h"
using namespace std;
using namespace ctml;
namespace Cantera {
@@ -317,7 +318,7 @@ namespace Cantera {
* parameterization for species k into a SpeciesThermo instance,
* getting the information from an XML database.
*/
void installMu0ThermoFromXML(string speciesName,
void installMu0ThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node* Mu0Node_ptr) {

View File

@@ -123,7 +123,7 @@ namespace Cantera {
};
void installMu0ThermoFromXML(string speciesName,
void installMu0ThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node* Mu0Node_ptr);
}

View File

@@ -5,6 +5,8 @@
#include "DenseMatrix.h"
#include "stringUtils.h"
using namespace std;
namespace Cantera {
/// Constructor.

View File

@@ -31,7 +31,7 @@ namespace Cantera {
typedef size_t index_t;
typedef ThermoPhase phase_t;
typedef DenseMatrix array_t;
typedef vector<phase_t*> phase_list;
typedef std::vector<phase_t*> phase_list;
/// Constructor. The constructor takes no arguments, since
/// phases are added using method addPhase.
@@ -57,16 +57,16 @@ namespace Cantera {
int nElements() const { return int(m_nel); }
/// Name of element \a m.
string elementName(int m) const { return m_enames[m]; }
std::string elementName(int m) const { return m_enames[m]; }
/// Index of element with name \a name.
int elementIndex(string name) const { return m_enamemap[name] - 1;}
int elementIndex(std::string name) const { return m_enamemap[name] - 1;}
/// Number of species, summed over all phases.
int nSpecies() const { return int(m_nsp); }
/// Name of species with index \a k.
string speciesName(int k) const { return m_snames[k]; }
std::string speciesName(int k) const { return m_snames[k]; }
/// Number of atoms of element \a m in species \a k.
doublereal nAtoms(int k, int m) {
@@ -216,7 +216,7 @@ namespace Cantera {
void setMolesByName(compositionMap& xMap);
void setMolesByName(const string& x);
void setMolesByName(const std::string& x);
void setMoles(doublereal* n);
@@ -248,7 +248,7 @@ namespace Cantera {
/**
* Vector of the ThermoPhase Pointers.
*/
vector<phase_t*> m_phase;
std::vector<phase_t*> m_phase;
array_t m_atoms;
/**
* Locally storred vector of mole fractions of all species
@@ -257,10 +257,10 @@ namespace Cantera {
vector_fp m_moleFractions;
vector_int m_spphase;
vector_int m_spstart;
vector<string> m_enames;
std::vector<std::string> m_enames;
vector_int m_atomicNumber;
vector<string> m_snames;
mutable map<string, int> m_enamemap;
std::vector<std::string> m_snames;
mutable std::map<std::string, int> m_enamemap;
/**
* Number of phases in the MultiPhase object
*/
@@ -277,7 +277,7 @@ namespace Cantera {
index_t m_nsp;
bool m_init;
int m_eloc;
mutable vector<bool> m_temp_OK;
mutable std::vector<bool> m_temp_OK;
doublereal m_Tmin, m_Tmax;
};
@@ -285,14 +285,14 @@ namespace Cantera {
size_t ip;
for (ip = 0; ip < x.nPhases(); ip++) {
if (x.phase(ip).name() != "") {
s << "*************** " << x.phase(ip).name() << " *****************" << endl;
s << "*************** " << x.phase(ip).name() << " *****************" << std::endl;
}
else {
s << "*************** Phase " << ip << " *****************" << endl;
s << "*************** Phase " << ip << " *****************" << std::endl;
}
s << "Moles: " << x.phaseMoles(ip) << endl;
s << "Moles: " << x.phaseMoles(ip) << std::endl;
s << report(x.phase(ip)) << endl;
s << report(x.phase(ip)) << std::endl;
}
return s;
}

View File

@@ -7,16 +7,6 @@
#include <iostream>
using namespace std;
//#if DARWIN == 1
//#define ISNAN __isnand
//#else
//#ifdef WIN32
//#include <float.h>
//#define ISNAN _isnan
//#else
//#define ISNAN isnan
//#endif
//#endif
namespace Cantera {

View File

@@ -59,7 +59,7 @@ namespace Cantera {
doublereal equilibrate(int XY, doublereal err = 1.0e-9,
int maxsteps = 1000, int loglevel=-99);
string reactionString(index_t j);
std::string reactionString(index_t j);
doublereal error();
void printInfo();
@@ -89,7 +89,7 @@ namespace Cantera {
int solutionSpecies(int n) const { return m_dsoln[m_order[n]]; }
bool isStoichPhase(int n) const { return (m_dsoln[m_order[n]] == 0); }
doublereal mu(int n) const { return m_mu[m_species[m_order[n]]]; }
string speciesName(int n) const { return
std::string speciesName(int n) const { return
m_mix->speciesName(m_species[m_order[n]]); }
index_t m_nel_mix, m_nsp_mix, m_np;
@@ -103,7 +103,7 @@ namespace Cantera {
vector_fp m_work, m_work2, m_work3;
vector_fp m_moles, m_lastmoles, m_dxi;
vector_fp m_deltaG_RT, m_mu;
vector<bool> m_majorsp;
std::vector<bool> m_majorsp;
vector_int m_sortindex;
vector_int m_lastsort;
vector_int m_dsoln;
@@ -114,7 +114,7 @@ namespace Cantera {
// with invalid thermo data
vector_int m_species;
vector_int m_element;
vector<bool> m_solnrxn;
std::vector<bool> m_solnrxn;
bool m_force;
};

View File

@@ -14,6 +14,8 @@
#include "vec_functions.h"
#include "ctexceptions.h"
using namespace std;
namespace Cantera {

View File

@@ -63,11 +63,11 @@ namespace Cantera {
const Phase &operator=(const Phase &c);
XML_Node& xml() { return *m_xml; }
string id() const { return m_id; }
void setID(string id) {m_id = id;}
std::string id() const { return m_id; }
void setID(std::string id) {m_id = id;}
string name() const { return m_name; }
void setName(string nm) { m_name = nm; }
std::string name() const { return m_name; }
void setName(std::string nm) { m_name = nm; }
int index() const { return m_index; }
void setIndex(int m) { m_index = m; }
@@ -101,7 +101,7 @@ namespace Cantera {
*/
void setMoleFractionsByName(compositionMap& xMap);
void setMoleFractionsByName(const string& x);
void setMoleFractionsByName(const std::string& x);
/**
* Set the species mass fractions by name.
@@ -110,7 +110,7 @@ namespace Cantera {
*/
void setMassFractionsByName(compositionMap& yMap);
void setMassFractionsByName(const string& x);
void setMassFractionsByName(const std::string& x);
/** Set the temperature (K), density (kg/m^3), and mole fractions. */
void setState_TRX(doublereal t, doublereal dens, const doublereal* x);
@@ -170,11 +170,11 @@ namespace Cantera {
doublereal moleFraction(int k) const;
doublereal moleFraction(string name) const;
doublereal moleFraction(std::string name) const;
doublereal massFraction(int k) const;
doublereal massFraction(string name) const;
doublereal massFraction(std::string name) const;
/**
* Charge density [C/m^3].
@@ -220,8 +220,8 @@ namespace Cantera {
vector_fp m_data;
XML_Node* m_xml;
string m_id;
string m_name;
std::string m_id;
std::string m_name;
};
typedef Phase phase_t;

View File

@@ -20,6 +20,7 @@
#include "ct_defs.h"
#include "ctexceptions.h"
namespace Cantera {
/**
@@ -84,8 +85,8 @@ namespace Cantera {
* the call to update_C.
*/
void update_C(const doublereal* c) {
TYPENAME_KEYWORD vector<R>::iterator b = m_rates.begin();
TYPENAME_KEYWORD vector<R>::iterator e = m_rates.end();
TYPENAME_KEYWORD std::vector<R>::iterator b = m_rates.begin();
TYPENAME_KEYWORD std::vector<R>::iterator e = m_rates.end();
int i = 0;
for (; b != e; ++b, ++i) {
b->update_C(c);
@@ -101,8 +102,8 @@ namespace Cantera {
* preloaded with the constant rate coefficients.
*/
void update(doublereal T, doublereal logT, doublereal* values) {
TYPENAME_KEYWORD vector<R>::const_iterator b = m_rates.begin();
TYPENAME_KEYWORD vector<R>::const_iterator e = m_rates.end();
TYPENAME_KEYWORD std::vector<R>::const_iterator b = m_rates.begin();
TYPENAME_KEYWORD std::vector<R>::const_iterator e = m_rates.end();
doublereal recipT = 1.0/T;
int i = 0;
for (; b != e; ++b, ++i) {
@@ -111,13 +112,13 @@ namespace Cantera {
}
}
void writeUpdate(ostream & output1, string key) {
void writeUpdate(std::ostream & output1, std::string key) {
output1 << key;
}
protected:
vector<R> m_rates;
vector<int> m_rxn;
std::vector<R> m_rates;
std::vector<int> m_rxn;
array_fp m_const; // not used
};

View File

@@ -12,11 +12,6 @@
#ifndef CT_REACTION_DATA_H
#define CT_REACTION_DATA_H
//#include <vector>
//#include <map>
//#include <numeric>
//using namespace std;
#include "reaction_defs.h"
namespace Cantera {
@@ -45,9 +40,9 @@ namespace Cantera {
vector_fp order;
vector_fp rstoich;
vector_fp pstoich;
vector<grouplist_t> rgroups;
vector<grouplist_t> pgroups;
map<int, doublereal> thirdBodyEfficiencies;
std::vector<grouplist_t> rgroups;
std::vector<grouplist_t> pgroups;
std::map<int, doublereal> thirdBodyEfficiencies;
bool reversible;
int rateCoeffType;
vector_fp rateCoeffParameters;
@@ -55,7 +50,7 @@ namespace Cantera {
int falloffType;
vector_fp falloffParameters;
int error;
string equation;
std::string equation;
doublereal default_3b_eff;
vector_fp cov;
bool global;

View File

@@ -21,6 +21,7 @@
#include "reaction_defs.h"
#include "Group.h"
using namespace std;
namespace Cantera {

View File

@@ -24,7 +24,7 @@ namespace Cantera {
enum flow_t { NetFlow, OneWayFlow };
Group parseGroupString(string str, vector<string>& esyms);
Group parseGroupString(std::string str, std::vector<std::string>& esyms);
// forward references
class Path;
@@ -35,7 +35,7 @@ namespace Cantera {
class SpeciesNode {
public:
typedef vector<Path*> path_list;
typedef std::vector<Path*> path_list;
/// Default constructor
SpeciesNode() : number(-1), name(""), value(0.0),
@@ -46,7 +46,7 @@ namespace Cantera {
// public attributes
int number; ///< Species number
string name; ///< Label on graph
std::string name; ///< Label on graph
doublereal value; ///< May be used to set node appearance
bool visible; ///< Visible on graph;
@@ -88,7 +88,7 @@ namespace Cantera {
public:
typedef map<int, doublereal> rxn_path_map;
typedef std::map<int, doublereal> rxn_path_map;
/**
* Constructor. Construct a one-way path from
@@ -99,7 +99,7 @@ namespace Cantera {
/// Destructor
virtual ~Path() {}
void addReaction(int rxnNumber, doublereal value, string label = "");
void addReaction(int rxnNumber, doublereal value, std::string label = "");
/// Upstream node.
const SpeciesNode* begin() const { return m_a; }
@@ -129,11 +129,11 @@ namespace Cantera {
/// Map from reaction number to flow from that reaction in this path.
const rxn_path_map& reactionMap() { return m_rxn; }
void writeLabel(ostream& s, doublereal threshold = 0.005);
void writeLabel(std::ostream& s, doublereal threshold = 0.005);
protected:
map<string, doublereal> m_label;
std::map<std::string, doublereal> m_label;
SpeciesNode *m_a, *m_b;
rxn_path_map m_rxn;
doublereal m_total;
@@ -169,8 +169,8 @@ namespace Cantera {
return (m_nodes[k] != 0);
}
void writeData(ostream& s);
void exportToDot(ostream& s);
void writeData(std::ostream& s);
void exportToDot(std::ostream& s);
void add(ReactionPathDiagram& d);
SpeciesNode* node(int k) { return m_nodes[k]; }
Path* path(int k1, int k2) { return m_paths[k1][k2]; }
@@ -178,43 +178,43 @@ namespace Cantera {
int nPaths() { return static_cast<int>(m_pathlist.size()); }
int nNodes() { return static_cast<int>(m_nodes.size()); }
void addNode(int k, string nm, doublereal x = 0.0);
void addNode(int k, std::string nm, doublereal x = 0.0);
void displayOnly(int k=-1) { m_local = k; }
void linkNodes(int k1, int k2, int rxn, doublereal value,
string legend = "");
std::string legend = "");
void include(string aaname) { m_include.push_back(aaname); }
void exclude(string aaname) { m_exclude.push_back(aaname); }
void include(vector<string>& names) {
void include(std::string aaname) { m_include.push_back(aaname); }
void exclude(std::string aaname) { m_exclude.push_back(aaname); }
void include(std::vector<std::string>& names) {
int n = static_cast<int>(names.size());
for (int i = 0; i < n; i++) m_include.push_back(names[i]);
}
void exclude(vector<string>& names) {
void exclude(std::vector<std::string>& names) {
int n = static_cast<int>(names.size());
for (int i = 0; i < n; i++) m_exclude.push_back(names[i]);
}
vector<string>& included() { return m_include; }
vector<string>& excluded() { return m_exclude; }
std::vector<std::string>& included() { return m_include; }
std::vector<std::string>& excluded() { return m_exclude; }
vector_int species();
vector_int reactions();
void findMajorPaths(doublereal threshold, int lda, doublereal* a);
void setFont(string font) {
void setFont(std::string font) {
m_font = font;
}
// public attributes
string title;
string bold_color;
string normal_color;
string dashed_color;
string element;
string m_font;
std::string title;
std::string bold_color;
std::string normal_color;
std::string dashed_color;
std::string element;
std::string m_font;
doublereal threshold,
bold_min, dashed_max, label_min;
doublereal x_size, y_size;
string name, dot_options;
std::string name, dot_options;
flow_t flow_type;
double scale;
double arrow_width;
@@ -224,13 +224,13 @@ namespace Cantera {
protected:
doublereal m_flxmax;
map<int, map<int, Path*> > m_paths;
map<int, SpeciesNode*> m_nodes;
vector<Path*> m_pathlist;
vector<string> m_include;
vector<string> m_exclude;
std::map<int, std::map<int, Path*> > m_paths;
std::map<int, SpeciesNode*> m_nodes;
std::vector<Path*> m_pathlist;
std::vector<std::string> m_include;
std::vector<std::string> m_exclude;
vector_int m_speciesNumber;
map<int, int> m_rxns;
std::map<int, int> m_rxns;
int m_local;
};
@@ -242,14 +242,14 @@ namespace Cantera {
ReactionPathBuilder() {}
virtual ~ReactionPathBuilder() {}
int init(ostream& logfile, Kinetics& s);
int init(std::ostream& logfile, Kinetics& s);
int build(Kinetics& s, string element, ostream& output,
int build(Kinetics& s, std::string element, std::ostream& output,
ReactionPathDiagram& r, bool quiet=false);
int findGroups(ostream& logfile, Kinetics& s);
int findGroups(std::ostream& logfile, Kinetics& s);
void writeGroup(ostream& out, const Group& g);
void writeGroup(std::ostream& out, const Group& g);
protected:
void findElements(Kinetics& kin);
@@ -260,17 +260,17 @@ namespace Cantera {
vector_fp m_ropf;
vector_fp m_ropr;
array_fp m_x;
vector<vector_int> m_reac;
vector<vector_int> m_prod;
std::vector<vector_int> m_reac;
std::vector<vector_int> m_prod;
DenseMatrix m_elatoms;
vector<vector<int> > m_groups;
vector<Group> m_sgroup;
vector<string> m_elementSymbols;
// map<int, int> m_warn;
map<int, map<int, map<int, Group> > > m_transfer;
vector<bool> m_determinate;
std::vector<std::vector<int> > m_groups;
std::vector<Group> m_sgroup;
std::vector<std::string> m_elementSymbols;
// std::map<int, int> m_warn;
std::map<int, std::map<int, std::map<int, Group> > > m_transfer;
std::vector<bool> m_determinate;
Array2D m_atoms;
map<string,int> m_enamemap;
std::map<std::string,int> m_enamemap;
};
}

View File

@@ -22,6 +22,8 @@
#include "diagnostics.h"
#include "ReactionData.h"
using namespace std;
namespace Cantera {
// create stoichiometry managers for the reactants of all reactions,

View File

@@ -218,15 +218,15 @@ namespace Cantera {
*/
virtual void multiplyRevProducts(const doublereal* c, doublereal* r);
virtual void write(string filename);
virtual void write(std::string filename);
protected:
void writeCreationRates(ostream& f);
void writeDestructionRates(ostream& f);
void writeNetProductionRates(ostream& f);
void writeMultiplyReactants(ostream& f);
void writeMultiplyRevProducts(ostream& f);
void writeCreationRates(std::ostream& f);
void writeDestructionRates(std::ostream& f);
void writeNetProductionRates(std::ostream& f);
void writeMultiplyReactants(std::ostream& f);
void writeMultiplyRevProducts(std::ostream& f);
StoichManagerN* m_reactants;
StoichManagerN* m_revproducts;
StoichManagerN* m_irrevproducts;

View File

@@ -88,8 +88,8 @@ namespace Cantera {
protected:
map<int, int> m_alg;
map<int, int> m_constrain;
std::map<int, int> m_alg;
std::map<int, int> m_constrain;
private:

View File

@@ -100,12 +100,12 @@ namespace Cantera {
}
void writeUpdateRHS(ostream& s) const {
s << " exp(" << m_logA;
if (m_b != 0.0) s << " + " << m_b << " * tlog";
if (m_E != 0.0) s << " - " << m_E << " * rt";
s << ");" << endl;
}
void writeUpdateRHS(std::ostream& s) const {
s << " exp(" << m_logA;
if (m_b != 0.0) s << " + " << m_b << " * tlog";
if (m_E != 0.0) s << " - " << m_E << " * rt";
s << ");" << std::endl;
}
doublereal activationEnergy_R() const {
return m_E;
@@ -123,13 +123,17 @@ namespace Cantera {
public:
static int type(){ return ARRHENIUS_SUM; }
ArrheniusSum() : m_nterms(0) {}
ArrheniusSum( int csize, const doublereal* c ) {
m_nterms = 0;
addArrheniusTerm(c[0], c[1], c[2]);
}
void addArrheniusTerm(doublereal A, doublereal b, doublereal E) {
m_terms.push_back(Arrhenius(A, b, E));
m_nterms++;
if (A > 0.0) {
m_terms.push_back(Arrhenius(A, b, E));
m_sign.push_back(1);
}
else if (A < 0.0) {
m_terms.push_back(Arrhenius(-A, b, E));
m_sign.push_back(-1);
}
m_nterms++;
}
void update_C(const doublereal* c) {}
@@ -143,7 +147,7 @@ namespace Cantera {
doublereal f, fsum = 0.0;
for (n = 0; n < m_nterms; n++) {
f = m_terms[n].updateRC(logT, recipT);
fsum += f;
fsum += m_sign[n]*f;
}
return log(fsum);
}
@@ -160,19 +164,20 @@ namespace Cantera {
doublereal f, fsum = 0.0;
for (n = 0; n < m_nterms; n++) {
f = m_terms[n].updateRC(logT, recipT);
fsum += f;
fsum += m_sign[n]*f;
}
return fsum;
}
void writeUpdateRHS(ostream& s) const {
void writeUpdateRHS(std::ostream& s) const {
;
}
static bool alwaysComputeRate() { return true;}
static bool alwaysComputeRate() { return false;}
protected:
vector<Arrhenius> m_terms;
std::vector<Arrhenius> m_terms;
vector_int m_sign;
int m_nterms;
};
@@ -320,7 +325,7 @@ namespace Cantera {
return exp(lres);
}
void writeUpdateRHS(ostream& s) const {}
void writeUpdateRHS(std::ostream& s) const {}
protected:
doublereal delta_s0, delta_e0;

View File

@@ -84,7 +84,7 @@ namespace Cantera {
* parameterization.
* @see speciesThermoTypes.h
*/
virtual void install(string name, int index, int type,
virtual void install(std::string name, int index, int type,
const doublereal* c,
doublereal minTemp,
doublereal maxTemp,

View File

@@ -9,6 +9,8 @@
#pragma warning(disable:4786)
#endif
using namespace std;
#include "SpeciesThermoFactory.h"
#include "SpeciesThermo.h"
@@ -41,7 +43,7 @@ namespace Cantera {
int& has_nasa, int& has_shomate, int& has_simple,
int &has_other) {
const XML_Node& sparray = *node;
vector<XML_Node*> sp;
std::vector<XML_Node*> sp;
// get all of the species nodes
sparray.getChildren("species",sp);
@@ -88,7 +90,7 @@ namespace Cantera {
}
SpeciesThermo* SpeciesThermoFactory::
newSpeciesThermo(vector<XML_Node*> nodes) {
newSpeciesThermo(std::vector<XML_Node*> nodes) {
int n = static_cast<int>(nodes.size());
int inasa = 0, ishomate = 0, isimple = 0, iother = 0;
for (int j = 0; j < n; j++) {
@@ -111,7 +113,7 @@ namespace Cantera {
* @todo is this used?
*/
SpeciesThermo* SpeciesThermoFactory::
newSpeciesThermoOpt(vector<XML_Node*> nodes) {
newSpeciesThermoOpt(std::vector<XML_Node*> nodes) {
int n = static_cast<int>(nodes.size());
int inasa = 0, ishomate = 0, isimple = 0, iother = 0;
for (int j = 0; j < n; j++) {
@@ -156,7 +158,7 @@ namespace Cantera {
/// Check the continuity of properties at the midpoint
/// temperature.
void NasaThermo::checkContinuity(string name, double tmid, const doublereal* clow,
void NasaThermo::checkContinuity(std::string name, double tmid, const doublereal* clow,
doublereal* chigh) {
// heat capacity
@@ -209,7 +211,7 @@ namespace Cantera {
* This is called by method installThermoForSpecies if a NASA
* block is found in the XML input.
*/
static void installNasaThermoFromXML(string speciesName,
static void installNasaThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node* f0ptr, const XML_Node* f1ptr) {
doublereal tmin0, tmax0, tmin1, tmax1, tmin, tmid, tmax;
@@ -280,7 +282,7 @@ namespace Cantera {
* Install a NASA96 polynomial thermodynamic property
* parameterization for species k into a SpeciesThermo instance.
*/
static void installNasa96ThermoFromXML(string speciesName,
static void installNasa96ThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node* f0ptr, const XML_Node* f1ptr) {
doublereal tmin0, tmax0, tmin1, tmax1, tmin, tmid, tmax;
@@ -340,7 +342,7 @@ namespace Cantera {
* Install a Shomate polynomial thermodynamic property
* parameterization for species k.
*/
static void installShomateThermoFromXML(string speciesName,
static void installShomateThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node* f0ptr, const XML_Node* f1ptr) {
doublereal tmin0, tmax0, tmin1, tmax1, tmin, tmid, tmax;
@@ -395,7 +397,7 @@ namespace Cantera {
* Install a constant-cp thermodynamic property
* parameterization for species k.
*/
static void installSimpleThermoFromXML(string speciesName,
static void installSimpleThermoFromXML(std::string speciesName,
SpeciesThermo& sp, int k,
const XML_Node& f) {
doublereal tmin, tmax;
@@ -431,7 +433,7 @@ namespace Cantera {
s["name"], "<nonexistent>");
}
const XML_Node& thermo = s.child("thermo");
const vector<XML_Node*>& tp = thermo.children();
const std::vector<XML_Node*>& tp = thermo.children();
int nc = static_cast<int>(tp.size());
if (nc == 1) {
const XML_Node* f = tp[0];

View File

@@ -27,8 +27,8 @@ namespace Cantera {
*/
class UnknownSpeciesThermoModel: public CanteraError {
public:
UnknownSpeciesThermoModel(string proc, string spName,
string speciesThermoModel) :
UnknownSpeciesThermoModel(std::string proc, std::string spName,
std::string speciesThermoModel) :
CanteraError(proc, "species " + spName +
": Specified speciesThermoPhase model "
+ speciesThermoModel +
@@ -86,8 +86,8 @@ namespace Cantera {
virtual SpeciesThermo* newSpeciesThermo(int type);
virtual SpeciesThermo* newSpeciesThermo(XML_Node* node);
virtual SpeciesThermo* newSpeciesThermo(vector<XML_Node*> nodes);
virtual SpeciesThermo* newSpeciesThermoOpt(vector<XML_Node*> nodes);
virtual SpeciesThermo* newSpeciesThermo(std::vector<XML_Node*> nodes);
virtual SpeciesThermo* newSpeciesThermoOpt(std::vector<XML_Node*> nodes);
virtual void installThermoForSpecies(int k, const XML_Node& s,
@@ -138,7 +138,7 @@ namespace Cantera {
return sptherm;
}
inline SpeciesThermo* newSpeciesThermoMgr(vector<XML_Node*> nodes,
inline SpeciesThermo* newSpeciesThermoMgr(std::vector<XML_Node*> nodes,
SpeciesThermoFactory* f=0, bool opt=false) {
if (f == 0) {
f = SpeciesThermoFactory::factory();

View File

@@ -16,7 +16,7 @@
#include "stringUtils.h"
#include "SpeciesThermo.h"
#include <map>
using namespace std;
//using namespace std;
namespace Cantera {
@@ -72,7 +72,7 @@ namespace Cantera {
*/
class RefPressureMismatch : public CanteraError {
public:
RefPressureMismatch(string proc, doublereal prnew,
RefPressureMismatch(std::string proc, doublereal prnew,
doublereal prold) : CanteraError(proc,
"Species reference pressure ("
+ fp2str(prnew) + ") does not match previously-defined "
@@ -83,7 +83,7 @@ namespace Cantera {
class UnknownSpeciesThermo
: public CanteraError {
public:
UnknownSpeciesThermo(string proc, int type) :
UnknownSpeciesThermo(std::string proc, int type) :
CanteraError(proc, "Specified species "
"parameterization type (" + int2str(type)
+ ") does not match any known type.") {}
@@ -104,7 +104,7 @@ namespace Cantera {
SpeciesThermoDuo() {}
virtual ~SpeciesThermoDuo(){}
virtual void install(string name, int sp, int type,
virtual void install(std::string name, int sp, int type,
const doublereal* c,
doublereal minTemp,
doublereal maxTemp,
@@ -146,7 +146,7 @@ namespace Cantera {
}
virtual int reportType(int k) const {
map<int, int>::const_iterator p = speciesToType.find(k);
std::map<int, int>::const_iterator p = speciesToType.find(k);
if (p != speciesToType.end()) {
const int type = p->second;
return type;
@@ -176,7 +176,7 @@ namespace Cantera {
T1 m_thermo1;
T2 m_thermo2;
doublereal m_p0;
map<int, int> speciesToType;
std::map<int, int> speciesToType;
};
//#define REMOVE_FOR_V155
@@ -194,7 +194,7 @@ namespace Cantera {
SpeciesThermo1() : m_pref(0.0) {}
virtual ~SpeciesThermo1(){}
virtual void install(string name, int sp, int type, const vector_fp& c) {
virtual void install(std::string name, int sp, int type, const vector_fp& c) {
m_thermo.push_back(T(sp, c));
if (m_pref) {
if (m_thermo.begin()->refPressure() != m_pref) {
@@ -242,7 +242,7 @@ namespace Cantera {
private:
vector<T> m_thermo;
std::vector<T> m_thermo;
doublereal m_pref;
};
//#endif

View File

@@ -148,7 +148,7 @@ They are designed to explicitly unroll loops over species or reactions for
return 0.0;
}
inline static string fmt(string r, int n) { return r + "[" + int2str(n) + "]"; }
inline static std::string fmt(std::string r, int n) { return r + "[" + int2str(n) + "]"; }
/**
@@ -163,7 +163,7 @@ They are designed to explicitly unroll loops over species or reactions for
C1( int rxn = 0, int ic0 = 0)
: m_rxn (rxn), m_ic0 (ic0) {}
int data(vector<int>& ic) {
int data(std::vector<int>& ic) {
ic.resize(1);
ic[0] = m_ic0;
return m_rxn;
@@ -193,21 +193,21 @@ They are designed to explicitly unroll loops over species or reactions for
int speciesIndex(int n) const { return m_ic0; }
int nSpecies() { return 1;}
void writeMultiply(string r, map<int, string>& out) {
void writeMultiply(std::string r, std::map<int, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0);
}
void writeIncrementReaction(string r, map<int, string>& out) {
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0);
}
void writeDecrementReaction(string r, map<int, string>& out) {
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0);
}
void writeIncrementSpecies(string r, map<int, string>& out) {
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
out[m_ic0] += " + "+fmt(r, m_rxn);
}
void writeDecrementSpecies(string r, map<int, string>& out) {
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
out[m_ic0] += " - "+fmt(r, m_rxn);
}
@@ -226,7 +226,7 @@ They are designed to explicitly unroll loops over species or reactions for
C2( int rxn = 0, int ic0 = 0, int ic1 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {}
int data(vector<int>& ic) {
int data(std::vector<int>& ic) {
ic.resize(2);
ic[0] = m_ic0;
ic[1] = m_ic1;
@@ -259,23 +259,23 @@ They are designed to explicitly unroll loops over species or reactions for
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : m_ic1); }
int nSpecies() { return 2;}
void writeMultiply(string r, map<int, string>& out) {
void writeMultiply(std::string r, std::map<int, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1);
}
void writeIncrementReaction(string r, map<int, string>& out) {
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1);
}
void writeDecrementReaction(string r, map<int, string>& out) {
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1);
}
void writeIncrementSpecies(string r, map<int, string>& out) {
string s = " + "+fmt(r, m_rxn);
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = " + "+fmt(r, m_rxn);
out[m_ic0] += s;
out[m_ic1] += s;
}
void writeDecrementSpecies(string r, map<int, string>& out) {
string s = " - "+fmt(r, m_rxn);
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = " - "+fmt(r, m_rxn);
out[m_ic0] += s;
out[m_ic1] += s;
}
@@ -304,7 +304,7 @@ They are designed to explicitly unroll loops over species or reactions for
C3( int rxn = 0, int ic0 = 0, int ic1 = 0, int ic2 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1), m_ic2 (ic2) {}
int data(vector<int>& ic) {
int data(std::vector<int>& ic) {
ic.resize(3);
ic[0] = m_ic0;
ic[1] = m_ic1;
@@ -340,23 +340,23 @@ They are designed to explicitly unroll loops over species or reactions for
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : (n == 1 ? m_ic1 : m_ic2)); }
int nSpecies() { return 3;}
void writeMultiply(string r, map<int, string>& out) {
void writeMultiply(std::string r, std::map<int, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2);
}
void writeIncrementReaction(string r, map<int, string>& out) {
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2);
}
void writeDecrementReaction(string r, map<int, string>& out) {
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2);
}
void writeIncrementSpecies(string r, map<int, string>& out) {
string s = " + "+fmt(r, m_rxn);
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = " + "+fmt(r, m_rxn);
out[m_ic0] += s;
out[m_ic1] += s;
out[m_ic2] += s;
}
void writeDecrementSpecies(string r, map<int, string>& out) {
string s = " - "+fmt(r, m_rxn);
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = " - "+fmt(r, m_rxn);
out[m_ic0] += s;
out[m_ic1] += s;
out[m_ic2] += s;
@@ -389,7 +389,7 @@ They are designed to explicitly unroll loops over species or reactions for
}
}
int data(vector<int>& ic) {
int data(std::vector<int>& ic) {
ic.resize(m_n);
int n;
for (n = 0; n < m_n; n++) ic[n] = m_ic[n];
@@ -431,7 +431,7 @@ They are designed to explicitly unroll loops over species or reactions for
-= m_stoich[n]*input[m_ic[n]];
}
void writeMultiply(string r, map<int, string>& out) {
void writeMultiply(std::string r, std::map<int, std::string>& out) {
int n;
out[m_rxn] = "";
for (n = 0; n < m_n; n++) {
@@ -443,28 +443,28 @@ They are designed to explicitly unroll loops over species or reactions for
out[m_rxn] += " * ";
}
}
void writeIncrementReaction(string r, map<int, string>& out) {
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
int n;
for (n = 0; n < m_n; n++) {
out[m_rxn] += " + "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
}
}
void writeDecrementReaction(string r, map<int, string>& out) {
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
int n;
for (n = 0; n < m_n; n++) {
out[m_rxn] += " - "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
}
}
void writeIncrementSpecies(string r, map<int, string>& out) {
string s = fmt(r, m_rxn);
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = fmt(r, m_rxn);
int n;
for (n = 0; n < m_n; n++) {
out[m_ic[n]] += " + "+fp2str(m_stoich[n]) + "*" + s;
}
}
void writeDecrementSpecies(string r, map<int, string>& out) {
string s = fmt(r, m_rxn);
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
std::string s = fmt(r, m_rxn);
int n;
for (n = 0; n < m_n; n++) {
out[m_ic[n]] += " - "+fp2str(m_stoich[n]) + "*" + s;
@@ -516,32 +516,32 @@ They are designed to explicitly unroll loops over species or reactions for
template<class InputIter>
inline static void _writeIncrementSpecies(InputIter begin, InputIter end, string r,
map<int, string>& out) {
inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) {
for (; begin != end; ++begin) begin->writeIncrementSpecies(r, out);
}
template<class InputIter>
inline static void _writeDecrementSpecies(InputIter begin, InputIter end, string r,
map<int, string>& out) {
inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) {
for (; begin != end; ++begin) begin->writeDecrementSpecies(r, out);
}
template<class InputIter>
inline static void _writeIncrementReaction(InputIter begin, InputIter end, string r,
map<int, string>& out) {
inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) {
for (; begin != end; ++begin) begin->writeIncrementReaction(r, out);
}
template<class InputIter>
inline static void _writeDecrementReaction(InputIter begin, InputIter end, string r,
map<int, string>& out) {
inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) {
for (; begin != end; ++begin) begin->writeDecrementReaction(r, out);
}
template<class InputIter>
inline static void _writeMultiply(InputIter begin, InputIter end, string r,
map<int, string>& out) {
inline static void _writeMultiply(InputIter begin, InputIter end, std::string r,
std::map<int, std::string>& out) {
for (; begin != end; ++begin) begin->writeMultiply(r, out);
}
@@ -708,35 +708,35 @@ They are designed to explicitly unroll loops over species or reactions for
_decrementReactions(m_cn_list.begin(), m_cn_list.end(), input, output);
}
void writeIncrementSpecies(string r, map<int, string>& out) {
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
_writeIncrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeIncrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeIncrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeIncrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
}
void writeDecrementSpecies(string r, map<int, string>& out) {
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
_writeDecrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeDecrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeDecrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeDecrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
}
void writeIncrementReaction(string r, map<int, string>& out) {
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
_writeIncrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeIncrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeIncrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeIncrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
}
void writeDecrementReaction(string r, map<int, string>& out) {
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
_writeDecrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeDecrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeDecrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
_writeDecrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
}
void writeMultiply(string r, map<int, string>& out) {
void writeMultiply(std::string r, std::map<int, std::string>& out) {
_writeMultiply(m_c1_list.begin(), m_c1_list.end(), r, out);
_writeMultiply(m_c2_list.begin(), m_c2_list.end(), r, out);
_writeMultiply(m_c3_list.begin(), m_c3_list.end(), r, out);
@@ -746,20 +746,20 @@ They are designed to explicitly unroll loops over species or reactions for
private:
vector<C1> m_c1_list;
vector<C2> m_c2_list;
vector<C3> m_c3_list;
vector<C_AnyN> m_cn_list;
std::vector<C1> m_c1_list;
std::vector<C2> m_c2_list;
std::vector<C3> m_c3_list;
std::vector<C_AnyN> m_cn_list;
/**
* Mapping with the Reaction Number as key and the Number of species
* Std::Mapping with the Reaction Number as key and the Number of species
* as the value.
*/
map<int, int> m_n;
std::map<int, int> m_n;
/**
* Mapping with the Reaction Number as key and the placement in the
* Std::Mapping with the Reaction Number as key and the placement in the
* vector of reactions list( i.e., m_c1_list[]) as key
*/
map<int, int> m_loc;
std::map<int, int> m_loc;
};
#undef INCL_STOICH_WRITER
@@ -785,7 +785,7 @@ They are designed to explicitly unroll loops over species or reactions for
void add(int rxn, const vector_int& k, const vector_fp& order,
const vector_fp& stoich) {
int n, nn = k.size();
string s;
std::string s;
for (n = 0; n < nn; n++) {
if (order[n] == 1.0)
m_mult[rxn] += "*c[" + int2str(k[n]) + "]";
@@ -807,14 +807,14 @@ They are designed to explicitly unroll loops over species or reactions for
}
}
string mult(int rxn) { return m_mult[rxn]; }
string incrSpec(int k, string) { return m_is[k]; }
string decrSpec(int k) { return m_ds[k]; }
string incrRxn(int rxn) { return m_ir[rxn]; }
string decrRxn(int rxn) { return m_dr[rxn]; }
std::string mult(int rxn) { return m_mult[rxn]; }
std::string incrSpec(int k, std::string) { return m_is[k]; }
std::string decrSpec(int k) { return m_ds[k]; }
std::string incrRxn(int rxn) { return m_ir[rxn]; }
std::string decrRxn(int rxn) { return m_dr[rxn]; }
private:
map<int, string> m_mult, m_ir, m_dr, m_is, m_ds;
std::map<int, std::string> m_mult, m_ir, m_dr, m_is, m_ds;
};
#endif

View File

@@ -100,7 +100,7 @@ namespace Cantera {
* Set the coverages from a string of colon-separated
* name:value pairs.
*/
void setCoveragesByName(string cov);
void setCoveragesByName(std::string cov);
/**
* Get the coverages. Array theta must be at least as long as

View File

@@ -43,6 +43,8 @@
#include "LatticePhase.h"
#endif
using namespace std;
namespace Cantera {
ThermoFactory* ThermoFactory::s_factory = 0;

View File

@@ -23,7 +23,7 @@ namespace Cantera {
class UnknownThermoPhaseModel : public CanteraError {
public:
UnknownThermoPhaseModel(string proc, string thermoModel) :
UnknownThermoPhaseModel(std::string proc, std::string thermoModel) :
CanteraError(proc, "Specified ThermoPhase model "
+ thermoModel +
" does not match any known type.") {}
@@ -62,8 +62,8 @@ namespace Cantera {
* Create a new thermodynamic property manager.
* @param type the type to be created.
*/
//virtual ThermoPhase* newThermo(XML_Node& node, string id);
virtual ThermoPhase* newThermoPhase(string model);
//virtual ThermoPhase* newThermo(XML_Node& node, std::string id);
virtual ThermoPhase* newThermoPhase(std::string model);
private:
@@ -75,7 +75,7 @@ namespace Cantera {
/**
* Create a new thermo manager instance.
*/
// inline ThermoPhase* newThermoMgr(XML_Node& root, string id,
// inline ThermoPhase* newThermoMgr(XML_Node& root, std::string id,
// ThermoFactory* f=0) {
// if (f == 0) {
// f = ThermoFactory::factory();
@@ -87,7 +87,7 @@ namespace Cantera {
/**
* Create a new thermo manager instance.
*/
inline ThermoPhase* newThermoPhase(string model,
inline ThermoPhase* newThermoPhase(std::string model,
ThermoFactory* f=0) {
if (f == 0) {
f = ThermoFactory::factory();

View File

@@ -20,6 +20,7 @@
#include "ThermoPhase.h"
using namespace std;
namespace Cantera {
/**

View File

@@ -693,7 +693,7 @@ namespace Cantera {
void setState_TPX(doublereal t, doublereal p, compositionMap& x);
/** Set the temperature (K), pressure (Pa), and mole fractions. */
void setState_TPX(doublereal t, doublereal p, const string& x);
void setState_TPX(doublereal t, doublereal p, const std::string& x);
/** Set the temperature (K), pressure (Pa), and mass fractions. */
void setState_TPY(doublereal t, doublereal p, const doublereal* y);
@@ -702,7 +702,7 @@ namespace Cantera {
void setState_TPY(doublereal t, doublereal p, compositionMap& y);
/** Set the temperature (K), pressure (Pa), and mass fractions. */
void setState_TPY(doublereal t, doublereal p, const string& y);
void setState_TPY(doublereal t, doublereal p, const std::string& y);
/** Set the temperature (K) and pressure (Pa) */
void setState_TP(doublereal t, doublereal p);
@@ -889,7 +889,7 @@ namespace Cantera {
* phase. If none is given, the first XML
* phase element encountered will be used.
*/
virtual void initThermoFile(string inputFile, string id);
virtual void initThermoFile(std::string inputFile, std::string id);
/**
@@ -918,7 +918,7 @@ namespace Cantera {
* to see if phaseNode is pointing to the phase
* with the correct id.
*/
virtual void initThermoXML(XML_Node& phaseNode, string id);
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
/**
* @internal Initialize. This method is provided to allow
@@ -1022,7 +1022,7 @@ namespace Cantera {
private:
doublereal err(string msg) const;
doublereal err(std::string msg) const;
};

View File

@@ -28,7 +28,7 @@ namespace Cantera {
ThirdBodyMgr<_E>() : m_n(0) {}
void install( int rxnNumber, const map<int, doublereal>& enhanced,
void install( int rxnNumber, const std::map<int, doublereal>& enhanced,
doublereal dflt=1.0) {
m_n++;
m_reaction_index.push_back( rxnNumber );
@@ -37,7 +37,7 @@ namespace Cantera {
}
void update(const vector_fp& conc, doublereal ctot, workPtr work) {
TYPENAME_KEYWORD vector<_E>::const_iterator b = m_concm.begin();
TYPENAME_KEYWORD std::vector<_E>::const_iterator b = m_concm.begin();
//doublereal* v = m_values.begin();
for (; b != m_concm.end(); ++b, ++work)
*work = b->update(conc, ctot);
@@ -59,7 +59,7 @@ namespace Cantera {
int m_n;
vector_int m_reaction_index;
vector<_E> m_concm;
std::vector<_E> m_concm;
};
}

View File

@@ -22,6 +22,8 @@
#include <time.h>
#include "ctml.h"
using namespace std;
//#define DEBUG_PATHS
using namespace Cantera;

View File

@@ -28,7 +28,7 @@
#include <numeric>
#include <string>
using namespace std;
//using namespace std;
//#include "ctvector.h"
//using namespace ct;
@@ -153,7 +153,7 @@ namespace Cantera {
const int None = 0;
// typedefs
typedef std::map<string, doublereal> compositionMap;
typedef std::map<std::string, doublereal> compositionMap;
#define USE_STL_VECTOR
#ifdef USE_STL_VECTOR
typedef std::vector<double> array_fp;

View File

@@ -16,7 +16,7 @@
#define CT_CTEXCEPTIONS_H
#include <string>
using namespace std;
//using namespace std;
// See file misc.cpp for implementations of methods/functions declared
// here.
@@ -46,7 +46,7 @@ namespace Cantera {
class CanteraError {
public:
CanteraError() {}
CanteraError(string proc, string msg);
CanteraError(std::string proc, std::string msg);
virtual ~CanteraError(){}
protected:
};
@@ -55,17 +55,17 @@ namespace Cantera {
///
class ArraySizeError : public CanteraError {
public:
ArraySizeError(string proc, int sz, int reqd);
ArraySizeError(std::string proc, int sz, int reqd);
};
/// Exception thrown if an element index is out of range.
class ElementRangeError : public CanteraError {
public:
ElementRangeError(string func, int m, int mmax);
ElementRangeError(std::string func, int m, int mmax);
};
void deprecatedMethod(string classnm, string oldnm, string newnm);
void removeAtVersion(string func, string version);
void deprecatedMethod(std::string classnm, std::string oldnm, std::string newnm);
void removeAtVersion(std::string func, std::string version);
}
#endif

View File

@@ -23,6 +23,9 @@
#define CTML_VERSION_1_4_1
using namespace std;
using namespace Cantera;
namespace ctml {
static doublereal fpValue(string val) {

View File

@@ -23,86 +23,89 @@
#include "ct_defs.h"
#include "xml.h"
#include "Array.h"
using namespace Cantera;
//using namespace Cantera;
namespace ctml {
const string CTML_Version = "1.4.1";
const std::string CTML_Version = "1.4.1";
bool isBuiltin(string nm);
bool isBuiltin(std::string nm);
void addBool(XML_Node& node,
string title,
void addBool(Cantera::XML_Node& node,
std::string title,
bool val);
void addInteger(XML_Node& node,
string title,
void addInteger(Cantera::XML_Node& node,
std::string title,
int val,
string units="",
string type="");
std::string units="",
std::string type="");
void addFloat(XML_Node& node,
string title,
void addFloat(Cantera::XML_Node& node,
std::string title,
doublereal val,
string units="",
string type="",
doublereal minval = Undef,
doublereal maxval = Undef);
std::string units="",
std::string type="",
doublereal minval = Cantera::Undef,
doublereal maxval = Cantera::Undef);
void addIntegerArray(XML_Node& node,
string title,
void addIntegerArray(Cantera::XML_Node& node,
std::string title,
int n,
const int* vals,
string units="",
string type="",
doublereal minval=Undef,
doublereal maxval=Undef);
std::string units="",
std::string type="",
doublereal minval=Cantera::Undef,
doublereal maxval=Cantera::Undef);
void addFloatArray(XML_Node& node,
string title,
void addFloatArray(Cantera::XML_Node& node,
std::string title,
int n,
const double* vals,
string units="",
string type="",
doublereal minval = Undef,
doublereal maxval = Undef);
std::string units="",
std::string type="",
doublereal minval = Cantera::Undef,
doublereal maxval = Cantera::Undef);
void addString(XML_Node& node,
string title,
string val,
string type="");
void addString(Cantera::XML_Node& node,
std::string title,
std::string val,
std::string type="");
void getFloatArray(const XML_Node& node, vector_fp& v,
bool convert=true, string type="",
string nodeName = "floatArray");
void getFloatArray(const Cantera::XML_Node& node, Cantera::vector_fp& v,
bool convert=true, std::string type="",
std::string nodeName = "floatArray");
void getStringArray(const XML_Node& node, vector<string>& v);
void getMap(const XML_Node& node, map<string, string>& m);
void getPairs(const XML_Node& node, vector<string>& key,
vector<string>& val);
void getMatrixValues(const XML_Node& node,
const vector<string>& keyString1,
const vector<string>& keyString2,
Array2D &returnValues, bool convert = true,
bool matrixSymmetric = false);
void getStringArray(const Cantera::XML_Node& node, std::vector<std::string>& v);
void getMap(const Cantera::XML_Node& node, std::map<std::string, std::string>& m);
void getPairs(const Cantera::XML_Node& node, std::vector<std::string>& key,
std::vector<std::string>& val);
void getMatrixValues(const Cantera::XML_Node& node,
const std::vector<std::string>& keyString1,
const std::vector<std::string>& keyString2,
Cantera::Array2D &returnValues, bool convert = true,
bool matrixSymmetric = false);
void getIntegers(const XML_Node& node, map<string,int>& v);
void getFloats(const XML_Node& node, map<string,double>& v,
void getIntegers(const Cantera::XML_Node& node, std::map<std::string,int>& v);
void getFloats(const Cantera::XML_Node& node, std::map<std::string,double>& v,
bool convert=true);
doublereal getFloat(const XML_Node& parent, string name, string type="");
int getInteger(const XML_Node& parent, string name);
doublereal getFloat(const Cantera::XML_Node& parent, std::string name,
std::string type="");
int getInteger(const Cantera::XML_Node& parent, std::string name);
void getStrings(const XML_Node& node, map<string,string>& v);
void getFunction(const XML_Node& node, string& type, doublereal& xmin,
doublereal& xmax, vector_fp& coeffs);
XML_Node* getByTitle(XML_Node& node, string title);
void getString(XML_Node& node, string title, string& val,
string& type);
void getStrings(const Cantera::XML_Node& node, std::map<std::string,
std::string>& v);
void getFunction(const Cantera::XML_Node& node, std::string& type,
doublereal& xmin, doublereal& xmax, Cantera::vector_fp& coeffs);
Cantera::XML_Node* getByTitle(Cantera::XML_Node& node, std::string title);
void getString(Cantera::XML_Node& node, std::string title,
std::string& val, std::string& type);
string getString(const XML_Node& parent, string name);
std::string getString(const Cantera::XML_Node& parent, std::string name);
// these are defined in ct2ctml.cpp
void get_CTML_Tree(XML_Node* node, string file);
void get_CTML_Tree(Cantera::XML_Node* node, std::string file);
void ct2ctml(const char* file);
}

View File

@@ -1,6 +1,8 @@
/**
* @file ctvector.h
*
* THESE CLASSES ARE NO LONGER USED. USE std::vector<double> instead.
*
* These classes are defined to represent floating-point and integer
* arrays. They act as simplified replacements for std::vector<double>
* and std::vector<int>, respectively. These classes are designed for

View File

@@ -29,14 +29,14 @@ namespace Cantera {
int nErrors();
// The last error message
string lastErrorMessage();
std::string lastErrorMessage();
// Set an error condition in the application class without
// throwing an exception.
void setError(string r, string msg);
void setError(std::string r, std::string msg);
// Prints all of the error messages to stream f
void showErrors(ostream& f);
void showErrors(std::ostream& f);
// Print all of the error messages using function writelog.
void showErrors();
@@ -45,69 +45,69 @@ namespace Cantera {
void popError();
/// Find an input file.
string findInputFile(string name);
std::string findInputFile(std::string name);
void addDirectory(string dir);
void addDirectory(std::string dir);
void appdelete();
/// The root directory where Cantera is installed
string canteraRoot();
std::string canteraRoot();
/// Set the temporary file directory. The default is to use the
/// directory specified by enviroment variable TMP or TEMP. If neither
/// of these are defined, then the current working directory will be
/// used for temporary files. Call this function to specify some other
/// place to put temporary files.
void setTmpDir(string tmp);
void setTmpDir(std::string tmp);
/// The directory where temporary files may be created
string tmpDir();
std::string tmpDir();
/// Delay time in seconds.
string sleep();
std::string sleep();
void writelog(const string& msg);
void writelog(const std::string& msg);
void writelog(const char* msg);
void error(const string& msg);
void error(const std::string& msg);
// returns 1 for MATLAB, 2 for Python, and 0 for C++ or Fortran.
int userInterface();
void setLogger(Logger* logwriter);
/// Return the conversion factor to convert unit string 'unit' to
/// Return the conversion factor to convert unit std::string 'unit' to
/// SI units.
doublereal toSI(string unit);
doublereal toSI(std::string unit);
/// Return the conversion factor to convert activation energy unit
/// string 'unit' to Kelvin.
doublereal actEnergyToSI(string unit);
/// std::string 'unit' to Kelvin.
doublereal actEnergyToSI(std::string unit);
/// Return a pointer to the XML tree for a Cantera input file.
XML_Node* get_XML_File(string file);
XML_Node* get_XML_File(std::string file);
/// Close a Cantera input file.
void close_XML_File(string file);
void close_XML_File(std::string file);
#ifdef WITH_HTML_LOGS
void beginLogGroup(string title, int loglevel=-99);
void addLogEntry(string tag, string value);
void addLogEntry(string tag, doublereal value);
void addLogEntry(string tag, int value);
void addLogEntry(string msg);
void endLogGroup(string title="");
void write_logfile(string file = "log.html");
void beginLogGroup(std::string title, int loglevel=-99);
void addLogEntry(std::string tag, std::string value);
void addLogEntry(std::string tag, doublereal value);
void addLogEntry(std::string tag, int value);
void addLogEntry(std::string msg);
void endLogGroup(std::string title="");
void write_logfile(std::string file = "log.html");
#else
inline void beginLogGroup(string title, int loglevel=-99) {}
inline void addLogEntry(string tag, string value) {}
inline void addLogEntry(string tag, doublereal value) {}
inline void addLogEntry(string tag, int value) {}
inline void addLogEntry(string msg) {}
inline void endLogGroup(string title="") {}
inline void write_logfile(string file = "log.html") {}
inline void beginLogGroup(std::string title, int loglevel=-99) {}
inline void addLogEntry(std::string tag, std::string value) {}
inline void addLogEntry(std::string tag, doublereal value) {}
inline void addLogEntry(std::string tag, int value) {}
inline void addLogEntry(std::string msg) {}
inline void endLogGroup(std::string title="") {}
inline void write_logfile(std::string file = "log.html") {}
#endif
}

View File

@@ -41,7 +41,7 @@
#include "ctml.h"
using namespace ctml;
using namespace std;
// these are all used to check for duplicate reactions
class rxninfo {

View File

@@ -14,7 +14,7 @@
#define CT_IMPORTCTML_H
#include <string>
using namespace std;
//using namespace std;
#include "ThermoPhase.h"
#include "Kinetics.h"
@@ -26,12 +26,12 @@ namespace Cantera {
//class ThermoPhase;
class XML_Node;
bool isCTMLFile(string infile);
bool isCTMLFile(std::string infile);
XML_Node* get_XML_Node(const string& src, XML_Node* root);
XML_Node* get_XML_Node(const std::string& src, XML_Node* root);
XML_Node* get_XML_NameID(const string& nameTarget,
const string& file_ID, XML_Node* root);
XML_Node* get_XML_NameID(const std::string& nameTarget,
const std::string& file_ID, XML_Node* root);
bool installSpecies(int k, const XML_Node& s, thermo_t& p,
SpeciesThermo& spthermo, int rule,
@@ -40,13 +40,13 @@ namespace Cantera {
bool importPhase(XML_Node& phase, ThermoPhase* th,
SpeciesThermoFactory* spfactory = 0);
doublereal isDuplicateReaction(map<int, doublereal>& r1,
map<int, doublereal>& r2);
doublereal isDuplicateReaction(std::map<int, doublereal>& r1,
std::map<int, doublereal>& r2);
bool importKinetics(const XML_Node& phase, vector<ThermoPhase*> th,
bool importKinetics(const XML_Node& phase, std::vector<ThermoPhase*> th,
Kinetics* kin);
bool installReactionArrays(const XML_Node& parent, Kinetics& kin,
string default_phase, bool check_for_duplicates = false);
std::string default_phase, bool check_for_duplicates = false);
/***
* This function will check a specific reaction to see if it the
@@ -59,11 +59,11 @@ namespace Cantera {
ReactionData& rdata, int negA);
ThermoPhase* newPhase(XML_Node& phase);
ThermoPhase* newPhase(string file, string id);
bool buildSolutionFromXML(XML_Node& root, string id, string nm,
ThermoPhase* newPhase(std::string file, std::string id);
bool buildSolutionFromXML(XML_Node& root, std::string id, std::string nm,
ThermoPhase* th, Kinetics* k);
const XML_Node *speciesXML_Node(string kname,
const XML_Node *speciesXML_Node(std::string kname,
const XML_Node *phaseSpecies);
}

View File

@@ -6,7 +6,7 @@
#define CT_LOGGER_H
#include <iostream>
using namespace std;
//using namespace std;
namespace Cantera {
@@ -44,8 +44,8 @@ namespace Cantera {
/// appended to the message, and so if one is desired it must
/// be included in the string.
virtual void write(const string& msg) {
cout << msg;
virtual void write(const std::string& msg) {
std::cout << msg;
}
/// Write an error message and quit. The default behavior is
@@ -56,8 +56,8 @@ namespace Cantera {
/// terminate the application Cantera is invoked from (MATLAB,
/// Excel, etc.) If this is not desired, then derive a class
/// and reimplement this method.
virtual void error(const string& msg) {
cerr << msg << endl;
virtual void error(const std::string& msg) {
std::cerr << msg << std::endl;
exit(-1);
}

View File

@@ -1,3 +1,4 @@
/**
* @file misc.cpp
*
@@ -558,9 +559,9 @@ namespace Cantera {
throw CanteraError("findInputFile", msg);
return "";
}
else {
return name;
}
//else {
return name;
//}
}
doublereal toSI(string unit) {

View File

@@ -88,8 +88,8 @@ namespace Cantera {
jmax = m_points - 1;
}
else { // evaluate points for Jacobian
jmin = max(jpt-1, 0);
jmax = min(jpt+1,m_points-1);
jmin = std::max(jpt-1, 0);
jmax = std::min(jpt+1,m_points-1);
}
for (j = jmin; j <= jmax; j++) {

View File

@@ -139,12 +139,12 @@ namespace Cantera {
int nPoints() const { return m_points; }
/// Name of the nth component. May be overloaded.
virtual string componentName(int n) const {
virtual std::string componentName(int n) const {
if (m_name[n] != "") return m_name[n];
else return "component " + int2str(n);
}
void setComponentName(int n, string name) {
void setComponentName(int n, std::string name) {
m_name[n] = name;
}
@@ -153,7 +153,7 @@ namespace Cantera {
}
/// index of component with name \a name.
int componentIndex(string name) {
int componentIndex(std::string name) {
int nc = nComponents();
for (int n = 0; n < nc; n++) {
if (name == componentName(n)) return n;
@@ -257,7 +257,7 @@ namespace Cantera {
integer* mask, doublereal rdt=0.0);
virtual doublereal residual(doublereal* x, int n, int j) {
throw CanteraError("Domain1D::residual","residual function must be overloaded in derived class");
throw CanteraError("Domain1D::residual","residual function must be overloaded in derived class "+id());
}
int timeDerivativeFlag(int n) { return m_td[n];}
@@ -367,22 +367,22 @@ namespace Cantera {
/**
* Specify an identifying tag for this domain.
*/
void setID(const string& s) {m_id = s;}
void setID(const std::string& s) {m_id = s;}
string id() {
std::string id() {
if (m_id != "") return m_id;
else return string("domain ") + int2str(m_index);
else return std::string("domain ") + int2str(m_index);
}
/**
* Specify descriptive text for this domain.
*/
void setDesc(const string& s) {m_desc = s;}
const string& desc() { return m_desc; }
void setDesc(const std::string& s) {m_desc = s;}
const std::string& desc() { return m_desc; }
virtual void getTransientMask(integer* mask){}
virtual void showSolution_s(ostream& s, const doublereal* x) {}
virtual void showSolution_s(std::ostream& s, const doublereal* x) {}
virtual void showSolution(const doublereal* x);
virtual void restore(const XML_Node& dom, doublereal* soln) {}
@@ -394,7 +394,7 @@ namespace Cantera {
doublereal zmax() const { return m_z[m_points - 1]; }
void setProfile(string name, doublereal* values, doublereal* soln) {
void setProfile(std::string name, doublereal* values, doublereal* soln) {
int n, j;
for (n = 0; n < m_nv; n++) {
if (name == componentName(n)) {
@@ -467,10 +467,10 @@ namespace Cantera {
int m_iloc;
int m_jstart;
Domain1D *m_left, *m_right;
string m_id, m_desc;
std::string m_id, m_desc;
Refiner* m_refiner;
vector_int m_td;
vector<string> m_name;
std::vector<std::string> m_name;
private:

View File

@@ -56,8 +56,8 @@ namespace Cantera {
/// Temperature [K].
virtual doublereal temperature() {return m_temp;}
/// Set the mole fractions by specifying a string.
virtual void setMoleFractions(string xin){err("setMoleFractions");}
/// Set the mole fractions by specifying a std::string.
virtual void setMoleFractions(std::string xin){err("setMoleFractions");}
/// Set the mole fractions by specifying an array.
virtual void setMoleFractions(doublereal* xin){err("setMoleFractions");}
@@ -92,7 +92,7 @@ namespace Cantera {
doublereal m_temp, m_mdot;
private:
void err(string method) {
void err(std::string method) {
throw CanteraError("Bdry1D::"+method,
"attempt to call base class method "+method);
}
@@ -155,10 +155,10 @@ namespace Cantera {
virtual void _finalize(const doublereal* x) {}
virtual void setMoleFractions(string xin);
virtual void setMoleFractions(std::string xin);
virtual void setMoleFractions(doublereal* xin);
virtual doublereal massFraction(int k) {return m_yin[k];}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt);
@@ -171,7 +171,7 @@ namespace Cantera {
doublereal m_V0;
int m_nsp;
vector_fp m_yin;
string m_xstr;
std::string m_xstr;
StFlow *m_flow;
};
@@ -188,7 +188,7 @@ namespace Cantera {
}
virtual ~Empty1D(){}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void showSolution(const doublereal* x) {}
virtual void init();
@@ -220,7 +220,7 @@ namespace Cantera {
}
virtual ~Symm1D(){}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();
@@ -252,7 +252,7 @@ namespace Cantera {
}
virtual ~Outlet1D(){}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();
@@ -299,10 +299,10 @@ namespace Cantera {
;
}
virtual void setMoleFractions(string xin);
virtual void setMoleFractions(std::string xin);
virtual void setMoleFractions(doublereal* xin);
virtual doublereal massFraction(int k) {return m_yres[k];}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt);
@@ -313,7 +313,7 @@ namespace Cantera {
int m_nsp;
vector_fp m_yres;
string m_xstr;
std::string m_xstr;
StFlow *m_flow;
};
@@ -333,7 +333,7 @@ namespace Cantera {
}
virtual ~Surf1D(){}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();
@@ -351,9 +351,9 @@ namespace Cantera {
; //m_temp = x[0];
}
virtual void showSolution_s(ostream& s, const doublereal* x) {
s << "------------------- Surface " << domainIndex() << " ------------------- " << endl;
s << " temperature: " << m_temp << " K" << " " << x[0] << endl;
virtual void showSolution_s(std::ostream& s, const doublereal* x) {
s << "------------------- Surface " << domainIndex() << " ------------------- " << std::endl;
s << " temperature: " << m_temp << " K" << " " << x[0] << std::endl;
}
virtual void showSolution(const doublereal* x) {
@@ -393,7 +393,7 @@ namespace Cantera {
virtual ~ReactingSurf1D(){}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
virtual void init();

View File

@@ -31,6 +31,8 @@ using namespace std;
#include "../stringUtils.h"
#include <time.h>
using namespace std;
namespace Cantera {
//----------------------------------------------------------
@@ -130,13 +132,14 @@ namespace Cantera {
}
#endif
//try {
iok = jac.solve(sz, step, step);
if (iok > 0) {
iok = jac.solve(sz, step, step);
// if iok is non-zero, then solve failed
if (iok > 0) {
iok--;
int nd = r.nDomains();
for (n = nd-1; n >= 0; n--)
if (iok >= r.start(n)) { break; }
if (iok >= r.start(n)) { break; }
Domain1D& dom = r.domain(n);
int offset = iok - r.start(n);
int pt = offset/dom.nComponents();
@@ -146,14 +149,10 @@ namespace Cantera {
dom.id() + ", component "
+dom.componentName(comp)+" at point "
+int2str(pt)+"\n(Matrix row "+int2str(iok)+") \nsee file bandmatrix.csv\n");
}
else if (iok < 0)
}
else if (iok < 0)
throw CanteraError("MultiNewton::step",
"iok = "+int2str(iok));
//}
//catch (CanteraError) {
//showErrors(cout);
//}
"iok = "+int2str(iok));
#ifdef DEBUG_STEP
bool ok = false;

View File

@@ -61,7 +61,7 @@ namespace Cantera {
doublereal* getWorkArray();
void releaseWorkArray(doublereal* work);
vector<doublereal*> m_workarrays;
std::vector<doublereal*> m_workarrays;
int m_maxAge;
int m_nv, m_np, m_n;
doublereal m_elapsed;

View File

@@ -10,6 +10,7 @@
#include "../ctml.h"
using namespace ctml;
using namespace std;
namespace Cantera {

View File

@@ -24,7 +24,7 @@ namespace Cantera {
OneDim();
// Constructor.
OneDim(vector<Domain1D*> domains);
OneDim(std::vector<Domain1D*> domains);
/// Destructor.
virtual ~OneDim();
@@ -52,7 +52,7 @@ namespace Cantera {
/// Return a reference to domain i.
Domain1D& domain(int i) const { return *m_dom[i]; }
int domainIndex(string name);
int domainIndex(std::string name);
/// The index of the start of domain i in the solution vector.
int start(int i) const { return m_dom[i]->loc(); }
@@ -139,7 +139,7 @@ namespace Cantera {
void writeStats();
void save(string fname, string id, string desc, doublereal* sol);
void save(std::string fname, std::string id, std::string desc, doublereal* sol);
// options
void setMinTimeStep(doublereal tmin) { m_tmin = tmin; }
@@ -171,7 +171,7 @@ namespace Cantera {
int m_bw; // Jacobian bandwidth
int m_size; // solution vector size
vector<Domain1D*> m_dom, m_connect, m_bulk;
std::vector<Domain1D*> m_dom, m_connect, m_bulk;
bool m_init;
vector_int m_nvars;

View File

@@ -123,7 +123,7 @@ namespace Cantera {
int nPoints() const { return m_points; }
/// Name of the nth component. May be overloaded.
virtual string componentName(int n) const {
virtual std::string componentName(int n) const {
return "component " + int2str(n); }
/**
@@ -312,12 +312,12 @@ namespace Cantera {
/**
* Specify an identifying tag for this domain.
*/
void setID(const string& s) {m_id = s;}
void setID(const std::string& s) {m_id = s;}
/**
* Specify descriptive text for this domain.
*/
void setDesc(const string& s) {m_desc = s;}
void setDesc(const std::string& s) {m_desc = s;}
virtual void getTransientMask(integer* mask){}
@@ -330,7 +330,7 @@ namespace Cantera {
doublereal zmax() const { return m_z[m_points - 1]; }
void setProfile(string name, doublereal* values, doublereal* soln) {
void setProfile(std::string name, doublereal* values, doublereal* soln) {
int n, j;
for (n = 0; n < m_nv; n++) {
if (name == componentName(n)) {
@@ -383,7 +383,7 @@ namespace Cantera {
int m_iloc;
int m_jstart;
Resid1D *m_left, *m_right;
string m_id, m_desc;
std::string m_id, m_desc;
Refiner* m_refiner;
private:

View File

@@ -11,6 +11,8 @@
#include "Sim1D.h"
#include "MultiJac.h"
using namespace std;
namespace Cantera {

View File

@@ -35,7 +35,7 @@ namespace Cantera {
* the pointer to the leftmost domain is domain[0], the pointer to the
* domain to its right is domain[1], etc.
*/
Sim1D(vector<Domain1D*>& domains);
Sim1D(std::vector<Domain1D*>& domains);
/// Destructor. Does nothing.
virtual ~Sim1D() {}
@@ -50,7 +50,7 @@ namespace Cantera {
/// Set initial guess based on equilibrium
//added by Karl Meredith
void setInitialGuess(string component, vector_fp& locs, vector_fp& vals);
void setInitialGuess(std::string component, vector_fp& locs, vector_fp& vals);
/// Set one entry in the solution vector.
void setValue(int dom, int comp, int localPoint, doublereal value);
@@ -69,10 +69,10 @@ namespace Cantera {
//@}
void save(string fname, string id, string desc);
void save(std::string fname, std::string id, std::string desc);
/// Print to stream s the current solution for all domains.
void showSolution(ostream& s);
void showSolution(std::ostream& s);
void showSolution();
const doublereal* solution() { return DATA_PTR(m_x); }
@@ -100,11 +100,11 @@ namespace Cantera {
doublereal slope = 0.8, doublereal curve = 0.8, doublereal prune = -0.1);
void setMaxGridPoints(int dom = -1, int npoints = 300);
void restore(string fname, string id);
void restore(std::string fname, std::string id);
void getInitialSoln();
void setSolution(const doublereal* soln) {
copy(soln, soln + m_x.size(), DATA_PTR(m_x));
std::copy(soln, soln + m_x.size(), DATA_PTR(m_x));
}
const doublereal* solution() const { return DATA_PTR(m_x); }

View File

@@ -183,7 +183,7 @@ namespace Cantera {
*/
doublereal C_fixed(int k, int j) const {return m_fixedc(k,j);}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
void setDielectricConstant(doublereal e) { m_eps = e; }
doublereal dielectricConstant() { return m_eps; }
@@ -193,7 +193,7 @@ namespace Cantera {
* May be called multiple times to generate animation.
*/
void outputTEC(ostream &s, const doublereal* x,
string title, int zone);
std::string title, int zone);
virtual void showSolution(const doublereal* x);
@@ -202,7 +202,7 @@ namespace Cantera {
virtual void restore(XML_Node& dom, doublereal* soln);
// overloaded in subclasses
virtual string solidType() { return "<none>"; }
virtual std::string solidType() { return "<none>"; }
void solveEnergyEqn(int j=-1) {
if (j < 0)
@@ -382,9 +382,9 @@ namespace Cantera {
bool m_ok;
// flags
vector<bool> m_do_energy;
vector<bool> m_do_species;
vector<bool> m_do_gauss;
std::vector<bool> m_do_energy;
std::vector<bool> m_do_species;
std::vector<bool> m_do_gauss;
// fixed T and Y values
Array2D m_fixedy;

View File

@@ -27,6 +27,7 @@
#include "MultiJac.h"
using namespace ctml;
using namespace std;
namespace Cantera {

View File

@@ -172,10 +172,10 @@ namespace Cantera {
doublereal Y_fixed(int k, int j) const {return m_fixedy(k,j);}
virtual string componentName(int n) const;
virtual std::string componentName(int n) const;
//added by Karl Meredith
int componentIndex(string name) const;
int componentIndex(std::string name) const;
virtual void showSolution(const doublereal* x);
@@ -185,7 +185,7 @@ namespace Cantera {
virtual void restore(const XML_Node& dom, doublereal* soln);
// overloaded in subclasses
virtual string flowType() { return "<none>"; }
virtual std::string flowType() { return "<none>"; }
void solveEnergyEqn(int j=-1) {
if (j < 0)
@@ -442,9 +442,9 @@ namespace Cantera {
bool m_ok;
// flags
vector<bool> m_do_energy;
std::vector<bool> m_do_energy;
bool m_do_soret;
vector<bool> m_do_species;
std::vector<bool> m_do_species;
int m_transport_option;
// solution estimate
@@ -477,7 +477,7 @@ namespace Cantera {
virtual ~AxiStagnFlow() {}
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual string flowType() { return "Axisymmetric Stagnation"; }
virtual std::string flowType() { return "Axisymmetric Stagnation"; }
};
/**
@@ -490,7 +490,7 @@ namespace Cantera {
virtual ~FreeFlame() {}
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual string flowType() { return "Free Flame"; }
virtual std::string flowType() { return "Free Flame"; }
virtual bool fixed_mdot() { return false; }
};
@@ -504,7 +504,7 @@ namespace Cantera {
virtual ~OneDFlow() {}
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual string flowType() { return "OneDFlow"; }
virtual std::string flowType() { return "OneDFlow"; }
doublereal mdot(doublereal* x, int j) {
return x[index(c_offset_L,j)];
}

View File

@@ -89,7 +89,7 @@ namespace Cantera {
doublereal multiplier(int k) { return m_mult[k]; }
virtual string componentName(int n) const {
virtual std::string componentName(int n) const {
return m_sphase->speciesName(n);
}
@@ -297,11 +297,11 @@ namespace Cantera {
int m_sp_left, m_sp_right;
int m_start_left, m_start_right, m_start_surf;
ThermoPhase *m_phase_left, *m_phase_right;
vector<ThermoPhase*> m_bulk;
vector<int> m_nbulk;
std::vector<ThermoPhase*> m_bulk;
std::vector<int> m_nbulk;
int m_nsurf;
vector_fp m_mult;
vector<bool> m_do_surf_species;
std::vector<bool> m_do_surf_species;
vector_fp m_fixed_cov;
};

View File

@@ -18,6 +18,8 @@
#include "Inlet1D.h"
using namespace std;
namespace Cantera {
Bdry1D::Bdry1D() : Domain1D(1, 1, 0.0),

View File

@@ -10,6 +10,8 @@
#include "../ct_defs.h"
#include "Domain1D.h"
using namespace std;
namespace Cantera {
class Indx {

View File

@@ -40,10 +40,10 @@ namespace Cantera {
protected:
map<int, int> m_loc;
map<int, int> m_keep;
map<string, int> m_c;
vector<bool> m_active;
std::map<int, int> m_loc;
std::map<int, int> m_keep;
std::map<std::string, int> m_c;
std::vector<bool> m_active;
doublereal m_ratio, m_slope, m_curve, m_prune;
doublereal m_min_range;
Domain1D* m_domain;

Some files were not shown because too many files have changed in this diff Show More