Cantera  2.5.1
PureFluid.h
Go to the documentation of this file.
1 //! @file PureFluid.h
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
6 #ifndef CXX_PUREFLUID
7 #define CXX_PUREFLUID
8 
9 #pragma message("warning: PureFluid.h is deprecated and will be removed after Cantera 2.5.0.")
10 
11 #include "thermo/PureFluidPhase.h"
12 #include "kinetics.h"
13 
14 namespace Cantera
15 {
16 
17 //! Wrapper for PureFluidPhase with constructor from file
18 /*!
19  * @deprecated To be removed after Cantera 2.5.0. Replaceable with PureFluidPhase.
20  */
21 class PureFluid : public PureFluidPhase
22 {
23 public:
24  PureFluid() : m_ok(false), m_r(0) {
25  warn_deprecated("class PureFluid", "To be removed after Cantera 2.5.0. "
26  "Replaceable with PureFluidPhase.");
27  }
28 
29  PureFluid(const std::string& infile, std::string id="") : m_ok(false), m_r(0) {
30  warn_deprecated("class PureFluid", "To be removed after Cantera 2.5.0. "
31  "Replaceable with PureFluidPhase::initThermoFile.");
32  m_r = get_XML_File(infile);
33  if (id == "-") {
34  id = "";
35  }
36  m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
37  if (!m_ok) throw CanteraError("PureFluid",
38  "buildSolutionFromXML returned false");
39  }
40 
41  PureFluid(XML_Node& root, const std::string& id) : m_ok(false), m_r(0) {
42  m_ok = buildSolutionFromXML(root, id, "phase", this, 0);
43  }
44 
45  bool operator!() {
46  return !m_ok;
47  }
48 
49  bool ready() const {
50  return m_ok;
51  }
52 
53  friend std::ostream& operator<<(std::ostream& s, PureFluid& mix) {
54  std::string r = mix.report(true);
55  s << r;
56  return s;
57  }
58 
59 protected:
60  bool m_ok;
61  XML_Node* m_r;
62 };
63 
64 
65 //! Water definition from liquidvapor input file
66 /*!
67  * @deprecated To be removed after Cantera 2.5.0. Replaceable with PureFluidPhase.
68  */
69 class Water : public PureFluid
70 {
71 public:
72  Water() : PureFluid(std::string("liquidvapor.cti"),std::string("water")) {
73  warn_deprecated("class Water", "To be removed after Cantera 2.5.0. "
74  "Replaceable with PureFluidPhase.");
75  }
76  virtual ~Water() {}
77 };
78 
79 }
80 
81 #endif
Header for a ThermoPhase class for a pure fluid phase consisting of gas, liquid, mixed-gas-liquid and...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
This phase object consists of a single component that can be a gas, a liquid, a mixed gas-liquid flui...
virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const
returns a summary of the state of the phase as a string
Wrapper for PureFluidPhase with constructor from file.
Definition: PureFluid.h:22
bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: PureFluid.h:49
Water definition from liquidvapor input file.
Definition: PureFluid.h:70
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:104
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:110
bool buildSolutionFromXML(XML_Node &root, const std::string &id, const std::string &nm, ThermoPhase *th, Kinetics *kin)
Build a single-phase ThermoPhase object with associated kinetics mechanism.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
Support for chemical kinetics calculation from C++ application programs.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264