Cantera  3.1.0a1
KineticsFactory.h
Go to the documentation of this file.
1 /**
2  * @file KineticsFactory.h
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at https://cantera.org/license.txt for license and copyright information.
7 
8 #ifndef KINETICS_FACTORY_H
9 #define KINETICS_FACTORY_H
10 
11 #include "Kinetics.h"
13 #include "cantera/base/AnyMap.h"
14 
15 namespace Cantera
16 {
17 
18 /**
19  * Factory for kinetics managers.
20  */
21 class KineticsFactory : public Factory<Kinetics>
22 {
23 public:
24  static KineticsFactory* factory();
25 
26  void deleteFactory() override;
27 
28  /**
29  * Return a new, empty kinetics manager.
30  */
31  Kinetics* newKinetics(const string& model);
32 
33 private:
34  static KineticsFactory* s_factory;
36  static std::mutex kinetics_mutex;
37 };
38 
39 //! @addtogroup kineticsmgr
40 //! @{
41 
42 /**
43  * Create a new Kinetics instance.
44  */
45 shared_ptr<Kinetics> newKinetics(const string& model);
46 
47 //! Create a new kinetics manager, initialize it, and add reactions.
48 /*!
49  * @param phases Vector of phases containing species which participate in
50  * reactions, with the phase where the reactions occur (lowest-dimensional
51  * phase) listed first.
52  * @param phaseNode Phase entry for the phase where the reactions occur. This
53  * phase definition is used to determine the source of the reactions added
54  * to the Kinetics object.
55  * @param rootNode The root node of the file containing the phase definition,
56  * which will be treated as the default source for reactions
57  * @param soln The Solution object that this Kinetics object is being added to.
58  */
59 shared_ptr<Kinetics> newKinetics(const vector<shared_ptr<ThermoPhase>>& phases,
60  const AnyMap& phaseNode,
61  const AnyMap& rootNode=AnyMap(),
62  shared_ptr<Solution> soln={});
63 
64 //! Create a new kinetics manager, initialize it, and add reactions.
65 /*!
66  * @param phases Vector of phases containing species which participate in
67  * reactions, with the phase where the reactions occur (lowest-dimensional
68  * phase) listed first.
69  * @param filename File containing the phase definition for the phase where
70  * the reactions occur. Searches the %Cantera data for this file.
71  */
72 shared_ptr<Kinetics> newKinetics(const vector<shared_ptr<ThermoPhase>>& phases,
73  const string& filename);
74 
75 /**
76  * Add reactions to a Kinetics object.
77  *
78  * @param kin The Kinetics object to be initialized
79  * @param phaseNode Phase entry for the phase where the reactions occur. This
80  * phase definition is used to determine the source of the reactions added
81  * to the Kinetics object.
82  * @param rootNode The root node of the file containing the phase definition,
83  * which will be treated as the default source for reactions
84  */
85 void addReactions(Kinetics& kin, const AnyMap& phaseNode,
86  const AnyMap& rootNode=AnyMap());
87 
88 //! @}
89 
90 }
91 
92 #endif
File contains the FactoryBase class declarations.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:427
Factory class that supports registering functions to create objects.
Definition: FactoryBase.h:69
Factory for kinetics managers.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Kinetics * newKinetics(const string &model)
Return a new, empty kinetics manager.
Public interface for kinetics managers.
Definition: Kinetics.h:125
shared_ptr< Kinetics > newKinetics(const string &model)
Create a new Kinetics instance.
void addReactions(Kinetics &kin, const AnyMap &phaseNode, const AnyMap &rootNode)
Add reactions to a Kinetics object.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564