Cantera 2.6.0
FalloffFactory.h
Go to the documentation of this file.
1/**
2 * @file FalloffFactory.h
3 * Parameterizations for reaction falloff functions. Used by classes
4 * that implement gas-phase kinetics (GasKinetics, GRI_30_Kinetics)
5 * (see \ref falloffGroup and class \link Cantera::FalloffRate FalloffRate\endlink).
6 *
7 * @deprecated Deprecated in Cantera 2.6 and removed thereafter. Replaced by
8 * FalloffRate objects managed by MultiRate evaluators.
9 */
10
11// This file is part of Cantera. See License.txt in the top-level directory or
12// at https://cantera.org/license.txt for license and copyright information.
13
14#ifndef CT_NEWFALLOFF_H
15#define CT_NEWFALLOFF_H
16
18#include "cantera/kinetics/Falloff.h"
19
20namespace Cantera
21{
22
23/**
24 * Factory class to construct falloff function calculators.
25 * The falloff factory is accessed through static method factory:
26 *
27 * @code
28 * Falloff* f = FalloffFactory::factory()->newFalloff(type, c)
29 * @endcode
30 *
31 * @ingroup falloffGroup
32 *
33 * @deprecated Deprecated in Cantera 2.6 and removed thereafter. Replaced by
34 * FalloffRate objects managed by MultiRate evaluators.
35 */
36class FalloffFactory : public Factory<Falloff>
37{
38public:
39 /**
40 * Return a pointer to the factory. On the first call, a new instance is
41 * created. Since there is no need to instantiate more than one factory,
42 * on all subsequent calls, a pointer to the existing factory is returned.
43 */
45 std::unique_lock<std::mutex> lock(falloff_mutex);
46 if (!s_factory) {
48 }
49 return s_factory;
50 }
51
52 virtual void deleteFactory() {
53 std::unique_lock<std::mutex> lock(falloff_mutex);
54 delete s_factory;
55 s_factory = 0;
56 }
57
58 //! Return a pointer to a new falloff function calculator.
59 /*!
60 * @param type String identifier specifying the type of falloff function.
61 * The standard types match class names defined in Falloff.h.
62 * A factory class derived from FalloffFactory may define
63 * other types as well.
64 * @param c input vector of doubles which populates the falloff
65 * parameterization.
66 * @returns a pointer to a new Falloff class.
67 */
68 virtual Falloff* newFalloff(const std::string& type, const vector_fp& c);
69
70private:
71 //! Pointer to the single instance of the factory
73
74 //! default constructor, which is defined as private
76
77 //! Mutex for use when calling the factory
78 static std::mutex falloff_mutex;
79};
80
81//! @copydoc FalloffFactory::newFalloff
82shared_ptr<Falloff> newFalloff(const std::string& type, const vector_fp& c);
83
84}
85#endif
File contains the FactoryBase class declarations.
Factory class that supports registering functions to create objects.
Definition: FactoryBase.h:70
Factory class to construct falloff function calculators.
virtual Falloff * newFalloff(const std::string &type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
static FalloffFactory * s_factory
Pointer to the single instance of the factory.
static std::mutex falloff_mutex
Mutex for use when calling the factory.
FalloffFactory()
default constructor, which is defined as private
virtual void deleteFactory()
Virtual abstract function that deletes the factory.
static FalloffFactory * factory()
Return a pointer to the factory.
Base class for falloff rate calculators.
Definition: Falloff.h:79
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
shared_ptr< Falloff > newFalloff(const std::string &type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184