Cantera  2.0
PropertyCalculator.h
Go to the documentation of this file.
1 /**
2  * @file PropertyCalculator.h
3  */
4 
5 // Copyright 2001 California Institute of Technology
6 
7 #ifndef CT_PROP_CALC_H
8 #define CT_PROP_CALC_H
9 
10 #include "cantera/base/ct_defs.h"
11 #include <string>
12 
13 namespace Cantera
14 {
15 
16 /// Classes used by ChemEquil. These classes are used only by the
17 /// ChemEquil equilibrium solver. Each one returns a particular
18 /// property of the object supplied as the argument.
19 ///
20 template<class M>
22 {
23 public:
24  virtual ~PropertyCalculator() {}
25  virtual doublereal value(const M& s) =0;
26  virtual std::string symbol() =0;
27 };
28 
29 template<class M>
30 class EnthalpyCalculator : public PropertyCalculator<M>
31 {
32 public:
33  virtual doublereal value(const M& s) {
34  return s.enthalpy_mass();
35  }
36  virtual std::string symbol() {
37  return "H";
38  }
39 };
40 
41 template<class M>
42 class EntropyCalculator : public PropertyCalculator<M>
43 {
44 public:
45  virtual doublereal value(const M& s) {
46  return s.entropy_mass();
47  }
48  virtual std::string symbol() {
49  return "S";
50  }
51 };
52 
53 template<class M>
54 class TemperatureCalculator : public PropertyCalculator<M>
55 {
56 public:
57  virtual doublereal value(const M& s) {
58  return s.temperature();
59  }
60  virtual std::string symbol() {
61  return "T";
62  }
63 };
64 
65 template<class M>
66 class PressureCalculator : public PropertyCalculator<M>
67 {
68 public:
69  virtual doublereal value(const M& s) {
70  return s.pressure();
71  }
72  virtual std::string symbol() {
73  return "P";
74  }
75 };
76 
77 template<class M>
78 class DensityCalculator : public PropertyCalculator<M>
79 {
80 public:
81  virtual doublereal value(const M& s) {
82  return s.density();
83  }
84  virtual std::string symbol() {
85  return "V";
86  }
87 };
88 
89 template<class M>
90 class IntEnergyCalculator : public PropertyCalculator<M>
91 {
92 public:
93  virtual doublereal value(const M& s) {
94  return s.intEnergy_mass();
95  }
96  virtual std::string symbol() {
97  return "U";
98  }
99 };
100 }
101 
102 #endif
103