Cantera  2.5.1
TransportFactory.h
Go to the documentation of this file.
1 /**
2  * @file TransportFactory.h
3  * Header file defining class TransportFactory
4  * (see \link Cantera::TransportFactory TransportFactory\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_TRANSPORTFACTORY_H
11 #define CT_TRANSPORTFACTORY_H
12 
13 // Cantera includes
14 #include "TransportBase.h"
16 
17 namespace Cantera
18 {
19 
20 //! Factory class for creating new instances of classes derived from Transport.
21 /*!
22  * Creates 'transport managers', which are classes derived from class
23  * Transport that provide transport properties. TransportFactory handles all
24  * initialization required, including evaluation of collision integrals and
25  * generating polynomial fits. Transport managers can also be created in
26  * other ways.
27  *
28  * @ingroup tranprops
29  */
30 class TransportFactory : public Factory<Transport>
31 {
32 public:
33  //! Return a pointer to a TransportFactory instance.
34  /*!
35  * TransportFactory is implemented as a 'singleton', which means that at
36  * most one instance may be created. The constructor is private. When a
37  * TransportFactory instance is required, call static method factory() to
38  * return a pointer to the TransportFactory instance.
39  *
40  * @code
41  * TransportFactory* f;
42  * f = TransportFactory::factory();
43  * @endcode
44  */
46  std::unique_lock<std::mutex> transportLock(transport_mutex);
47  if (!s_factory) {
49  }
50  return s_factory;
51  }
52 
53  //! Deletes the statically allocated factory instance.
54  virtual void deleteFactory();
55 
56  //! Build a new transport manager using a transport manager
57  //! that may not be the same as in the phase description
58  //! and return a base class pointer to it
59  /*!
60  * @param model String name for the transport manager
61  * @param thermo ThermoPhase object
62  * @param log_level log level
63  * @param ndim Number of dimensions for fluxes
64  *
65  * @deprecated The `ndim` parameter is unused and will be removed after
66  * Cantera 2.5.
67  */
68  virtual Transport* newTransport(const std::string& model, thermo_t* thermo, int log_level=0, int ndim=-99);
69 
70  //! Build a new transport manager using the default transport manager
71  //! in the phase description and return a base class pointer to it
72  /*!
73  * @param thermo ThermoPhase object
74  * @param log_level log level
75  */
76  virtual Transport* newTransport(thermo_t* thermo, int log_level=0);
77 
78 private:
79  //! Static instance of the factor -> This is the only instance of this
80  //! object allowed
82 
83  //! Static instance of the mutex used to ensure the proper reading of the
84  //! transport database
85  static std::mutex transport_mutex;
86 
87  //! The constructor is private; use static method factory() to
88  //! get a pointer to a factory instance
89  /*!
90  * The default constructor for this class sets up m_models[], a mapping
91  * between the string name for a transport model and the integer name.
92  */
94 
95  //! Models included in this map are initialized in CK compatibility mode
96  std::map<std::string, bool> m_CK_mode;
97 };
98 
99 //! @copydoc TransportFactory::newTransport(const std::string&, thermo_t*, int, int)
100 Transport* newTransportMgr(const std::string& transportModel = "",
101  thermo_t* thermo = 0, int loglevel = 0, int ndim=-99);
102 
103 //! Create a new transport manager instance.
104 /*!
105  * @param thermo ThermoPhase object associated with the phase
106  * @param loglevel int containing the Loglevel, defaults to zero
107  * @returns a transport manager for the phase
108  * @ingroup tranprops
109  */
110 Transport* newDefaultTransportMgr(thermo_t* thermo, int loglevel = 0);
111 
112 } // End of namespace Cantera
113 
114 #endif
File contains the FactoryBase class declarations.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
Factory class that supports registering functions to create objects.
Definition: FactoryBase.h:71
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Factory class for creating new instances of classes derived from Transport.
virtual Transport * newTransport(const std::string &model, thermo_t *thermo, int log_level=0, int ndim=-99)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...
static TransportFactory * s_factory
Static instance of the factor -> This is the only instance of this object allowed.
virtual void deleteFactory()
Deletes the statically allocated factory instance.
std::map< std::string, bool > m_CK_mode
Models included in this map are initialized in CK compatibility mode.
static std::mutex transport_mutex
Static instance of the mutex used to ensure the proper reading of the transport database.
TransportFactory()
The constructor is private; use static method factory() to get a pointer to a factory instance.
static TransportFactory * factory()
Return a pointer to a TransportFactory instance.
Base class for transport property managers.
Transport * newDefaultTransportMgr(thermo_t *thermo, int loglevel)
Create a new transport manager instance.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
Transport * newTransportMgr(const std::string &transportModel, thermo_t *thermo, int loglevel, int ndim)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...