Cantera  3.0.0
Loading...
Searching...
No Matches
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
15namespace Cantera
16{
17
18/**
19 * Factory for kinetics managers.
20 */
21class KineticsFactory : public Factory<Kinetics>
22{
23public:
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
33private:
34 static KineticsFactory* s_factory;
36 static std::mutex kinetics_mutex;
37};
38
39//! @addtogroup kineticsmgr
40//! @{
41
42/**
43 * Create a new kinetics manager.
44 * @deprecated To be removed after %Cantera 3.0; superseded by newKinetics().
45 */
46Kinetics* newKineticsMgr(const string& model);
47
48/**
49 * Create a new Kinetics instance.
50 */
51shared_ptr<Kinetics> newKinetics(const string& model);
52
53//! Create a new kinetics manager, initialize it, and add reactions.
54/*!
55 * @param phases Vector of phases containing species which participate in
56 * reactions, with the phase where the reactions occur (lowest-dimensional
57 * phase) listed first.
58 * @param phaseNode Phase entry for the phase where the reactions occur. This
59 * phase definition is used to determine the source of the reactions added
60 * to the Kinetics object.
61 * @param rootNode The root node of the file containing the phase definition,
62 * which will be treated as the default source for reactions
63 * @param soln The Solution object that this Kinetics object is being added to.
64 */
65shared_ptr<Kinetics> newKinetics(const vector<shared_ptr<ThermoPhase>>& phases,
66 const AnyMap& phaseNode,
67 const AnyMap& rootNode=AnyMap(),
68 shared_ptr<Solution> soln={});
69
70//! @brief Create a new kinetics manager, initialize it, and add reactions.
71//! @see newKinetics(const vector<shared_ptr<ThermoPhase>>&, const AnyMap&, const AnyMap&, shared_ptr<Solution>)
72//! @deprecated To be removed after %Cantera 3.0;
73//! superseded by newKinetics() returning shared_ptr
74unique_ptr<Kinetics> newKinetics(const vector<ThermoPhase*>& phases,
75 const AnyMap& phaseNode,
76 const AnyMap& rootNode=AnyMap());
77
78//! Create a new kinetics manager, initialize it, and add reactions.
79/*!
80 * @param phases Vector of phases containing species which participate in
81 * reactions, with the phase where the reactions occur (lowest-dimensional
82 * phase) listed first.
83 * @param filename File containing the phase definition for the phase where
84 * the reactions occur. Searches the %Cantera data for this file.
85 * @param phase_name The name of the reacting phase in the input file (that is, the
86 * name of the first phase in the `phases` vector)
87 * @deprecated The 'phase_name' argument is deprecated and will be removed after
88 * %Cantera 3.0.
89 * @since Starting with %Cantera 3.0, if the reacting phase is not the first item in
90 * the `phases` vector, a deprecation warning will be issued. In %Cantera 3.1, this
91 * warning will become an error.
92 */
93shared_ptr<Kinetics> newKinetics(const vector<shared_ptr<ThermoPhase>>& phases,
94 const string& filename,
95 const string& phase_name="");
96
97//! @copydoc newKinetics(const vector<shared_ptr<ThermoPhase>>&, const string&, const string&)
98//! @deprecated To be removed after %Cantera 3.0;
99//! superseded by newKinetics() returning shared_ptr
100unique_ptr<Kinetics> newKinetics(const vector<ThermoPhase*>& phases,
101 const string& filename,
102 const string& phase_name);
103
104/**
105 * Add reactions to a Kinetics object.
106 *
107 * @param kin The Kinetics object to be initialized
108 * @param phaseNode Phase entry for the phase where the reactions occur. This
109 * phase definition is used to determine the source of the reactions added
110 * to the Kinetics object.
111 * @param rootNode The root node of the file containing the phase definition,
112 * which will be treated as the default source for reactions
113 */
114void addReactions(Kinetics& kin, const AnyMap& phaseNode,
115 const AnyMap& rootNode=AnyMap());
116
117//! @}
118
119}
120
121#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:126
Kinetics * newKineticsMgr(const string &model)
Create a new kinetics manager.
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