Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Metal.h
Go to the documentation of this file.
1 //! @file Metal.h
2 #ifndef CXX_METAL
3 #define CXX_METAL
4 
5 #include "thermo/MetalPhase.h"
7 
8 namespace Cantera
9 {
10 
11 //! Wrapper for MetalPhase with constructor from file
12 class Metal : public MetalPhase
13 {
14 public:
15  Metal(const std::string& infile, std::string id="") : m_ok(false), m_r(0) {
16 
17  m_r = get_XML_File(infile);
18  if (id == "-") {
19  id = "";
20  }
21  m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
22  if (!m_ok) throw CanteraError("Metal::Metal",
23  "buildSolutionFromXML returned false");
24  }
25 
26  bool operator!() {
27  return !m_ok;
28  }
29  bool ready() const {
30  return m_ok;
31  }
32 
33 protected:
34  bool m_ok;
35  XML_Node* m_r;
36 
37 private:
38 };
39 }
40 
41 
42 #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:105
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:23
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: Metal.h:29
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
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.
Definitions of global routines for the importing of data from XML files (see Input File Handling)...
Wrapper for MetalPhase with constructor from file.
Definition: Metal.h:12