Cantera  2.1.2
PureFluid.h
Go to the documentation of this file.
1 //! @file PureFluid.h
2 #ifndef CXX_PUREFLUID
3 #define CXX_PUREFLUID
4 
6 #include "kinetics.h"
7 #include "base/stringUtils.h"
8 
9 namespace Cantera
10 {
11 
12 
13 class PureFluid : public PureFluidPhase
14 {
15 public:
16 
17  PureFluid() : m_ok(false), m_r(0) {}
18 
19  PureFluid(const std::string& infile, std::string id="") : m_ok(false), m_r(0) {
20 
21  m_r = get_XML_File(infile);
22  if (id == "-") {
23  id = "";
24  }
25  m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
26  if (!m_ok) throw CanteraError("PureFluid",
27  "buildSolutionFromXML returned false");
28  }
29 
30 
31  PureFluid(XML_Node& root, const std::string& id) : m_ok(false), m_r(0) {
32  m_ok = buildSolutionFromXML(root, id, "phase", this, 0);
33  }
34 
35  bool operator!() {
36  return !m_ok;
37  }
38  bool ready() const {
39  return m_ok;
40  }
41  friend std::ostream& operator<<(std::ostream& s, PureFluid& mix) {
42  std::string r = mix.report(true);
43  s << r;
44  return s;
45  }
46 
47 protected:
48  bool m_ok;
49  XML_Node* m_r;
50 
51 private:
52 };
53 
54 class Water : public PureFluid
55 {
56 public:
57  Water() : PureFluid(std::string("liquidvapor.cti"),std::string("water")) {}
58  virtual ~Water() {}
59 };
60 
61 }
62 
63 
64 #endif
XML_Node * get_XML_File(const std::string &file, int debug)
Return a pointer to the XML tree for a Cantera input file.
Definition: global.cpp:144
bool buildSolutionFromXML(XML_Node &root, const std::string &id, const std::string &nm, ThermoPhase *th, Kinetics *k)
Build a single-phase ThermoPhase object with associated kinetics mechanism.
Header for a ThermoPhase class for a pure fluid phase consisting of gas, liquid, mixed-gas-liquid and...
Contains declarations for string manipulation functions within Cantera.