Cantera  2.3.0
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 http://www.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("Simple", []() { return new Falloff(); });
20  reg("Troe", []() { return new Troe(); });
21  reg("SRI", []() { return new SRI(); });
22 }
23 
25 {
26  static const std::unordered_map<int, std::string> types {
27  {SIMPLE_FALLOFF, "Simple"},
28  {TROE_FALLOFF, "Troe"},
29  {SRI_FALLOFF, "SRI"}
30  };
31 
32  Falloff* f = create(types.at(type));
33  f->init(c);
34  return f;
35 }
36 
37 shared_ptr<Falloff> newFalloff(int type, const vector_fp& c)
38 {
39  shared_ptr<Falloff> f(FalloffFactory::factory()->newFalloff(type, c));
40  return f;
41 }
42 
43 }
virtual Falloff * newFalloff(int type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
shared_ptr< Falloff > newFalloff(int type, const vector_fp &c)
Return a pointer to a new falloff function calculator.
The SRI falloff function.
Definition: Falloff.h:193
The 3- or 4-parameter Troe falloff parameterization.
Definition: Falloff.h:120
Parameterizations for reaction falloff functions.
static std::mutex falloff_mutex
Mutex for use when calling the factory.
virtual void init(const vector_fp &c)
Initialize.
Definition: Falloff.cpp:16
FalloffFactory()
default constructor, which is defined as private
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:75
static FalloffFactory * factory()
Return a pointer to the factory.
This file defines some constants used to specify reaction types.
static FalloffFactory * s_factory
Pointer to the single instance of the factory.
Base class for falloff function calculators.
Definition: Falloff.h:26
void reg(const std::string &name, std::function< Falloff *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:84
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:157
Namespace for the Cantera kernel.
Definition: application.cpp:29