From 95fd7f0b760de12c896607d39eaa6d790e5b6d21 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 14 Aug 2010 19:19:43 +0000 Subject: [PATCH] Doxygen update Rearrangement of LTPspecies to put more routines in .cpp files --- Cantera/src/transport/LTPspecies.cpp | 97 ++++++++++--- Cantera/src/transport/LTPspecies.h | 161 ++++++++++----------- Cantera/src/transport/TransportFactory.cpp | 2 +- 3 files changed, 160 insertions(+), 100 deletions(-) diff --git a/Cantera/src/transport/LTPspecies.cpp b/Cantera/src/transport/LTPspecies.cpp index ba9bb020e..2b61d35a7 100644 --- a/Cantera/src/transport/LTPspecies.cpp +++ b/Cantera/src/transport/LTPspecies.cpp @@ -15,7 +15,7 @@ using namespace std; namespace Cantera { //==================================================================================================================== - /** + /* * Exception thrown if an error is encountered while reading the transport database. */ class LTPError : public CanteraError { @@ -48,6 +48,34 @@ namespace Cantera { E /= GasConstant; } //==================================================================================================================== + // Construct an LTPspecies object for a liquid tranport property. + /* + * The species transport property is constructed from the XML node, + * \verbatim , \endverbatim that is a child of the + * \verbatim \endverbatim node in the species block and specifies a type of transport + * property (like viscosity) + * + * @param propNode Pointer to the XML node that contains the property information + * @param name String containing the species name + * @param tp_ind enum TransportPropertyType containing the property id that this object + * is creating a parameterization for (e.g., viscosity) + * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. + */ + LTPspecies::LTPspecies(const XML_Node * const propNode, std::string name, + TransportPropertyType tp_ind, const thermo_t* const thermo) : + m_speciesName(name), + m_model(LTR_MODEL_NOTSET), + m_property(tp_ind), + m_thermo(thermo), + m_mixWeight(1.0) + { + if (propNode) { + if (propNode->hasChild("mixtureWeighting") ) { + m_mixWeight = getFloat(*propNode, "mixtureWeighting"); + } + } + } + //==================================================================================================================== // Copy constructor LTPspecies::LTPspecies(const LTPspecies &right) { @@ -78,6 +106,43 @@ namespace Cantera { return prp; } //==================================================================================================================== + LTPspecies::~LTPspecies() + { + } + //==================================================================================================================== + // Returns the vector of pure species tranport property + /* + * The pure species transport property (i.e. pure species viscosity) + * is returned. Any temperature and composition dependence will be + * adjusted internally according to the information provided by the + * subclass object. + */ + doublereal LTPspecies::getSpeciesTransProp() + { + return 0.0; + } + //==================================================================================================================== + // Check to see if the property evaluation will be positive + bool LTPspecies::checkPositive() const + { + return (m_coeffs[0] > 0); + } + //==================================================================================================================== + doublereal LTPspecies::getMixWeight() const + { + return m_mixWeight; + } + //==================================================================================================================== + // Internal model to adjust species-specific properties for composition. + /* + * Currently just a place holder, but this method could take + * the composition from the thermo object and adjust coefficients + * accoding to some unspecified model. + */ + void LTPspecies::adjustCoeffsForComposition() + { + } + //==================================================================================================================== // Construct an LTPspecies object for a liquid tranport property // expressed as a constant value. /* The transport property is constructed from the XML node, @@ -85,17 +150,17 @@ namespace Cantera { * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ - LTPspecies_Const::LTPspecies_Const(const XML_Node &propNode, - std::string name, - TransportPropertyType tp_ind, - thermo_t* thermo) : - LTPspecies(propNode, name, tp_ind, thermo) + LTPspecies_Const::LTPspecies_Const(const XML_Node &propNode, std::string name, + TransportPropertyType tp_ind, const thermo_t * const thermo) : + LTPspecies(&propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_CONSTANT; double A_k = getFloatCurrent(propNode, "toSI"); if (A_k > 0.0) { m_coeffs.push_back(A_k); - } else throw LTPError("negative or zero " + propNode.name()); + } else { + throw LTPError("negative or zero " + propNode.name()); + } } //==================================================================================================================== // Copy constructor @@ -109,17 +174,15 @@ namespace Cantera { LTPspecies_Const& LTPspecies_Const::operator=(const LTPspecies_Const& right) { if (&right != this) { - //LTPspecies::operator=(right); - m_speciesName = right.m_speciesName; - m_property = right.m_property; - m_model = right.m_model; - m_coeffs = right.m_coeffs; - m_thermo = right.m_thermo; - m_mixWeight = right.m_mixWeight; + LTPspecies::operator=(right); } return *this; } //==================================================================================================================== + LTPspecies_Const::~LTPspecies_Const() + { + } + //==================================================================================================================== // Duplication routine /* * @return Returns a copy of this routine as a pointer to LTPspecies @@ -144,7 +207,7 @@ namespace Cantera { */ LTPspecies_Arrhenius::LTPspecies_Arrhenius(const XML_Node &propNode, std::string name, TransportPropertyType tp_ind, thermo_t* thermo) : - LTPspecies(propNode, name, tp_ind, thermo) + LTPspecies(&propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_ARRHENIUS; m_temp = 0.0; @@ -250,7 +313,7 @@ namespace Cantera { */ LTPspecies_Poly::LTPspecies_Poly(const XML_Node &propNode, std::string name, TransportPropertyType tp_ind, thermo_t* thermo) : - LTPspecies(propNode, name, tp_ind, thermo) + LTPspecies(&propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_POLY; m_temp = 0.0; @@ -327,7 +390,7 @@ namespace Cantera { */ LTPspecies_ExpT::LTPspecies_ExpT(const XML_Node &propNode, std::string name, TransportPropertyType tp_ind, thermo_t* thermo) : - LTPspecies(propNode, name, tp_ind, thermo) + LTPspecies(&propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_EXPT; m_temp = 0.0; diff --git a/Cantera/src/transport/LTPspecies.h b/Cantera/src/transport/LTPspecies.h index bca630a48..9c128f165 100644 --- a/Cantera/src/transport/LTPspecies.h +++ b/Cantera/src/transport/LTPspecies.h @@ -12,7 +12,6 @@ #ifndef CT_LTPSPECIES_H #define CT_LTPSPECIES_H - // Cantera includes #include "ct_defs.h" #include "TransportBase.h" @@ -25,7 +24,7 @@ namespace Cantera { - + //==================================================================================================================== //! Enumeration of the types of transport properties that can be //! handled by the variables in the various Transport classes. /*! @@ -53,8 +52,9 @@ namespace Cantera { TP_DIFFUSIVITY, TP_HYDRORADIUS, TP_ELECTCOND - }; + }; + //==================================================================================================================== //! Temperature dependence type for pure (liquid) species properties /*! * Types of temperature dependencies: @@ -88,35 +88,38 @@ namespace Cantera { //! Construct an LTPspecies object for a liquid tranport property. /*! - * The transport property is constructed from the XML node, - * \verbatim , \endverbatim that is a child of the - * \verbatim \endverbatim node and specifies a type of - * transport property (like viscosity) + * The species transport property is constructed from the XML node, + * \verbatim , \endverbatim that is a child of the + * \verbatim \endverbatim node in the species block and specifies a type of transport + * property (like viscosity) + * + * @param propNode Pointer to the XML node that contains the property information. A default + * value of 0 is allowed for the base class, but not for classes which + * are assumed to be parameterized by reading XML_Node information. + * @param name String containing the species name + * @param tp_ind enum TransportPropertyType containing the property id that this object + * is creating a parameterization for (e.g., viscosity) + * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. */ - LTPspecies(const XML_Node &propNode = 0, - std::string name = "-", - TransportPropertyType tp_ind = TP_UNKNOWN, - const thermo_t* const thermo = 0) : - m_speciesName(name), - m_model(LTR_MODEL_NOTSET), - m_property(tp_ind), - m_thermo(thermo), - m_mixWeight(1.0) - { - if (propNode.hasChild("mixtureWeighting") ) { - m_mixWeight = getFloat(propNode, "mixtureWeighting"); - } - } + LTPspecies(const XML_Node * const propNode = 0, std::string name = "-", + TransportPropertyType tp_ind = TP_UNKNOWN, const thermo_t* const thermo = 0); //! Copy constructor + /*! + * @param right Object to be copied + */ LTPspecies(const LTPspecies &right); //! Assignment operator - LTPspecies& operator=(const LTPspecies& right); + /*! + * @param right Object to be copied + */ + LTPspecies& operator=(const LTPspecies& right); - virtual ~LTPspecies( ) { } + //! Destructor + virtual ~LTPspecies(); - //! duplication routine + //! Duplication routine /*! * @return Returns a copy of this routine as a pointer to LTPspecies */ @@ -127,17 +130,36 @@ namespace Cantera { * The pure species transport property (i.e. pure species viscosity) * is returned. Any temperature and composition dependence will be * adjusted internally according to the information provided by the - * subclass object. + * subclass object. + * + * @return Returns a single double containing the property evaluation + * at the current ThermoPhase temperature. */ - virtual doublereal getSpeciesTransProp( ) { return 0.0; } + virtual doublereal getSpeciesTransProp(); - virtual bool checkPositive( ) { return ( m_coeffs[0] > 0 ); } + //! Check to see if the property evaluation will be positive + /*! + * @return returns a boolean + */ + virtual bool checkPositive() const; - doublereal getMixWeight( ) { - return m_mixWeight; - } + //! return the weight mixture + /*! + * @return returns a single double which is used as a weight + */ + doublereal getMixWeight() const; + + private: + //! Internal model to adjust species-specific properties for composition. + /*! + * Currently just a place holder, but this method could take + * the composition from the thermo object and adjust coefficients + * accoding to some unspecified model. + */ + virtual void adjustCoeffsForComposition(); protected: + //! Species Name std::string m_speciesName; @@ -166,17 +188,8 @@ namespace Cantera { * 1.0--note that 0.0 is not innocuous if there are logarithms involved. */ doublereal m_mixWeight; - - //! Internal model to adjust species-specific properties for composition. - /*! - * Currently just a place holder, but this method could take - * the composition from the thermo object and adjust coefficients - * accoding to some unspecified model. - */ - virtual void adjustCoeffsForComposition() { } }; - //==================================================================================================================== //! Class LTPspecies_Const holds transport parameters for a //! specific liquid-phase species (LTPspecies) when the @@ -206,20 +219,32 @@ namespace Cantera { /** The transport property is constructed from the XML node, * \verbatim , \endverbatim that is a child of the * \verbatim \endverbatim node and specifies a type of - * transport property (like viscosity) + * transport property (like viscosity). + * + * + * @param propNode Reference to the XML node that contains the property information. + * @param name String containing the species name + * @param tp_ind enum TransportPropertyType containing the property id that this object + * is creating a parameterization for (e.g., viscosity) + * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. */ - LTPspecies_Const(const XML_Node &propNode, - std::string name, - TransportPropertyType tp_ind, - thermo_t* thermo); + LTPspecies_Const(const XML_Node &propNode, std::string name, + TransportPropertyType tp_ind, const thermo_t * const thermo); //! Copy constructor + /*! + * @param right Object to be copied + */ LTPspecies_Const(const LTPspecies_Const &right); //! Assignment operator - LTPspecies_Const& operator=(const LTPspecies_Const& right ); + /*! + * @param right Object to be copied + */ + LTPspecies_Const& operator=(const LTPspecies_Const& right); - virtual ~LTPspecies_Const( ) { } + //! Destructor + virtual ~LTPspecies_Const(); //! duplication routine /*! @@ -233,16 +258,8 @@ namespace Cantera { * is returned. Any temperature and composition dependence will be * adjusted internally according to the information provided. */ - doublereal getSpeciesTransProp( ); + doublereal getSpeciesTransProp(); - protected: - - //! Internal model to adjust species-specific properties for composition. - /** Currently just a place holder, but this method could take - * the composition from the thermo object and adjust coefficients - * accoding to some unspecified model. - */ - void adjustCoeffsForComposition( ) { } }; //==================================================================================================================== @@ -295,7 +312,7 @@ namespace Cantera { LTPspecies_Arrhenius( const LTPspecies_Arrhenius &right ); //! Assignment operator - LTPspecies_Arrhenius& operator=(const LTPspecies_Arrhenius& right ); + LTPspecies_Arrhenius& operator=(const LTPspecies_Arrhenius& right); virtual ~LTPspecies_Arrhenius( ) { } @@ -326,7 +343,7 @@ namespace Cantera { * Any temperature and composition dependence will be * adjusted internally according to the information provided. */ - doublereal getSpeciesTransProp( ); + doublereal getSpeciesTransProp(); protected: @@ -341,14 +358,6 @@ namespace Cantera { //! logarithm of most recent evaluation of transport property doublereal m_logProp; - - //! Internal model to adjust species-specific properties for composition. - /*! - * Currently just a place holder, but this method could take - * the composition from the thermo object and adjust coefficients - * accoding to some unspecified model. - */ - void adjustCoeffsForComposition( ) { } }; //==================================================================================================================== @@ -399,7 +408,8 @@ namespace Cantera { //! Assignment operator LTPspecies_Poly& operator=(const LTPspecies_Poly& right ); - virtual ~LTPspecies_Poly( ) { } + //! Destructor + virtual ~LTPspecies_Poly() { } //! Duplication routine /*! @@ -413,7 +423,7 @@ namespace Cantera { * is returned. Any temperature and composition dependence will be * adjusted internally according to the information provided. */ - doublereal getSpeciesTransProp( ); + doublereal getSpeciesTransProp(); protected: @@ -423,13 +433,6 @@ namespace Cantera { //! most recent evaluation of transport property doublereal m_prop; - //! Internal model to adjust species-specific properties for composition. - /*! - * Currently just a place holder, but this method could take - * the composition from the thermo object and adjust coefficients - * accoding to some unspecified model. - */ - void adjustCoeffsForComposition( ){ } }; //==================================================================================================================== @@ -485,7 +488,7 @@ namespace Cantera { //! Assignment operator LTPspecies_ExpT& operator=(const LTPspecies_ExpT& right ); - virtual ~LTPspecies_ExpT( ) { } + virtual ~LTPspecies_ExpT() { } //! duplication routine /*! @@ -499,7 +502,7 @@ namespace Cantera { * is returned. Any temperature and composition dependence will be * adjusted internally according to the information provided. */ - doublereal getSpeciesTransProp( ); + doublereal getSpeciesTransProp(); protected: @@ -509,12 +512,6 @@ namespace Cantera { //! most recent evaluation of transport property doublereal m_prop; - //! Internal model to adjust species-specific properties for composition. - /** Currently just a place holder, but this method could take - * the composition from the thermo object and adjust coefficients - * accoding to some unspecified model. - */ - void adjustCoeffsForComposition( ){ } }; //==================================================================================================================== diff --git a/Cantera/src/transport/TransportFactory.cpp b/Cantera/src/transport/TransportFactory.cpp index b87cdad0c..79b07a415 100644 --- a/Cantera/src/transport/TransportFactory.cpp +++ b/Cantera/src/transport/TransportFactory.cpp @@ -323,7 +323,7 @@ namespace Cantera { break; default: throw CanteraError("newLTP","unknown transport model: " + model); - ltps = new LTPspecies(trNode, name, tp_ind, thermo); + ltps = new LTPspecies(&trNode, name, tp_ind, thermo); } return ltps; }