Cantera  2.3.0
Metal.h
Go to the documentation of this file.
1 //! @file Metal.h
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 #ifndef CXX_METAL
7 #define CXX_METAL
8 
9 #include "thermo/MetalPhase.h"
11 
12 namespace Cantera
13 {
14 
15 //! Wrapper for MetalPhase with constructor from file
16 class Metal : public MetalPhase
17 {
18 public:
19  Metal(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("Metal::Metal",
27  "buildSolutionFromXML returned false");
28  }
29 
30  bool operator!() {
31  return !m_ok;
32  }
33  bool ready() const {
34  return m_ok;
35  }
36 
37 protected:
38  bool m_ok;
39  XML_Node* m_r;
40 };
41 }
42 
43 #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:96
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:97
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
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)...
bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: Metal.h:33
Namespace for the Cantera kernel.
Definition: application.cpp:29
Wrapper for MetalPhase with constructor from file.
Definition: Metal.h:16