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
17#include "cantera/base/FactoryBase.h"
18#include "cantera/kinetics/Falloff.h"
19
20 namespace 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 */
36 class FalloffFactory : public Factory<Falloff>
37{
38 public:
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 */
44 static FalloffFactory* factory() {
45 std::unique_lock<std::mutex> lock(falloff_mutex);
46 if (!s_factory) {
47 s_factory = new FalloffFactory;
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
70 private:
71 //! Pointer to the single instance of the factory
72 static FalloffFactory* s_factory;
73
74 //! default constructor, which is defined as private
75 FalloffFactory();
76
77 //! Mutex for use when calling the factory
78 static std::mutex falloff_mutex;
79};
80
81//! @copydoc FalloffFactory::newFalloff
82 shared_ptr<Falloff> newFalloff(const std::string& type, const vector_fp& c);
83
84}
85#endif
FactoryBase.h
File contains the FactoryBase class declarations.
Cantera::Factory
Factory class that supports registering functions to create objects.
Definition: FactoryBase.h:70
Cantera::FalloffFactory
Factory class to construct falloff function calculators.
Definition: FalloffFactory.h:37
Cantera::FalloffFactory::newFalloff
virtual Falloff * newFalloff(const std::string &type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
Definition: FalloffFactory.cpp:29
Cantera::FalloffFactory::s_factory
static FalloffFactory * s_factory
Pointer to the single instance of the factory.
Definition: FalloffFactory.h:72
Cantera::FalloffFactory::falloff_mutex
static std::mutex falloff_mutex
Mutex for use when calling the factory.
Definition: FalloffFactory.h:78
Cantera::FalloffFactory::FalloffFactory
FalloffFactory()
default constructor, which is defined as private
Definition: FalloffFactory.cpp:20
Cantera::FalloffFactory::deleteFactory
virtual void deleteFactory()
Virtual abstract function that deletes the factory.
Definition: FalloffFactory.h:52
Cantera::FalloffFactory::factory
static FalloffFactory * factory()
Return a pointer to the factory.
Definition: FalloffFactory.h:44
Cantera::FalloffRate
Base class for falloff rate calculators.
Definition: Falloff.h:79
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::newFalloff
shared_ptr< Falloff > newFalloff(const std::string &type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
Definition: FalloffFactory.cpp:36
Cantera::vector_fp
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