Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

steamproperty.h

00001 /* 00002 00003 freesteam - IAPWS-IF97 steam tables library 00004 Copyright (C) 2004-2005 John Pye 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 */ 00021 00022 #ifndef STEAMPROPERTY_H 00023 #define STEAMPROPERTY_H 00024 00025 #include "steamcalculator.h" 00026 00027 #ifndef NDEBUG 00028 #include <sstream> 00029 #include "exception.h" 00030 #endif 00031 00033 00038 template<class Property,int PropertyAlternative=0> 00039 class SteamProperty{ 00040 public: 00041 static inline Property get(const SteamCalculator &S); 00042 static const char *name(); 00043 00044 static inline const bool plotOnLogAxis(){ 00045 return false; 00046 } 00047 }; 00048 00049 // 'getProperty' hooks 00050 00051 inline SpecificEnergy 00052 SteamProperty<SpecificEnergy,SOLVE_IENERGY>::get(const SteamCalculator &S){ 00053 return S.specienergy(); 00054 } 00055 00056 inline SpecificEnergy 00057 SteamProperty<SpecificEnergy,SOLVE_ENTHALPY>::get(const SteamCalculator &S){ 00058 return S.specenthalpy(); 00059 } 00060 00061 inline Density 00062 SteamProperty<Density,0>::get(const SteamCalculator &S){ 00063 return S.dens(); 00064 } 00065 00066 inline SpecificVolume 00067 SteamProperty<SpecificVolume,0>::get(const SteamCalculator &S){ 00068 return S.specvol(); 00069 } 00070 00071 inline Temperature 00072 SteamProperty<Temperature,0>::get(const SteamCalculator &S){ 00073 return S.temp(); 00074 } 00075 00076 inline Pressure 00077 SteamProperty<Pressure,0>::get(const SteamCalculator &S){ 00078 return S.pres(); 00079 } 00080 00081 inline SpecificEntropy 00082 SteamProperty<SpecificEntropy,SOLVE_ENTROPY>::get(const SteamCalculator &S){ 00083 #ifndef NDEBUG 00084 try{ 00085 #endif 00086 00087 return S.specentropy(); 00088 00089 #ifndef NDEBUG 00090 }catch(Exception *E){ 00091 std::stringstream s; 00092 s << "SteamProperty<s>::get: " << E->what(); 00093 delete E; 00094 throw new Exception(s.str()); 00095 } 00096 #endif 00097 } 00098 00099 inline SpecHeatCap 00100 SteamProperty<SpecHeatCap,SOLVE_CP>::get(const SteamCalculator &S){ 00101 return S.speccp(); 00102 } 00103 00104 inline SpecHeatCap 00105 SteamProperty<SpecHeatCap,SOLVE_CV>::get(const SteamCalculator &S){ 00106 return S.speccv(); 00107 } 00108 00109 inline Num 00110 SteamProperty<Num,0>::get(const SteamCalculator &S){ 00111 return S.quality(); 00112 } 00113 00114 inline 00115 const bool 00116 SteamProperty<SpecificVolume,0>::plotOnLogAxis(){ 00117 return true; 00118 } 00119 00120 inline 00121 const bool 00122 SteamProperty<Pressure,0>::plotOnLogAxis(){ 00123 return true; 00124 } 00125 00126 #endif

Generated on Tue Mar 22 19:07:05 2005 for freesteam by doxygen 1.3.8