From 2d5f8c4a453b8076104c5cce6e8a86bf584557e4 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Mon, 28 Mar 2011 20:08:31 +0000 Subject: [PATCH] took out namespaces from headers --- Cantera/src/converters/CKParser.cpp | 1 - Cantera/src/converters/CKParser.h | 11 +++++------ Cantera/src/converters/CKReader.h | 1 - Cantera/src/converters/Constituent.h | 3 +-- Cantera/src/converters/Element.h | 22 +++++++--------------- Cantera/src/converters/Reaction.cpp | 2 ++ Cantera/src/converters/Reaction.h | 24 ++++++++++++------------ Cantera/src/converters/RxnSpecies.h | 10 +++------- Cantera/src/converters/Species.h | 16 ++++++++-------- Cantera/src/converters/ckr_defs.h | 3 --- Cantera/src/converters/ckr_utils.h | 23 +++++++++++------------ Cantera/src/converters/writelog.h | 4 +--- 12 files changed, 50 insertions(+), 70 deletions(-) diff --git a/Cantera/src/converters/CKParser.cpp b/Cantera/src/converters/CKParser.cpp index b51b408ea..03d5336e6 100755 --- a/Cantera/src/converters/CKParser.cpp +++ b/Cantera/src/converters/CKParser.cpp @@ -22,7 +22,6 @@ #include "ckr_utils.h" #include "writelog.h" #include -//#include "../stringUtils.h" #include using namespace std; diff --git a/Cantera/src/converters/CKParser.h b/Cantera/src/converters/CKParser.h index f8da04605..90ab2a3f5 100755 --- a/Cantera/src/converters/CKParser.h +++ b/Cantera/src/converters/CKParser.h @@ -16,7 +16,6 @@ #include #include #include -//using namespace std; #include "ckr_defs.h" #include "Element.h" @@ -58,17 +57,17 @@ namespace ckr { bool readElementSection(elementList& elements); bool readSpeciesSection(speciesList& species); - bool readThermoSection(vector& names, + bool readThermoSection(std::vector& names, speciesTable& speciesData, vector_fp& temp, - int& optionFlag, ostream& log); - bool readReactionSection(const vector& speciesNames, - vector& elementNames, + int& optionFlag, std::ostream& log); + bool readReactionSection(const std::vector& speciesNames, + std::vector& elementNames, reactionList& reactions, ReactionUnits& units); bool advanceToKeyword(const std::string& kw, const std::string& stop); bool verbose; bool debug; - bool readNASA9ThermoSection(std::vector& names, + bool readNASA9ThermoSection(std::vector& names, speciesTable& species, vector_fp& temp, int& optionFlag, std::ostream& log); diff --git a/Cantera/src/converters/CKReader.h b/Cantera/src/converters/CKReader.h index 4c4274c7a..61b02b217 100755 --- a/Cantera/src/converters/CKReader.h +++ b/Cantera/src/converters/CKReader.h @@ -23,7 +23,6 @@ #include #include -using namespace std; namespace ckr { diff --git a/Cantera/src/converters/Constituent.h b/Cantera/src/converters/Constituent.h index d8daf5d06..c81773045 100755 --- a/Cantera/src/converters/Constituent.h +++ b/Cantera/src/converters/Constituent.h @@ -11,7 +11,6 @@ #include #include -using namespace std; namespace ckr { @@ -22,7 +21,7 @@ namespace ckr { */ class Constituent { public: - string name; //!< The name of the object. + std::string name; //!< The name of the object. double number; //!< The number of units (molecules, etc.). }; diff --git a/Cantera/src/converters/Element.h b/Cantera/src/converters/Element.h index 5ba352502..30c6b9070 100755 --- a/Cantera/src/converters/Element.h +++ b/Cantera/src/converters/Element.h @@ -11,8 +11,8 @@ #include #include +#include -using namespace std; namespace ckr { @@ -41,7 +41,7 @@ public: /// Construct a new empty Element object - Element(const string& nm, double wt) : + Element(const std::string& nm, double wt) : name(nm), atomicWeight(wt), valid(0), @@ -54,12 +54,12 @@ public: /// Destructor ~Element() {} - string name; //!< Element name + std::string name; //!< Element name double atomicWeight; //!< Atomic weight in amu int valid; //!< flag returned by validation routines int index; //!< index number bool weightFromDB; //!< true if atomic weight is not specified - string comment; //!< comment in input file + std::string comment; //!< comment in input file /** @@ -72,11 +72,11 @@ public: bool operator!=(const Element& e) const { return !(*this == e); } - friend ostream& operator<<(ostream& s, const Element& e) { + friend std::ostream& operator<<(std::ostream& s, const Element& e) { s << e.name; if (!e.weightFromDB) s << "/" << e.atomicWeight << "/"; if (e.comment != "") - s << " !" << e.comment << endl; + s << " !" << e.comment << std::endl; else s << " "; return s; @@ -84,18 +84,10 @@ public: }; /// a list (vector) of Elements -typedef vector elementList; +typedef std::vector elementList; } #endif - - - - - - - - diff --git a/Cantera/src/converters/Reaction.cpp b/Cantera/src/converters/Reaction.cpp index fd4b57d2d..bce59d0ee 100755 --- a/Cantera/src/converters/Reaction.cpp +++ b/Cantera/src/converters/Reaction.cpp @@ -14,6 +14,8 @@ #include #include +using namespace std; + namespace ckr { Reaction forwardReaction(const Reaction& rxn) { diff --git a/Cantera/src/converters/Reaction.h b/Cantera/src/converters/Reaction.h index c626ea87e..52c3c4948 100755 --- a/Cantera/src/converters/Reaction.h +++ b/Cantera/src/converters/Reaction.h @@ -12,7 +12,7 @@ #include #include #include -using namespace std; +#include #include "ckr_defs.h" #include "ckr_utils.h" @@ -183,7 +183,7 @@ namespace ckr { * third body collision partners, or a species name if only * one species does. */ - string thirdBody; + std::string thirdBody; /// Reaction number. int number; @@ -192,21 +192,21 @@ namespace ckr { * list of species that participate as reactants, * and their stoichiometric coefficients */ - vector reactants; + std::vector reactants; - mutable map fwdOrder; + mutable std::map fwdOrder; /** * list of species that participate as products, * and their stoichiometric coefficients */ - vector products; + std::vector products; /** * map from species names to enhanced third-body collision efficiencies */ - mutable map e3b; + mutable std::map e3b; /** * Forward rate coefficient. For falloff reactions, this is the @@ -231,28 +231,28 @@ namespace ckr { /** * auxiliary data not handled elsewhere. */ - mutable map otherAuxData; + mutable std::map otherAuxData; /** * input file lines */ - vector lines; + std::vector lines; /** * comments */ - vector comment; + std::vector comment; // methods - double stoichCoefficient(const string& s) const; + double stoichCoefficient(const std::string& s) const; bool operator==(const Reaction& r) const; - void write(ostream& s) const; + void write(std::ostream& s) const; }; /// a list of Reaction objects - typedef vector reactionList; + typedef std::vector reactionList; Reaction forwardReaction(const Reaction& rxn); Reaction reverseReaction(const Reaction& rxn); diff --git a/Cantera/src/converters/RxnSpecies.h b/Cantera/src/converters/RxnSpecies.h index e49b46a79..7565fafbe 100755 --- a/Cantera/src/converters/RxnSpecies.h +++ b/Cantera/src/converters/RxnSpecies.h @@ -11,15 +11,11 @@ #include #include -//#include "Cantera.h" - -using namespace std; namespace ckr { - typedef vector_int group_t; - typedef vector grouplist_t; - + typedef vector_int group_t; + typedef std::vector grouplist_t; /** * A class for species in a reaction. @@ -29,7 +25,7 @@ class RxnSpecies { public: RxnSpecies() : number(0) {} - string name; //!< The name of the object. + std::string name; //!< The name of the object. double number; //!< The number of units (molecules, etc.). grouplist_t groups; }; diff --git a/Cantera/src/converters/Species.h b/Cantera/src/converters/Species.h index 9b82c7d3a..37afde930 100755 --- a/Cantera/src/converters/Species.h +++ b/Cantera/src/converters/Species.h @@ -58,19 +58,19 @@ namespace ckr { int thermoFormatType; //! Species Name - string name; - string id; //!< ID tag from 'date' field in input - string phase; //!< Phase string. Usually "G", "L", or "S". + std::string name; + std::string id; //!< ID tag from 'date' field in input + std::string phase; //!< Phase string. Usually "G", "L", or "S". double tlow; //!< Min temperature for thermo data fit double tmid; //!< Mid temperature for thermo data fit double thigh; //!< Max temperature for thermo data fit /// list of Constituent objects defining elemental composition - vector elements; + std::vector elements; /// map from element symbols to atom numbers - mutable map comp; + mutable std::map comp; /// polynomial coefficients for the lower temperature range vector_fp lowCoeffs; @@ -91,7 +91,7 @@ namespace ckr { /// position in the list of species in the input file int index; - string m_commentsRef; + std::string m_commentsRef; private: //! Delete private data @@ -99,10 +99,10 @@ namespace ckr { }; //! Shorthand for a list of Species - typedef vector speciesList; + typedef std::vector speciesList; //! A map from species names to Species objects - typedef map speciesTable; + typedef std::map speciesTable; } #endif diff --git a/Cantera/src/converters/ckr_defs.h b/Cantera/src/converters/ckr_defs.h index 8138974f7..52ffb68d5 100755 --- a/Cantera/src/converters/ckr_defs.h +++ b/Cantera/src/converters/ckr_defs.h @@ -14,9 +14,6 @@ #include #include #include -//using namespace std; - -//#include "../ctvector.h" /// the namespace for the CKReader packaage namespace ckr { diff --git a/Cantera/src/converters/ckr_utils.h b/Cantera/src/converters/ckr_utils.h index 634a6ace4..04c6f5260 100755 --- a/Cantera/src/converters/ckr_utils.h +++ b/Cantera/src/converters/ckr_utils.h @@ -17,7 +17,6 @@ #include #include -using namespace std; #ifdef WIN32 #define TYPENAME_KEYWORD @@ -35,9 +34,9 @@ namespace ckr { */ template -void getMapKeys(const map& mp, vector& keys) { +void getMapKeys(const std::map& mp, std::vector& keys) { keys.clear(); - TYPENAME_KEYWORD map::const_iterator i = mp.begin(); + TYPENAME_KEYWORD std::map::const_iterator i = mp.begin(); for (; i != mp.end(); ++i) keys.push_back(i->first); } @@ -49,9 +48,9 @@ void getMapKeys(const map& mp, vector& keys) { */ template -void getMapValues(const map& mp, vector& values) { +void getMapValues(const std::map& mp, std::vector& values) { values.clear(); - TYPENAME_KEYWORD map::const_iterator i = mp.begin(); + TYPENAME_KEYWORD std::map::const_iterator i = mp.begin(); for (; i != mp.end(); ++i) values.push_back(i->second); } @@ -120,10 +119,10 @@ inline bool valid(L& list) { /// Remove all white space from string s. -void removeWhiteSpace(string& s); +void removeWhiteSpace(std::string& s); -void getTokens(string& begin, - int n, vector& toks, char delim=' '); +void getTokens(std::string& begin, + int n, std::vector& toks, char delim=' '); /** @@ -137,12 +136,12 @@ void getTokens(string& begin, * */ -bool match(const string& s1, const string& s2); +bool match(const std::string& s1, const std::string& s2); /** * Check whether string 'word' begins with a Chemkin keyword. */ -inline bool isKeyword(string word) +inline bool isKeyword(std::string word) { return (match(word, "ELEM") || match(word, "SPEC") || @@ -152,8 +151,8 @@ inline bool isKeyword(string word) } -bool extractSlashData(string& s, string& name, string& data); -string capitalize(const string& word); +bool extractSlashData(std::string& s, std::string& name, std::string& data); +std::string capitalize(const std::string& word); } diff --git a/Cantera/src/converters/writelog.h b/Cantera/src/converters/writelog.h index b079d90bf..906fc57d9 100755 --- a/Cantera/src/converters/writelog.h +++ b/Cantera/src/converters/writelog.h @@ -12,15 +12,13 @@ #include #include #include -//using namespace std; #include "Species.h" #include "Reaction.h" -//#include "Cantera.h" namespace ckr { - std::string newTask(string msg); + std::string newTask(std::string msg); bool writeFalloff(int type, const vector_fp& c, std::ostream& log); bool writeRateCoeff(const RateCoeff& k, std::ostream& log); void printReactionEquation(std::ostream& f, const Reaction& r);