Cantera  2.5.1
Solution.h
Go to the documentation of this file.
1 //! @file Solution.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 CT_SOLUTION_H
7 #define CT_SOLUTION_H
8 
10 
11 namespace Cantera
12 {
13 
14 class ThermoPhase;
15 class Kinetics;
16 class Transport;
17 
18 //! A container class holding managers for all pieces defining a phase
19 class Solution : public std::enable_shared_from_this<Solution>
20 {
21 private:
22  Solution();
23 
24 public:
25  ~Solution() {}
26  Solution(const Solution&) = delete;
27  Solution& operator=(const Solution&) = delete;
28 
29  //! Create an empty Solution object
30  static shared_ptr<Solution> create() {
31  return shared_ptr<Solution>( new Solution );
32  }
33 
34  //! Return the name of this Solution object
35  std::string name() const;
36 
37  //! Set the name of this Solution object
38  void setName(const std::string& name);
39 
40  //! Set the ThermoPhase object
41  void setThermo(shared_ptr<ThermoPhase> thermo);
42 
43  //! Set the Kinetics object
44  void setKinetics(shared_ptr<Kinetics> kinetics);
45 
46  //! Set the Transport object
47  void setTransport(shared_ptr<Transport> transport);
48 
49  //! Accessor for the ThermoPhase pointer
50  shared_ptr<ThermoPhase> thermo() {
51  return m_thermo;
52  }
53 
54  //! Accessor for the Kinetics pointer
55  shared_ptr<Kinetics> kinetics() {
56  return m_kinetics;
57  }
58 
59  //! Accessor for the Transport pointer
60  shared_ptr<Transport> transport() {
61  return m_transport;
62  }
63 
64 protected:
65  shared_ptr<ThermoPhase> m_thermo; //!< ThermoPhase manager
66  shared_ptr<Kinetics> m_kinetics; //!< Kinetics manager
67  shared_ptr<Transport> m_transport; //!< Transport manager
68 };
69 
70 //! Create and initialize a new Solution manager from an input file
71 /*!
72  * This constructor wraps newPhase(), newKinetics() and
73  * newTransportMgr() routines for initialization.
74  *
75  * @param infile name of the input file
76  * @param name name of the phase in the file.
77  * If this is blank, the first phase in the file is used.
78  * @param transport name of the transport model.
79  * @param adjacent vector containing adjacent solution objects.
80  * @returns an initialized Solution object.
81  */
82 shared_ptr<Solution> newSolution(const std::string& infile,
83  const std::string& name="",
84  const std::string& transport="",
85  const std::vector<shared_ptr<Solution>>& adjacent={});
86 
87 }
88 #endif
A container class holding managers for all pieces defining a phase.
Definition: Solution.h:20
shared_ptr< ThermoPhase > thermo()
Accessor for the ThermoPhase pointer.
Definition: Solution.h:50
std::string name() const
Return the name of this Solution object.
Definition: Solution.cpp:22
shared_ptr< Kinetics > kinetics()
Accessor for the Kinetics pointer.
Definition: Solution.h:55
shared_ptr< Transport > transport()
Accessor for the Transport pointer.
Definition: Solution.h:60
shared_ptr< Kinetics > m_kinetics
Kinetics manager.
Definition: Solution.h:66
void setThermo(shared_ptr< ThermoPhase > thermo)
Set the ThermoPhase object.
Definition: Solution.cpp:40
shared_ptr< ThermoPhase > m_thermo
ThermoPhase manager.
Definition: Solution.h:65
void setName(const std::string &name)
Set the name of this Solution object.
Definition: Solution.cpp:31
void setTransport(shared_ptr< Transport > transport)
Set the Transport object.
Definition: Solution.cpp:54
static shared_ptr< Solution > create()
Create an empty Solution object.
Definition: Solution.h:30
shared_ptr< Transport > m_transport
Transport manager.
Definition: Solution.h:67
void setKinetics(shared_ptr< Kinetics > kinetics)
Set the Kinetics object.
Definition: Solution.cpp:47
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
shared_ptr< Solution > newSolution(const std::string &infile, const std::string &name, const std::string &transport, const std::vector< shared_ptr< Solution >> &adjacent)
Create and initialize a new Solution manager from an input file.
Definition: Solution.cpp:61