SpeciesThermoMgr.h

Go to the documentation of this file.
00001 /**
00002  *  @file SpeciesThermoMgr.h
00003  *  This file contains descriptions of templated subclasses of 
00004  *  the virtual base class, SpeciesThermo, which include  SpeciesThermoDuo and SpeciesThermo1
00005  *  (see \ref mgrsrefcalc and classes 
00006  *   \link Cantera::SpeciesThermoDuo SpeciesThermoDuo\endlink and
00007  *  \link Cantera::SpeciesThermo1 SpeciesThermo1\endlink)
00008  *
00009  * $Revision: 385 $
00010  * $Date: 2010-01-17 12:05:46 -0500 (Sun, 17 Jan 2010) $
00011  */
00012 
00013 // Copyright 2001  California Institute of Technology
00014 
00015 #ifndef CT_SPECIESTHERMO_MGR_H
00016 #define CT_SPECIESTHERMO_MGR_H
00017 
00018 #include "ct_defs.h"
00019 #include "ctexceptions.h"
00020 #include "stringUtils.h"
00021 #include "SpeciesThermo.h"
00022 #include <map>
00023 
00024 namespace Cantera {
00025 
00026   //! Invokes the 'updateProperties' method of all objects in the list.
00027   /*!
00028    *  This templated function has one template, InputIter. It should 
00029    *  point to a class such as one that inherits from the virtual
00030    *  base class, SpeciesThermoInterpType, which has 
00031    *  an updateProperties(T, Cp_R, h_RT, s)R) function
00032    *
00033    * @param begin Beginning iterator
00034    * @param end   end iterator
00035    * @param T       Temperature (Kelvin)
00036    * @param cp_R    Vector of Dimensionless heat capacities.
00037    *                (length m_kk).
00038    * @param h_RT    Vector of Dimensionless enthalpies.
00039    *                (length m_kk).
00040    * @param s_R     Vector of Dimensionless entropies.
00041    *                (length m_kk).
00042    *
00043    * @ingroup mgrsrefcalc
00044    */
00045   template<class InputIter>
00046   inline void _updateAll(InputIter begin, 
00047                          InputIter end,
00048                          doublereal T,  
00049                          vector_fp&  cp_R, 
00050                          vector_fp&  h_RT, 
00051                          vector_fp&  s_R)
00052   {
00053     for (; begin != end; ++begin) {
00054       begin->updateProperties(T, cp_R, h_RT, s_R);
00055     }
00056   }
00057 
00058   //! Iterates through a list of objects which implement a method
00059   //! 'minTemp()', and returns the largest 'minTemp' value.
00060   /*!
00061    *  This templated function has one template, InputIter. It should 
00062    *  point to a class such as one that inherits from either
00063    *  SpeciesThermoInterpType or SpeciesThermo, which have a minTemp() function
00064    *
00065    * @param begin Beginning iterator
00066    * @param end   end iterator
00067    *
00068    * @ingroup mgrsrefcalc
00069    */
00070   template<class InputIter>
00071   doublereal _minTemp(InputIter begin, InputIter end) {
00072     doublereal _minT = 0.0;
00073     for (; begin != end; ++begin)
00074       _minT = fmaxx(_minT, begin->minTemp());
00075     return _minT;
00076   }
00077 
00078   //! Iterates through a list of objects which implement a method
00079   //! 'maxTemp()', and returns the smallest 'maxTemp' value.
00080   /*!
00081    *  This templated function has one template, InputIter. It should 
00082    *  point to a class such as one that inherits from either
00083    *  SpeciesThermoInterpType or SpeciesThermo which have a minTemp() function
00084    *
00085    * @param begin Beginning iterator
00086    * @param end   end iterator
00087    *
00088    * @ingroup mgrsrefcalc
00089    */
00090   template<class _InputIter>
00091   doublereal _maxTemp(_InputIter begin, _InputIter end) {
00092     doublereal _maxT = 1.e10;
00093     for (; begin != end; ++begin)
00094       _maxT = fminn(_maxT, begin->maxTemp());
00095     return _maxT;
00096   }
00097 
00098   ///////////////////////  Exceptions //////////////////////////////
00099 
00100   //! Exception thrown if species reference pressures don't match.
00101   /*!
00102    * @ingroup mgrsrefcalc
00103    */
00104   class RefPressureMismatch : public CanteraError {
00105   public:
00106     //! constructor
00107     /*!
00108      * @param proc   name of the procecdure
00109      * @param prnew   reference pressure
00110      * @param prold   old reference pressure
00111      */
00112     RefPressureMismatch(std::string proc, doublereal prnew, 
00113                         doublereal prold) : CanteraError(proc, 
00114                                                          "Species reference pressure ("
00115                                                          + fp2str(prnew) + ") does not match previously-defined "
00116                                                          + "reference pressure (" + fp2str(prold) + ")") {}
00117     //! destructor
00118     virtual ~RefPressureMismatch() throw() {}
00119   };
00120 
00121   //! Unknown species thermo manager string error
00122   /*!
00123    * @ingroup mgrsrefcalc
00124    */
00125   class UnknownSpeciesThermo : public CanteraError {
00126   public:
00127 
00128     //! constructor
00129     /*!
00130      * @param proc   name of the procecdure
00131      * @param type   unknown type
00132      */
00133     UnknownSpeciesThermo(std::string proc, int type) :
00134       CanteraError(proc, "Specified species parameterization type (" + int2str(type) 
00135                    + ") does not match any known type.") {}
00136 
00137     //! Alternate constructor
00138     /*!
00139      * @param proc   name of the procecdure
00140      * @param stype   String name for the unknown type
00141      */
00142     UnknownSpeciesThermo(std::string proc, std::string stype) :
00143       CanteraError(proc, "Specified species parameterization type (" + stype 
00144                    + ") does not match any known type.") {}
00145     //! destructor
00146     virtual ~UnknownSpeciesThermo() throw() {}
00147   };
00148 
00149 
00150   /**
00151    *  This species thermo manager requires that all species have one
00152    *  of two parameterizations.
00153    *
00154    * Note this seems to be a slow way to do things, and it may be on its way out.
00155    *
00156    * @ingroup mgrsrefcalc
00157    */
00158   template<class T1, class T2>
00159   class SpeciesThermoDuo : public SpeciesThermo {
00160         
00161   public:
00162     //! Constructor
00163     SpeciesThermoDuo();
00164 
00165     //! Destructor
00166     virtual ~SpeciesThermoDuo();
00167 
00168     //! copy constructor
00169     /*!
00170      * @param right Object to be copied
00171      */
00172     SpeciesThermoDuo(const SpeciesThermoDuo &right);
00173 
00174     //! Assignment operator
00175     /*!
00176      * @param right Object to be copied
00177      */
00178     SpeciesThermoDuo& operator=(const SpeciesThermoDuo &right);
00179 
00180     //! Duplication routine for objects which inherit from 
00181     //! %SpeciesThermo
00182     /*!
00183      *  This virtual routine can be used to duplicate %SpeciesThermo  objects
00184      *  inherited from %SpeciesThermo even if the application only has
00185      *  a pointer to %SpeciesThermo to work with.
00186      *  ->commented out because we first need to add copy constructors
00187      *   and assignment operators to all of the derived classes.
00188      */
00189     virtual SpeciesThermo *duplMyselfAsSpeciesThermo() const;
00190 
00191     /**
00192      * install a new species thermodynamic property
00193      * parameterization for one species.  
00194      *
00195      * @param name      Name of the species
00196      * @param sp        The 'update' method will update the property 
00197      *                  values for this species 
00198      *                  at position i index in the property arrays.  
00199      * @param type      int flag specifying the type of parameterization to be
00200      *                 installed. 
00201      * @param c        vector of coefficients for the parameterization. 
00202      *                 This vector is simply passed through to the
00203      *                 parameterization constructor.
00204      * @param minTemp  minimum temperature for which this parameterization
00205      *                 is valid.
00206      * @param maxTemp  maximum temperature for which this parameterization
00207      *                 is valid.
00208      * @param refPressure standard-state pressure for this 
00209      *                    parameterization. 
00210      * @see speciesThermoTypes.h 
00211      */
00212     virtual void install(std::string name, int sp, int type,
00213                          const doublereal* c,
00214                          doublereal minTemp, doublereal maxTemp, 
00215                          doublereal refPressure);
00216 
00217     //! Install a new species thermodynamic property
00218     //! parameterization for one species.
00219     /*!
00220      * @param stit_ptr Pointer to the SpeciesThermoInterpType object
00221      *          This will set up the thermo for one species
00222      */
00223     virtual void install_STIT(SpeciesThermoInterpType *stit_ptr);
00224 
00225     //! Compute the reference-state properties for all species.
00226     /*!
00227      * Given temperature T in K, this method updates the values of
00228      * the non-dimensional heat capacity at constant pressure,
00229      * enthalpy, and entropy, at the reference pressure, Pref
00230      * of each of the standard states.
00231      *
00232      * @param t       Temperature (Kelvin)
00233      * @param cp_R    Vector of Dimensionless heat capacities.
00234      *                (length m_kk).
00235      * @param h_RT    Vector of Dimensionless enthalpies.
00236      *                (length m_kk).
00237      * @param s_R     Vector of Dimensionless entropies.
00238      *                (length m_kk).
00239      */
00240     virtual void update(doublereal t, doublereal* cp_R,
00241                         doublereal* h_RT, doublereal* s_R) const;
00242 
00243     //! Minimum temperature.
00244     /*!
00245      * If no argument is supplied, this
00246      * method returns the minimum temperature for which \e all
00247      * parameterizations are valid. If an integer index k is
00248      * supplied, then the value returned is the minimum
00249      * temperature for species k in the phase.
00250      *
00251      * @param k    Species index
00252      */ 
00253     virtual doublereal minTemp(int k = -1) const;
00254 
00255     //! Maximum temperature.
00256     /*!
00257      * If no argument is supplied, this
00258      * method returns the maximum temperature for which \e all
00259      * parameterizations are valid. If an integer index k is
00260      * supplied, then the value returned is the maximum
00261      * temperature for parameterization k.
00262      *
00263      * @param k index for parameterization k
00264      */
00265     virtual doublereal maxTemp(int k = -1) const;
00266          
00267     /**
00268      * The reference-state pressure for species k.
00269      *
00270      * returns the reference state pressure in Pascals for
00271      * species k. If k is left out of the argument list,
00272      * it returns the reference state pressure for the first
00273      * species.
00274      * Note that some SpeciesThermo implementations, such
00275      * as those for ideal gases, require that all species
00276      * in the same phase have the same reference state pressures.
00277      *
00278      * @param k index for parameterization k
00279      */
00280     virtual doublereal refPressure(int k = -1) const;
00281 
00282     //! This utility function reports the type of parameterization
00283     //! used for the species with index number index.
00284     /*!
00285      *
00286      * @param k  Species index
00287      */
00288     virtual int reportType(int k) const;
00289 
00290     /*!
00291      * This utility function reports back the type of 
00292      * parameterization and all of the parameters for the 
00293      * species, index.
00294      *
00295      * @param index     Species index
00296      * @param type      Integer type of the standard type
00297      * @param c         Vector of coefficients used to set the
00298      *                  parameters for the standard state.
00299      * @param minTemp   output - Minimum temperature
00300      * @param maxTemp   output - Maximum temperature
00301      * @param refPressure output - reference pressure (Pa).
00302      *
00303      */
00304     virtual void reportParams(int index, int &type, 
00305                               doublereal * const c, 
00306                               doublereal &minTemp, 
00307                               doublereal &maxTemp, 
00308                               doublereal &refPressure) const;
00309 
00310     //! Modify parameters for the standard state
00311     /*!
00312      * @param index Species index
00313      * @param c     Vector of coefficients used to set the
00314      *              parameters for the standard state.
00315      */
00316     virtual void modifyParams(int index, doublereal *c);
00317 
00318 
00319 #ifdef H298MODIFY_CAPABILITY
00320   
00321     virtual doublereal reportOneHf298(int k) const {
00322       throw CanteraError("reportHF298", "unimplemented");
00323     }
00324 
00325     virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
00326       throw CanteraError("reportHF298", "unimplemented");
00327     }
00328   
00329 #endif
00330 
00331   private:
00332 
00333     //! Thermo Type 1
00334     T1 m_thermo1;
00335     //! Thermo Type 2
00336     T2 m_thermo2;
00337     //! Reference pressure
00338     doublereal m_p0;
00339     //! map from species to type
00340     std::map<int, int> speciesToType;
00341   };
00342   
00343   //!  This species thermo manager requires that all species have the
00344   //!  same parameterization.
00345   /*!
00346    *
00347    *  This is a templated class. The first template is called SPM. SPM
00348    *  is an object that calculates the thermo for one species. This
00349    *  class contains a vector of SPM's, one for each
00350    *  species. Together, the vector of SPM's is itself a SpeciesThermo
00351    *  class.
00352    *
00353    * @todo The form of the template class, SPM, is basically
00354    *       unspecified. it needs to be nailed down to a specific
00355    *       form. One way to do this is with a virtual base class
00356    *       formulation. Note, that the specification could be that it
00357    *       inherits from the class SpeciesThermo, itself.
00358    *
00359    * @deprecated Note this is currently unused and it may be on its way out.
00360    *
00361    * @ingroup mgrsrefcalc
00362    */
00363   template<class SPM>
00364   class SpeciesThermo1 : public SpeciesThermo {
00365         
00366   public:
00367     //! base constructor
00368     SpeciesThermo1();
00369     //! destructor
00370     virtual ~SpeciesThermo1();
00371 
00372     //! Copy Constructor
00373     /*!
00374      * @param right Object to be copied
00375      */
00376     SpeciesThermo1(const SpeciesThermo1 &right);
00377 
00378     //! Asignment Operator
00379     /*!
00380      * @param right Object to be copied
00381      */
00382     SpeciesThermo1 & operator=(const SpeciesThermo1 &right);
00383 
00384     //! Duplication routine for objects which inherit from 
00385     //! %SpeciesThermo
00386     /*!
00387      *  This virtual routine can be used to duplicate %SpeciesThermo  objects
00388      *  inherited from %SpeciesThermo even if the application only has
00389      *  a pointer to %SpeciesThermo to work with.
00390      *  ->commented out because we first need to add copy constructors
00391      *   and assignment operators to all of the derived classes.
00392      */
00393     virtual SpeciesThermo *duplMyselfAsSpeciesThermo() const;
00394     
00395     //! Install one species into this Species Thermo Manager
00396     /*!
00397      * @param name       Name of the species
00398      * @param sp         Species index
00399      * @param type       species type in terms of an int
00400      * @param c          Parameters for the species thermo
00401      */
00402     virtual void install(std::string name, int sp, int type,
00403                          const vector_fp& c);
00404 
00405     //! update the object, because the temperature changed
00406     /*!
00407      * @param t          temperature(Kelvin)
00408      * @param cp_R       vector of dimensionless heat capacity
00409      * @param h_RT       vector of dimensionless enthalpy
00410      * @param s_R        vector of dimensionless entropy
00411      */
00412     virtual void update(doublereal t, vector_fp& cp_R, 
00413                         vector_fp& h_RT, vector_fp& s_R) const;
00414 
00415     //! update the object for one species, because the temperature changed
00416     /*!
00417      * @param k          species index
00418      * @param t          temperature(Kelvin)
00419      * @param cp_R       vector of dimensionless heat capacity
00420      * @param h_RT       vector of dimensionless enthalpy
00421      * @param s_R        vector of dimensionless entropy
00422      */
00423     virtual void update_one(int k, doublereal t, vector_fp& cp_R, 
00424                             vector_fp& h_RT, vector_fp& s_R) const;
00425 
00426     //! Returns the minimum temperature
00427     /*!
00428      * @param k species index. Defaults to -1.
00429      */
00430     virtual doublereal minTemp(int k = -1) const;
00431 
00432     //! Returns the maximum temperature
00433     /*!
00434      * @param k species index. Defaults to -1.
00435      */
00436     virtual doublereal maxTemp(int k = -1) const;
00437                     
00438     //! returns the reference pressure
00439     /*!
00440      * @param k species index. Defaults to -1.
00441      */
00442     virtual doublereal refPressure(int k = -1) const;
00443 
00444     //! This utility function reports the type of parameterization
00445     //! used for the species with index number index.
00446     /*!
00447      *  Note, all parameterizations are the same, by definition, here
00448      *
00449      * @param k  Species index
00450      */
00451     virtual int reportType(int k) const;
00452 
00453     /*!
00454      * This utility function reports back the type of 
00455      * parameterization and all of the parameters for the 
00456      * species, index.
00457      *
00458      * @param index     Species index
00459      * @param type      Integer type of the standard type
00460      * @param c         Vector of coefficients used to set the
00461      *                  parameters for the standard state.
00462      * @param minTemp   output - Minimum temperature
00463      * @param maxTemp   output - Maximum temperature
00464      * @param refPressure output - reference pressure (Pa).
00465      */
00466     virtual void reportParams(int index, int &type, 
00467                               doublereal * const c, 
00468                               doublereal &minTemp, 
00469                               doublereal &maxTemp, 
00470                               doublereal &refPressure) const;
00471 
00472     //! Modify parameters for the standard state
00473     /*!
00474      * @param index Species index
00475      * @param c     Vector of coefficients used to set the
00476      *              parameters for the standard state.
00477      */
00478     virtual void modifyParams(int index, doublereal *c);
00479 
00480 #ifdef H298MODIFY_CAPABILITY
00481     //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
00482     /*!
00483      *   The 298K Heat of Formation is defined as the enthalpy change to create the standard state
00484      *   of the species from its constituent elements in their standard states at 298 K and 1 bar.
00485      *
00486      *   @param k    species index
00487      *   @return     Returns the current value of the Heat of Formation at 298K and 1 bar
00488      */
00489     virtual doublereal reportOneHf298(int k) const {
00490       throw CanteraError("reportHF298", "unimplemented");
00491     }
00492 
00493     //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
00494     /*!
00495      *   The 298K heat of formation is defined as the enthalpy change to create the standard state
00496      *   of the species from its constituent elements in their standard states at 298 K and 1 bar.
00497      *
00498      *   @param  k           Species k
00499      *   @param  Hf298New    Specify the new value of the Heat of Formation at 298K and 1 bar                      
00500      */
00501     virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
00502       throw CanteraError("reportHF298", "unimplemented");
00503     }
00504 #endif
00505 
00506   private:
00507     //! Vector of SPM objects. There are m_kk of them
00508     std::vector<SPM> m_thermo;
00509 
00510     //! Reference pressure (Pa)
00511     doublereal m_pref;
00512   };
00513  
00514   // ------------------------- cpp part of file -------------------------------------
00515 
00516   // Definitions for the SpeciesThermoDuo<T1,T2> templated class
00517 
00518   template<class T1, class T2>
00519   SpeciesThermoDuo<T1, T2>::SpeciesThermoDuo() 
00520   {
00521   }
00522  
00523   template<class T1, class T2>
00524   SpeciesThermoDuo<T1, T2>::~SpeciesThermoDuo()
00525   {
00526   }
00527 
00528   template<class T1, class T2>
00529   SpeciesThermoDuo<T1, T2>::SpeciesThermoDuo(const SpeciesThermoDuo &right) {
00530     *this = operator=(right);
00531   }
00532 
00533   template<class T1, class T2>
00534   SpeciesThermoDuo<T1, T2> & 
00535   SpeciesThermoDuo<T1, T2>::operator=(const SpeciesThermoDuo &right) {
00536     if (&right == this) return *this;
00537     
00538     m_thermo1 = right.m_thermo1;
00539     m_thermo2 = right.m_thermo2;
00540     m_p0      = right.m_p0;
00541     speciesToType = right.speciesToType;
00542     
00543     return *this;
00544   }
00545 
00546   template<class T1, class T2>
00547   SpeciesThermo *
00548   SpeciesThermoDuo<T1, T2>::duplMyselfAsSpeciesThermo() const {
00549     SpeciesThermoDuo<T1,T2> *nt = new SpeciesThermoDuo<T1,T2>(*this);
00550     return (SpeciesThermo *) nt;
00551   }
00552 
00553   template<class T1, class T2>
00554   void 
00555   SpeciesThermoDuo<T1, T2>::install(std::string name, int sp, int type,
00556                                     const doublereal* c,
00557                                     doublereal minTemp,
00558                                     doublereal maxTemp, 
00559                                     doublereal refPressure) {
00560     m_p0 = refPressure;
00561     if (type == m_thermo1.ID) {
00562       m_thermo1.install(name, sp, 0, c, minTemp, maxTemp,
00563                         refPressure);
00564       speciesToType[sp] = m_thermo1.ID;
00565     } else if (type == m_thermo2.ID) {
00566       m_thermo2.install(name, sp, 0, c, minTemp, maxTemp,
00567                         refPressure);
00568       speciesToType[sp] = m_thermo2.ID;
00569     } else {
00570       throw UnknownSpeciesThermo("SpeciesThermoDuo:install",type);
00571     }
00572   }
00573 
00574   template<class T1, class T2>
00575   void 
00576   SpeciesThermoDuo<T1, T2>::install_STIT(SpeciesThermoInterpType *stit_ptr) {
00577     throw CanteraError("install_STIT", "not implemented");
00578   }
00579 
00580   template<class T1, class T2>
00581   void 
00582   SpeciesThermoDuo<T1, T2>::update(doublereal t, doublereal* cp_R,
00583                                    doublereal* h_RT, doublereal* s_R) const {
00584     m_thermo1.update(t, cp_R, h_RT, s_R);
00585     m_thermo2.update(t, cp_R, h_RT, s_R);
00586   }
00587 
00588   template<class T1, class T2>
00589   doublereal 
00590   SpeciesThermoDuo<T1, T2>::minTemp(int k) const {
00591     doublereal tm1 = m_thermo1.minTemp();
00592     doublereal tm2 = m_thermo2.minTemp();
00593     return (tm1 < tm2 ? tm2 : tm1);
00594   }
00595   
00596   template<class T1, class T2>
00597   doublereal
00598   SpeciesThermoDuo<T1, T2>::maxTemp(int k) const {
00599     doublereal tm1 = m_thermo1.maxTemp();
00600     doublereal tm2 = m_thermo2.maxTemp();
00601     return (tm1 < tm2 ? tm1 : tm2);
00602   }
00603   
00604   template<class T1, class T2>
00605   doublereal
00606   SpeciesThermoDuo<T1, T2>::refPressure(int k) const {
00607     return m_p0;
00608   }
00609   
00610   template<class T1, class T2>
00611   int 
00612   SpeciesThermoDuo<T1, T2>::reportType(int k) const {
00613     std::map<int, int>::const_iterator p = speciesToType.find(k);
00614     if (p != speciesToType.end()) {
00615       const int type = p->second;
00616       return type;
00617     } 
00618     return -1;
00619   }
00620  
00621   template<class T1, class T2>
00622   void 
00623   SpeciesThermoDuo<T1, T2>::reportParams(int index, int &type, 
00624                                          doublereal * const c, 
00625                                          doublereal &minTemp, 
00626                                          doublereal &maxTemp, 
00627                                          doublereal &refPressure) const {
00628     int ctype = reportType(index);
00629     if (ctype == m_thermo1.ID) {
00630       m_thermo1.reportParams(index, type, c, minTemp, maxTemp, 
00631                              refPressure);
00632     } else if (ctype == m_thermo2.ID) {
00633       m_thermo2.reportParams(index, type, c, minTemp, maxTemp, 
00634                              refPressure);
00635     } else {
00636       throw CanteraError("  ", "confused");
00637     }
00638   }
00639 
00640   template<class T1, class T2>
00641   void 
00642   SpeciesThermoDuo<T1, T2>::modifyParams(int index, doublereal *c) {
00643     int ctype = reportType(index);
00644     if (ctype == m_thermo1.ID) {
00645       m_thermo1.modifyParams(index, c);
00646     } else if (ctype == m_thermo2.ID) {
00647       m_thermo2.modifyParams(index,  c);
00648     } else {
00649       throw CanteraError("modifyParams", "confused");
00650     }
00651   }
00652 
00653   // Definitions for the SpeciesTherm1 templated class
00654 
00655   template<class SPM>
00656   SpeciesThermo1<SPM>::SpeciesThermo1() : 
00657     m_pref(0.0) 
00658   {
00659   }
00660 
00661   template<class SPM>
00662   SpeciesThermo1<SPM>::~SpeciesThermo1()
00663   {
00664   }
00665 
00666   template<class SPM>
00667   SpeciesThermo1<SPM>::SpeciesThermo1(const SpeciesThermo1 &right) :
00668     m_pref(0.0)
00669   {
00670     *this = operator=(right);
00671   }
00672 
00673   template<class SPM>
00674   SpeciesThermo1<SPM> & 
00675   SpeciesThermo1<SPM>::operator=(const SpeciesThermo1 &right)
00676   {
00677     if (&right == this) return *this;  
00678     m_thermo = right.m_thermo;
00679     m_pref   = right.m_pref;
00680     return *this;
00681   }
00682 
00683   template<class SPM>
00684   SpeciesThermo *
00685   SpeciesThermo1<SPM>::duplMyselfAsSpeciesThermo() const {
00686     SpeciesThermo1<SPM> *nt = new SpeciesThermo1<SPM>(*this);
00687     return (SpeciesThermo *) nt;
00688   }
00689   
00690   template<class SPM>
00691   void 
00692   SpeciesThermo1<SPM>::install(std::string name, int sp, int type, const vector_fp& c)
00693   {
00694     m_thermo.push_back(SPM(sp, c));
00695     if (m_pref) {
00696       if (m_thermo.begin()->refPressure() != m_pref) {
00697         throw RefPressureMismatch("SpeciesThermo1:install",
00698                                   refPressure(), m_pref);
00699       }
00700     }
00701     else  m_pref = m_thermo.begin()->refPressure();
00702   }
00703 
00704   template<class SPM>
00705   inline void
00706   SpeciesThermo1<SPM>::update(doublereal t, vector_fp& cp_R, 
00707                               vector_fp& h_RT, vector_fp& s_R) const {
00708     _updateAll(m_thermo.begin(), m_thermo.end(), t, cp_R, h_RT, s_R);
00709   }
00710   
00711   template<class SPM>
00712   void 
00713   SpeciesThermo1<SPM>::update_one(int k, doublereal t, vector_fp& cp_R, 
00714                                   vector_fp& h_RT, vector_fp& s_R) const {
00715     m_thermo[k]->update(t, cp_R, h_RT, s_R);
00716   }
00717   
00718   template<class SPM>
00719   doublereal 
00720   SpeciesThermo1<SPM>::minTemp(int k) const {
00721     if (k < 0)
00722       return _minTemp(m_thermo.begin(), m_thermo.end());
00723     else
00724       return m_thermo[k].minTemp();
00725   }
00726 
00727   template<class SPM>
00728   doublereal 
00729   SpeciesThermo1<SPM>::maxTemp(int k) const {
00730     if (k < 0)
00731       return _maxTemp(m_thermo.begin(), m_thermo.end());
00732     else
00733       return m_thermo[k].maxTemp();
00734   }
00735 
00736   template<class SPM>
00737   doublereal 
00738   SpeciesThermo1<SPM>::refPressure(int k) const {
00739     return m_pref;
00740   }
00741 
00742   template<class SPM>
00743   int 
00744   SpeciesThermo1<SPM>::reportType(int k) const {
00745     return m_thermo[k]->reportType(-1);   
00746   }
00747 
00748   template<class SPM>
00749   void 
00750   SpeciesThermo1<SPM>::reportParams(int index, int &type, 
00751                                     doublereal * const c, 
00752                                     doublereal &minTemp, 
00753                                     doublereal &maxTemp, 
00754                                     doublereal &refPressure) const {
00755     m_thermo[index]->reportParameters(index, type, c, minTemp, maxTemp, refPressure);
00756   }
00757 
00758   template<class SPM>
00759   void
00760   SpeciesThermo1<SPM>::modifyParams(int index, doublereal *c) {
00761     m_thermo[index]->modifyParameters(index, c);
00762   }
00763 }
00764 
00765 #endif
Generated by  doxygen 1.6.3