| Cantera 3.0.0

Loading...
Searching...
No Matches
ReactionRateFactory.h
Go to the documentation of this file.
1/**
2 * @file ReactionRateFactory.h
3 * Factory class for reaction rate objects. Used by classes that implement kinetics
4 * (see @ref reactionGroup and class @link Cantera::ReactionRate ReactionRate@endlink).
5 */
6
7// This file is part of Cantera. See License.txt in the top-level directory or
8// at https://cantera.org/license.txt for license and copyright information.
9
10#ifndef CT_NEWRATE_H
11#define CT_NEWRATE_H
12
13#include "cantera/base/FactoryBase.h"
14#include "cantera/kinetics/ReactionRate.h"
15
16 namespace Cantera
17{
18
19 class Kinetics;
20 class Units;
21
22/**
23 * @defgroup arrheniusGroup Arrhenius-type Parameterizations
24 * Classes implementing the standard Arrhenius rate parameterization and derived models.
25 * @ingroup reactionGroup
26 */
27
28/**
29 * @defgroup falloffGroup Falloff Parameterizations
30 * Classes implementing fall-off in reaction rate constants due to intermolecular energy
31 * transfer and derived models.
32 * @ingroup reactionGroup
33 */
34
35/**
36 * @defgroup surfaceGroup Interface Rate Parameterizations
37 * Classes implementing reaction rates that involve interfaces.
38 * @ingroup reactionGroup
39 */
40
41/**
42 * @defgroup otherRateGroup Other Reaction Rate Parameterizations
43 * Classes implementing other reaction rate parameterizations.
44 * @ingroup reactionGroup
45 */
46
47
48/**
49 * Factory class to construct reaction rate calculators.
50 * The reaction factory is accessed through the static method factory:
51 *
52 * @code
53 * Rate* f = ReactionRateFactory::factory()->newReactionRate(type, c)
54 * @endcode
55 */
56 class ReactionRateFactory
57 : public Factory<ReactionRate, const AnyMap&, const UnitStack&>
58{
59 public:
60 /**
61 * Return a pointer to the factory. On the first call, a new instance is
62 * created. Since there is no need to instantiate more than one factory,
63 * on all subsequent calls, a pointer to the existing factory is returned.
64 */
65 static ReactionRateFactory* factory();
66
67 void deleteFactory() override;
68
69 private:
70 //! Pointer to the single instance of the factory
71 static ReactionRateFactory* s_factory;
72
73 //! default constructor, which is defined as private
74 ReactionRateFactory();
75
76 //! Mutex for use when calling the factory
77 static std::mutex rate_mutex;
78};
79
80//! @addtogroup reactionGroup
81//! @{
82
83//! Create a new empty ReactionRate object
84/*!
85 * @param type string identifying type of reaction rate.
86 */
87shared_ptr<ReactionRate> newReactionRate(const string& type);
88
89//! Create a new Rate object using the specified parameters
90/*!
91 * @param rate_node AnyMap node describing reaction rate.
92 * @param rate_units Vector describing unit system of the reaction rate; each element
93 * specifies Unit and exponent applied to the unit.
94 */
95shared_ptr<ReactionRate> newReactionRate(
96 const AnyMap& rate_node, const UnitStack& rate_units);
97
98//! Create a new Rate object using the specified parameters
99/*!
100 * @param rate_node AnyMap node describing reaction rate.
101 */
102shared_ptr<ReactionRate> newReactionRate(const AnyMap& rate_node);
103
104//! @}
105
106}
107#endif
FactoryBase.h
File contains the FactoryBase class declarations.
ReactionRate.h
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::ReactionRateFactory
Factory class to construct reaction rate calculators.
Definition ReactionRateFactory.h:58
Cantera::ReactionRateFactory::s_factory
static ReactionRateFactory * s_factory
Pointer to the single instance of the factory.
Definition ReactionRateFactory.h:71
Cantera::ReactionRateFactory::ReactionRateFactory
ReactionRateFactory()
default constructor, which is defined as private
Definition ReactionRateFactory.cpp:26
Cantera::ReactionRateFactory::deleteFactory
void deleteFactory() override
Virtual abstract function that deletes the factory.
Definition ReactionRateFactory.cpp:111
Cantera::ReactionRateFactory::rate_mutex
static std::mutex rate_mutex
Mutex for use when calling the factory.
Definition ReactionRateFactory.h:77
Cantera::ReactionRateFactory::factory
static ReactionRateFactory * factory()
Return a pointer to the factory.
Definition ReactionRateFactory.cpp:103
Cantera::newReactionRate
shared_ptr< ReactionRate > newReactionRate(const string &type)
Create a new empty ReactionRate object.
Definition ReactionRateFactory.cpp:117
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::UnitStack
Unit aggregation utility.
Definition Units.h:105