Cantera  2.0
PureFluid.h
1 #ifndef CXX_PUREFLUID
2 #define CXX_PUREFLUID
3 
4 #include <string>
5 
7 #include "kinetics.h"
8 #include "base/stringUtils.h"
9 
10 namespace Cantera
11 {
12 
13 
14 class PureFluid : public PureFluidPhase
15 {
16 public:
17 
18  PureFluid() : m_ok(false), m_r(0) {}
19 
20  PureFluid(std::string infile, std::string id="") : m_ok(false), m_r(0) {
21 
22  m_r = get_XML_File(infile);
23  if (id == "-") {
24  id = "";
25  }
26  m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
27  if (!m_ok) throw CanteraError("PureFluid",
28  "buildSolutionFromXML returned false");
29  }
30 
31 
32  PureFluid(XML_Node& root, std::string id) : m_ok(false), m_r(0) {
33  m_ok = buildSolutionFromXML(root, id, "phase", this, 0);
34  }
35 
36  virtual ~PureFluid() {}
37 
38  bool operator!() {
39  return !m_ok;
40  }
41  bool ready() const {
42  return m_ok;
43  }
44  friend std::ostream& operator<<(std::ostream& s, PureFluid& mix) {
45  std::string r = mix.report(true);
46  s << r;
47  return s;
48  }
49 
50 protected:
51  bool m_ok;
52  XML_Node* m_r;
53 
54 private:
55 };
56 
57 class Water : public PureFluid
58 {
59 public:
60  Water() : PureFluid(std::string("liquidvapor.cti"),std::string("water")) {}
61  virtual ~Water() {}
62 };
63 
64 }
65 
66 
67 #endif