| 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"
12#include "cantera/base/FactoryBase.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;
35 KineticsFactory();
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 */
46 Kinetics* 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
74 unique_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
100 unique_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 */
114 void addReactions(Kinetics& kin, const AnyMap& phaseNode,
115 const AnyMap& rootNode=AnyMap());
116
117//! @}
118
119}
120
121#endif
AnyMap.h
FactoryBase.h
File contains the FactoryBase class declarations.
Kinetics.h
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::Factory
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Cantera::KineticsFactory
Factory for kinetics managers.
Definition KineticsFactory.h:22
Cantera::KineticsFactory::deleteFactory
void deleteFactory() override
Virtual abstract function that deletes the factory.
Definition KineticsFactory.cpp:53
Cantera::KineticsFactory::newKinetics
Kinetics * newKinetics(const string &model)
Return a new, empty kinetics manager.
Definition KineticsFactory.cpp:59
Cantera::Kinetics
Public interface for kinetics managers.
Definition Kinetics.h:126
Cantera::newKineticsMgr
Kinetics * newKineticsMgr(const string &model)
Create a new kinetics manager.
Definition KineticsFactory.cpp:64
Cantera::newKinetics
shared_ptr< Kinetics > newKinetics(const string &model)
Create a new Kinetics instance.
Definition KineticsFactory.cpp:71
Cantera::addReactions
void addReactions(Kinetics &kin, const AnyMap &phaseNode, const AnyMap &rootNode)
Add reactions to a Kinetics object.
Definition KineticsFactory.cpp:168
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564