Cantera  2.5.1
FalloffFactory.cpp
Go to the documentation of this file.
1 /**
2  * @file FalloffFactory.cpp
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 
10 
11 namespace Cantera
12 {
13 
14 FalloffFactory* FalloffFactory::s_factory = 0;
16 
18 {
19  reg("Lindemann", []() { return new Falloff(); });
20  addAlias("Lindemann", "Simple");
21  reg("Troe", []() { return new Troe(); });
22  reg("SRI", []() { return new SRI(); });
23 }
24 
26 {
27  warn_deprecated("FalloffFactory::newFalloff",
28  "Instantiation using magic numbers is deprecated; use string "
29  "identifier instead. To be removed after Cantera 2.5.");
30  static const std::unordered_map<int, std::string> types {
31  {SIMPLE_FALLOFF, "Simple"},
32  {TROE_FALLOFF, "Troe"},
33  {SRI_FALLOFF, "SRI"}
34  };
35 
36  Falloff* f = create(types.at(type));
37  f->init(c);
38  return f;
39 }
40 
41 Falloff* FalloffFactory::newFalloff(const std::string& type, const vector_fp& c)
42 {
43  Falloff* f = create(type);
44  f->init(c);
45  return f;
46 }
47 
48 shared_ptr<Falloff> newFalloff(int type, const vector_fp& c)
49 {
50  shared_ptr<Falloff> f(FalloffFactory::factory()->newFalloff(type, c));
51  return f;
52 }
53 
54 shared_ptr<Falloff> newFalloff(const std::string& type, const vector_fp& c)
55 {
56  shared_ptr<Falloff> f(FalloffFactory::factory()->newFalloff(type, c));
57  return f;
58 }
59 
60 }
Cantera::Troe
The 3- or 4-parameter Troe falloff parameterization.
Definition: Falloff.h:133
Cantera::newFalloff
shared_ptr< Falloff > newFalloff(int type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
Definition: FalloffFactory.cpp:48
Cantera::warn_deprecated
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
Cantera::FalloffFactory::falloff_mutex
static std::mutex falloff_mutex
Mutex for use when calling the factory.
Definition: FalloffFactory.h:86
Cantera::Factory< Falloff >::addAlias
void addAlias(const std::string &original, const std::string &alias)
Add an alias for an existing registered type.
Definition: FactoryBase.h:87
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:180
Cantera::Factory< Falloff >::create
Falloff * create(const std::string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
Definition: FactoryBase.h:77
reaction_defs.h
Cantera::FalloffFactory::FalloffFactory
FalloffFactory()
default constructor, which is defined as private
Definition: FalloffFactory.cpp:17
Cantera::Factory< Falloff >::reg
void reg(const std::string &name, std::function< Falloff *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:82
Cantera::FalloffFactory::s_factory
static FalloffFactory * s_factory
Pointer to the single instance of the factory.
Definition: FalloffFactory.h:80
Cantera::FalloffFactory::factory
static FalloffFactory * factory()
Return a pointer to the factory.
Definition: FalloffFactory.h:38
Cantera::FalloffFactory::newFalloff
virtual Falloff * newFalloff(int type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
Definition: FalloffFactory.cpp:25
FalloffFactory.h
Cantera::Falloff
Base class for falloff function calculators.
Definition: Falloff.h:29
Cantera::Falloff::init
virtual void init(const vector_fp &c)
Initialize.
Definition: Falloff.cpp:17
Cantera::SRI
The SRI falloff function.
Definition: Falloff.h:212
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:263