| Cantera 3.0.0

Loading...
Searching...
No Matches
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 "Transport.h"
15#include "cantera/base/FactoryBase.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 */
45 static TransportFactory* factory();
46
47 //! Deletes the statically allocated factory instance.
48 void deleteFactory() override;
49
50 //! Build a new transport manager using a transport manager
51 //! that may not be the same as in the phase description
52 //! and return a base class pointer to it
53 /*!
54 * @param model String name for the transport manager
55 * @param thermo ThermoPhase object
56 * @param log_level log level
57 */
58 Transport* newTransport(const string& model, ThermoPhase* thermo, int log_level=0);
59
60 //! Build a new transport manager using the default transport manager
61 //! in the phase description and return a base class pointer to it
62 /*!
63 * @param thermo ThermoPhase object
64 * @param log_level log level
65 */
66 Transport* newTransport(ThermoPhase* thermo, int log_level=0);
67
68 private:
69 //! Static instance of the factor -> This is the only instance of this
70 //! object allowed
71 static TransportFactory* s_factory;
72
73 //! Static instance of the mutex used to ensure the proper reading of the
74 //! transport database
75 static std::mutex transport_mutex;
76
77 //! The constructor is private; use static method factory() to
78 //! get a pointer to a factory instance
79 /*!
80 * The default constructor for this class sets up m_models[], a mapping
81 * between the string name for a transport model and the integer name.
82 */
83 TransportFactory();
84
85 //! Models included in this map are initialized in CK compatibility mode
86 map<string, bool> m_CK_mode;
87};
88
89//! @copydoc TransportFactory::newTransport(const string&, ThermoPhase*, int)
90//! @deprecated To be removed after %Cantera 3.0; superseded by newTransport()
91 Transport* newTransportMgr(const string& model="", ThermoPhase* thermo=0,
92 int log_level=0);
93
94//! Create a new Transport instance.
95/*!
96 * @param thermo the ThermoPhase object associated with the phase
97 * @param model name of transport model; if "default", the default
98 * transport model for the ThermoPhase object is created
99 * @returns a Transport object for the phase
100 * @ingroup tranprops
101 */
102shared_ptr<Transport> newTransport(shared_ptr<ThermoPhase> thermo,
103 const string& model="default");
104
105//! @copydoc newTransport(shared_ptr<ThermoPhase>, const string&)
106//! @deprecated To be removed after %Cantera 3.0; superseded by newTransport()
107 shared_ptr<Transport> newTransport(ThermoPhase* thermo, const string& model="default");
108
109//! Create a new transport manager instance.
110/*!
111 * @param thermo ThermoPhase object associated with the phase
112 * @param loglevel int containing the Loglevel, defaults to zero
113 * @returns a transport manager for the phase
114 * @deprecated To be removed after %Cantera 3.0; superseded by newTransport()
115 * @ingroup tranprops
116 */
117 Transport* newDefaultTransportMgr(ThermoPhase* thermo, int loglevel = 0);
118
119} // End of namespace Cantera
120
121#endif
FactoryBase.h
File contains the FactoryBase class declarations.
Transport.h
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
Cantera::Factory
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition ThermoPhase.h:390
Cantera::TransportFactory
Factory class for creating new instances of classes derived from Transport.
Definition TransportFactory.h:31
Cantera::TransportFactory::s_factory
static TransportFactory * s_factory
Static instance of the factor -> This is the only instance of this object allowed.
Definition TransportFactory.h:71
Cantera::TransportFactory::deleteFactory
void deleteFactory() override
Deletes the statically allocated factory instance.
Definition TransportFactory.cpp:61
Cantera::TransportFactory::factory
static TransportFactory * factory()
Return a pointer to a TransportFactory instance.
Definition TransportFactory.cpp:53
Cantera::TransportFactory::transport_mutex
static std::mutex transport_mutex
Static instance of the mutex used to ensure the proper reading of the transport database.
Definition TransportFactory.h:75
Cantera::TransportFactory::m_CK_mode
map< string, bool > m_CK_mode
Models included in this map are initialized in CK compatibility mode.
Definition TransportFactory.h:86
Cantera::TransportFactory::TransportFactory
TransportFactory()
The constructor is private; use static method factory() to get a pointer to a factory instance.
Definition TransportFactory.cpp:27
Cantera::TransportFactory::newTransport
Transport * newTransport(const string &model, ThermoPhase *thermo, int log_level=0)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...
Definition TransportFactory.cpp:68
Cantera::Transport
Base class for transport property managers.
Definition Transport.h:146
Cantera::newTransport
shared_ptr< Transport > newTransport(shared_ptr< ThermoPhase > thermo, const string &model)
Create a new Transport instance.
Definition TransportFactory.cpp:117
Cantera::newDefaultTransportMgr
Transport * newDefaultTransportMgr(ThermoPhase *thermo, int loglevel)
Create a new transport manager instance.
Definition TransportFactory.cpp:142
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::newTransportMgr
Transport * newTransportMgr(const string &model, ThermoPhase *thermo, int log_level)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...
Definition TransportFactory.cpp:109