From fdcb5164deadbaaf3dc19b0aaaa97bf5af6f2f93 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 10 Jan 2009 17:58:12 +0000 Subject: [PATCH] doxygen update. includes demangling --- Cantera/src/base/Array.h | 1 - Cantera/src/base/ct2ctml.cpp | 1 + Cantera/src/base/ctml.cpp | 77 ++++++++++++++++++++------ Cantera/src/base/ctml.h | 93 +++++++++++++++++++++++++++++--- Cantera/src/base/stringUtils.cpp | 1 + 5 files changed, 150 insertions(+), 23 deletions(-) diff --git a/Cantera/src/base/Array.h b/Cantera/src/base/Array.h index 7c089ae7b..f0acd34a6 100755 --- a/Cantera/src/base/Array.h +++ b/Cantera/src/base/Array.h @@ -18,7 +18,6 @@ #include "ct_defs.h" #include "ctexceptions.h" -#include "stringUtils.h" #include "utilities.h" namespace Cantera { diff --git a/Cantera/src/base/ct2ctml.cpp b/Cantera/src/base/ct2ctml.cpp index 49c53a551..ef91e7587 100644 --- a/Cantera/src/base/ct2ctml.cpp +++ b/Cantera/src/base/ct2ctml.cpp @@ -26,6 +26,7 @@ #include #include "ctml.h" #include "global.h" +#include "stringUtils.h" using namespace std; diff --git a/Cantera/src/base/ctml.cpp b/Cantera/src/base/ctml.cpp index 6e8f5073a..c0bbebeed 100755 --- a/Cantera/src/base/ctml.cpp +++ b/Cantera/src/base/ctml.cpp @@ -23,10 +23,13 @@ #define CTML_VERSION_1_4_1 #include "global.h" +#include "stringUtils.h" + #include #include + using namespace std; using namespace Cantera; @@ -763,20 +766,61 @@ namespace ctml { return x; } - /* - * getFloatArray(): + //! This function reads a child node with the default name, "floatArray", with a value + //! consisting of a comma separated list of floats + /*! + * This function will read a child node to the current XML node, with the + * name "floatArray". It will have a title attribute, and the body + * of the XML node will be filled out with a comma separated list of + * doublereals. + * Get an array of floats from the XML Node. The argument field + * is assumed to consist of an arbitrary number of comma + * separated floats, with an arbitrary amount of white space + * separating each field. + * If the node array has an units attribute field, then + * the units are used to convert the floats, iff convert is true. * - * Get an array of floats from the XML Node. The argument field - * is assumed to consist of an arbitrary number of comma - * separated floats, with an arbitrary amount of white space - * separating each field. - * If the node array has an units attribute field, then - * the units are used to convert the floats, iff convert is true. + * Example: * - * nodeName = The default value for the node name is floatArray + * Code snipet: + * @verbatum + const XML_Node &State_XMLNode; + vector_fp v; + bool convert = true; + unitsString = ""; + nodeName="floatArray"; + getFloatArray(State_XMLNode, v, convert, unitsString, nodeName); + @endverbatum + * + * reads the corresponding XML file: + * + * @verbatum + + 32.4, 1, 100. <\floatArray> + <\state> + @endverbatum + * + * Will produce the vector + * + * v[0] = 32.4 + * v[1] = 1.0 + * v[2] = 100. + * + * + * @param node XML parent node of the floatArray + * @param v Output vector of floats containing the floatArray information. + * @param convert Conversion to SI is carried out if this boolean is + * True. The default is true. + * @param typeString String name of the type attribute. This is an optional + * parameter. The default is to have an empty string. + * The only string that is recognized is actEnergy. + * Anything else has no effect. This affects what + * units converter is used. + * @param nodeName XML Name of the XML node to read. + * The default value for the node name is floatArray */ - void getFloatArray(const Cantera::XML_Node& node, vector_fp& v, bool convert, - std::string type, std::string nodeName) { + void getFloatArray(const Cantera::XML_Node& node, vector_fp& v, const bool convert, + const std::string unitsString, const std::string nodeName) { string::size_type icom; string numstr; doublereal dtmp; @@ -793,11 +837,11 @@ namespace ctml { /* * Get the attributes field, units, from the XML node */ - string units = node["units"]; + std::string units = node["units"]; if (units != "" && convert) { - if (type == "actEnergy" && units != "") { + if (unitsString == "actEnergy" && units != "") { funit = actEnergyToSI(units); - } else if (type != "" && units != "") { + } else if (unitsString != "" && units != "") { funit = toSI(units); } } @@ -808,7 +852,7 @@ namespace ctml { vmax = atofCheck(node["max"].c_str()); doublereal vv; - string val = node.value(); + std::string val = node.value(); while (1 > 0) { icom = val.find(','); if (icom != string::npos) { @@ -1094,7 +1138,8 @@ namespace ctml { * The separate tokens are returned in the string vector, * v. */ - void getStringArray(const std::string& oval, vector& v) { + void getStringArray(const std::string& oval, + std::vector& v) { std::string val(oval); string::size_type ibegin, iend; v.clear(); diff --git a/Cantera/src/base/ctml.h b/Cantera/src/base/ctml.h index 3e22d65a0..93eecf757 100755 --- a/Cantera/src/base/ctml.h +++ b/Cantera/src/base/ctml.h @@ -125,7 +125,7 @@ namespace ctml { * @verbatum const XML_Node &node; std::string titleString = "activationEnergy"; - double value = 50.3; + doublereal value = 50.3; doublereal maxval = 1.0E3; doublereal minval = 0.0; std::string typeString = "optional"; @@ -229,7 +229,7 @@ namespace ctml { * This function will add a child node to the current XML node, with the * name "floatArray". It will have a title attribute, and the body * of the XML node will be filled out with a comma separated list of - * integers + * doublereals. * * Example: * @@ -312,12 +312,93 @@ namespace ctml { void addString(Cantera::XML_Node& node, const std::string &titleString, const std::string &valueString, const std::string typeString=""); + + //! This function reads a child node with the default name, "floatArray", with a value + //! consisting of a comma separated list of floats + /*! + * This function will read a child node to the current XML node, with the + * name "floatArray". It will have a title attribute, and the body + * of the XML node will be filled out with a comma separated list of + * doublereals. + * Get an array of floats from the XML Node. The argument field + * is assumed to consist of an arbitrary number of comma + * separated floats, with an arbitrary amount of white space + * separating each field. + * If the node array has an units attribute field, then + * the units are used to convert the floats, iff convert is true. + * + * Example: + * + * Code snipet: + * @verbatum + const XML_Node &State_XMLNode; + vector_fp v; + bool convert = true; + unitsString = ""; + nodeName="floatArray"; + getFloatArray(State_XMLNode, v, convert, unitsString, nodeName); + @endverbatum + * + * reads the corresponding XML file: + * + * @verbatum + + 32.4, 1, 100. <\floatArray> + <\state> + @endverbatum + * + * Will produce the vector + * + * v[0] = 32.4 + * v[1] = 1.0 + * v[2] = 100. + * + * + * @param node XML parent node of the floatArray + * @param v Output vector of floats containing the floatArray information. + * @param convert Conversion to SI is carried out if this boolean is + * True. The default is true. + * @param typeString String name of the type attribute. This is an optional + * parameter. The default is to have an empty string. + * The only string that is recognized is actEnergy. + * Anything else has no effect. This affects what + * units converter is used. + * @param nodeName XML Name of the XML node to read. + * The default value for the node name is floatArray + */ void getFloatArray(const Cantera::XML_Node& node, Cantera::vector_fp& v, - bool convert=true, std::string type="", - std::string nodeName = "floatArray"); + const bool convert=true, const std::string typeString="", + const std::string nodeName = "floatArray"); + + void getStringArray(const Cantera::XML_Node& node, std::vector& v); + + + + //! This function separates a string up into tokens + //! according to the location of white space. + /*! + * The separate tokens are returned in a string vector, v. + * + * @param val String to be broken up + * @param v Output vector of tokens. + */ void getStringArray(const std::string& val, std::vector& v); + + /** + * This routine is used to interpret the value portions of XML + * elements that contain colon separated pairs. These are used, + * for example, in describing the element composition of species. + * H:4 C:1 + * The string is first separated into a string vector according + * to the location of white space. Then each string is again + * separated into two parts according to the location of a + * colon in the string. The first part of the string is + * used as the key, while the second part of the string is + * used as the value, in the return map. + * It is an error to not find a colon in each string pair. + */ void getMap(const Cantera::XML_Node& node, std::map& m); //! This function interprets the value portion of an XML element @@ -397,7 +478,7 @@ namespace ctml { //! Get a floating-point value from a child element. /*! - * Returns a double value for the child named 'name' of element 'parent'. If + * Returns a doublereal value for the child named 'name' of element 'parent'. If * 'type' is supplied and matches a known unit type, unit * conversion to SI will be done if the child element has an attribute * 'units'. @@ -478,7 +559,7 @@ namespace ctml { //! Get a floating-point value from a child element with a defined units field /*! - * Returns a double value for the child named 'name' of element 'parent'. + * Returns a doublereal value for the child named 'name' of element 'parent'. * 'type' must be supplied and match a known unit type. * * Note, it's an error for the child element not to exist. diff --git a/Cantera/src/base/stringUtils.cpp b/Cantera/src/base/stringUtils.cpp index 1962fbc0a..f5af9025e 100755 --- a/Cantera/src/base/stringUtils.cpp +++ b/Cantera/src/base/stringUtils.cpp @@ -17,6 +17,7 @@ #endif #include "ct_defs.h" +#include "stringUtils.h" #include "ctexceptions.h" #include "global.h" #include