Cantera  2.5.1
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 https://cantera.org/license.txt for license and copyright information.
5 
6 #ifndef CXX_METAL
7 #define CXX_METAL
8 
9 #pragma message("warning: Metal.h is deprecated and will be removed after Cantera 2.5.0.")
10 
11 #include "thermo/MetalPhase.h"
13 
14 namespace Cantera
15 {
16 
17 //! Wrapper for MetalPhase with constructor from file
18 /*!
19  * @deprecated To be removed after Cantera 2.5.0.
20  * Replaceable with Solution and/or MetalPhase.
21  */
22 class Metal : public MetalPhase
23 {
24 public:
25  Metal(const std::string& infile, std::string id="") : m_ok(false), m_r(0)
26  {
27  warn_deprecated("class Metal",
28  "To be removed after Cantera 2.5.0. "
29  "Replaceable with Solution and/or MetalPhase.");
30  m_r = get_XML_File(infile);
31  if (id == "-") {
32  id = "";
33  }
34  m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
35  if (!m_ok) throw CanteraError("Metal::Metal",
36  "buildSolutionFromXML returned false");
37  }
38 
39  bool operator!() {
40  return !m_ok;
41  }
42  bool ready() const {
43  return m_ok;
44  }
45 
46 protected:
47  bool m_ok;
48  XML_Node* m_r;
49 };
50 }
51 
52 #endif
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:23
Wrapper for MetalPhase with constructor from file.
Definition: Metal.h:23
bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: Metal.h:42
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
Definitions of global routines for the importing of data from XML files (see Input File Handling).
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264