Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
cantera
Interface.h
Go to the documentation of this file.
1
/**
2
* @file Interface.h
3
* Declaration and Definition for the class Interface.
4
*/
5
#ifndef CXX_INTERFACE
6
#define CXX_INTERFACE
7
8
#include <string>
9
#include "
thermo.h
"
10
#include "kinetics.h"
11
12
namespace
Cantera
13
{
14
15
//! An interface between multiple bulk phases.
16
/*!
17
* This class is defined mostly for convenience. It inherits both from
18
* Cantera::SurfPhase and Cantera::InterfaceKinetics. It therefore
19
* represents a surface phase, and also acts as the kinetics
20
* manager to manage reactions occurring on the surface, possibly
21
* involving species from other phases.
22
*/
23
class
Interface
:
24
public
SurfPhase
,
25
public
InterfaceKinetics
26
{
27
public
:
28
//! Constructor.
29
/*!
30
* Construct an Interface instance from a specification in an input file.
31
*
32
* @param infile Cantera input file in CTI or CTML format.
33
* @param id Identification string to distinguish between
34
* multiple definitions within one input file.
35
* @param otherPhases Neighboring phases that may participate in the
36
* reactions on this interface. Don't include the
37
* surface phase
38
*
39
* @deprecated
40
* While it's convenient to have the surface phase and the interfacial reaction
41
* together, this class doesn't satisfy the primary issue, which is one
42
* of instantiation of all the ThermoPhase classes that accompany a
43
* surface reaction. This is accomplished by the PhaseList class along with
44
* the ReactingSurface class. These classes will be migrated into Cantera
45
* soon.
46
*/
47
Interface
(std::string infile, std::string
id
,
48
std::vector<Cantera::ThermoPhase*> otherPhases) :
49
m_ok
(false),
50
m_r
(0) {
51
m_r
=
Cantera::get_XML_File
(infile);
52
if
(
id
==
"-"
) {
53
id
=
""
;
54
}
55
56
Cantera::XML_Node
* x =
Cantera::get_XML_Node
(
"#"
+
id
,
m_r
);
57
if
(!x) {
58
throw
Cantera::CanteraError
(
"Interface"
,
"error in get_XML_Node"
);
59
}
60
Cantera::importPhase
(*x,
this
);
61
otherPhases.push_back(
this
);
62
Cantera::importKinetics
(*x, otherPhases,
this
);
63
m_ok
=
true
;
64
}
65
66
//! Copy Constructor
67
/*!
68
* @param ii Interface object to be copied.
69
*/
70
Interface
(
const
Interface
& ii) :
71
Cantera::
SurfPhase
(ii),
72
Cantera::
InterfaceKinetics
(ii),
73
m_ok
(ii.
m_ok
),
74
m_r
(ii.
m_r
) {
75
}
76
77
//! Assignment operator
78
/*!
79
* @param right Interface object to be copied.
80
*/
81
Interface
&
operator=
(
const
Interface
& right) {
82
if
(
this
== &right) {
83
return
*
this
;
84
}
85
Cantera::SurfPhase::operator=
(right);
86
Cantera::InterfaceKinetics::operator=
(right);
87
m_ok
= right.
m_ok
;
88
m_r
= right.
m_r
;
89
return
*
this
;
90
}
91
92
//! Destructor. Does nothing.
93
virtual
~Interface
() {
94
}
95
96
//! Not operator
97
bool
operator!
() {
98
return
!
m_ok
;
99
}
100
101
//! return whether the object has been instantiated
102
/*!
103
* @return Returns a bool.
104
*/
105
bool
ready
()
const
{
106
return
m_ok
;
107
}
108
109
protected
:
110
111
//! Flag indicating that the object has been instantiated
112
bool
m_ok
;
113
114
//! XML_Node pointer to the XML File object that contains the Surface and the Interfacial Reaction object
115
//! description
116
Cantera::XML_Node
*
m_r
;
117
118
};
119
120
121
//! Import an instance of class Interface from a specification in an input file.
122
/*!
123
* This is the preferred method to create an Interface instance.
124
*/
125
Interface
*
importInterface
(std::string infile, std::string
id
, std::vector<Cantera::ThermoPhase*> phases)
126
{
127
return
new
Interface
(infile,
id
, phases);
128
}
129
130
}
131
132
133
#endif
Generated by
1.8.2