Cantera  2.5.1
Interface.h
Go to the documentation of this file.
1 /**
2  * @file Interface.h
3  * Declaration and Definition for the class Interface.
4  */
5 
6 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at https://cantera.org/license.txt for license and copyright information.
8 
9 #ifndef CXX_INTERFACE
10 #define CXX_INTERFACE
11 
12 #pragma message("warning: Interface.h is deprecated and will be removed after Cantera 2.5.")
13 
14 #include "thermo.h"
15 #include "kinetics.h"
18 
19 namespace Cantera
20 {
21 //! An interface between multiple bulk phases.
22 /*!
23  * This class is defined mostly for convenience. It inherits both from SurfPhase
24  * and InterfaceKinetics. It therefore represents a surface phase, and also acts
25  * as the kinetics manager to manage reactions occurring on the surface,
26  * possibly involving species from other phases.
27  *
28  * @deprecated To be removed after Cantera 2.5.
29  * Replaceable with Solution and/or SurfPhase/InterfaceKinetics.
30  */
31 class Interface :
32  public SurfPhase,
33  public InterfaceKinetics
34 {
35 public:
36  //! Constructor.
37  /*!
38  * Construct an Interface instance from a specification in an input file.
39  *
40  * @param infile Cantera input file in CTI or CTML format.
41  * @param id Identification string to distinguish between multiple
42  * definitions within one input file.
43  * @param otherPhases Neighboring phases that may participate in the
44  * reactions on this interface. Don't include the surface phase
45  */
46  Interface(const std::string& infile, std::string id,
47  std::vector<ThermoPhase*> otherPhases) :
48  m_ok(false),
49  m_r(0) {
50  warn_deprecated("class Interface",
51  "To be removed after Cantera 2.5. "
52  "Replaceable with Solution and/or SurfPhase/InterfaceKinetics.");
53 
54  m_r = get_XML_File(infile);
55  if (id == "-") {
56  id = "";
57  }
58 
59  XML_Node* x = get_XML_Node("#"+id, m_r);
60  if (!x) {
61  throw CanteraError("Interface","error in get_XML_Node");
62  }
63  importPhase(*x, this);
64  otherPhases.push_back(this);
65  importKinetics(*x, otherPhases, this);
66  m_ok = true;
67  }
68 
69  //! Not operator
70  bool operator!() {
71  return !m_ok;
72  }
73 
74  //! return whether the object has been instantiated
75  bool ready() const {
76  return m_ok;
77  }
78 
79 protected:
80  //! Flag indicating that the object has been instantiated
81  bool m_ok;
82 
83  //! XML_Node pointer to the XML File object that contains the Surface and
84  //! the Interfacial Reaction object description
86 };
87 
88 //! Import an instance of class Interface from a specification in an input file.
89 /*!
90  * This is the preferred method to create an Interface instance.
91  *
92  * @deprecated To be removed after Cantera 2.5. Replaceable with Solution.
93  */
94 inline Interface* importInterface(const std::string& infile,
95  const std::string& id,
96  std::vector<ThermoPhase*> phases)
97 {
98  warn_deprecated("importInterface", "To be removed after Cantera 2.5. "
99  "Replaceable with Solution.");
100  return new Interface(infile, id, phases);
101 }
102 
103 }
104 
105 #endif
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
A kinetics manager for heterogeneous reaction mechanisms.
An interface between multiple bulk phases.
Definition: Interface.h:34
Interface(const std::string &infile, std::string id, std::vector< ThermoPhase * > otherPhases)
Constructor.
Definition: Interface.h:46
XML_Node * m_r
XML_Node pointer to the XML File object that contains the Surface and the Interfacial Reaction object...
Definition: Interface.h:85
bool m_ok
Flag indicating that the object has been instantiated.
Definition: Interface.h:81
bool operator!()
Not operator.
Definition: Interface.h:70
bool ready() const
return whether the object has been instantiated
Definition: Interface.h:75
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition: SurfPhase.h:143
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
XML_Node * get_XML_Node(const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
Definition: global.cpp:194
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
bool importKinetics(const XML_Node &phase, std::vector< ThermoPhase * > th, Kinetics *k)
Import a reaction mechanism for a phase or an interface.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Support for chemical kinetics calculation from C++ application programs.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
Interface * importInterface(const std::string &infile, const std::string &id, std::vector< ThermoPhase * > phases)
Import an instance of class Interface from a specification in an input file.
Definition: Interface.h:94
Support for thermo property calculation from C++ application programs.