Cantera 2.6.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members

Factory class for creating new instances of classes derived from Transport. More...

#include <TransportFactory.h>

Inheritance diagram for TransportFactory:
[legend]
Collaboration diagram for TransportFactory:
[legend]

Public Member Functions

virtual void deleteFactory ()
 Deletes the statically allocated factory instance. More...
 
virtual TransportnewTransport (const std::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 description and return a base class pointer to it. More...
 
virtual TransportnewTransport (ThermoPhase *thermo, int log_level=0)
 Build a new transport manager using the default transport manager in the phase description and return a base class pointer to it. More...
 
- Public Member Functions inherited from Factory< Transport >
Transportcreate (const std::string &name, Args... args)
 Create an object using the object construction function corresponding to "name" and the provided constructor arguments. More...
 
void reg (const std::string &name, std::function< Transport *(Args...)> f)
 Register a new object construction function. More...
 
void addAlias (const std::string &original, const std::string &alias)
 Add an alias for an existing registered type. More...
 
std::string canonicalize (const std::string &name)
 Get the canonical name registered for a type. More...
 
bool exists (const std::string &name) const
 Returns true if name is registered with this factory. More...
 
- Public Member Functions inherited from FactoryBase
virtual ~FactoryBase ()
 destructor More...
 

Static Public Member Functions

static TransportFactoryfactory ()
 Return a pointer to a TransportFactory instance. More...
 
- Static Public Member Functions inherited from FactoryBase
static void deleteFactories ()
 static function that deletes all factories in the internal registry maintained in a static variable More...
 

Private Member Functions

 TransportFactory ()
 The constructor is private; use static method factory() to get a pointer to a factory instance. More...
 

Private Attributes

std::map< std::string, bool > m_CK_mode
 Models included in this map are initialized in CK compatibility mode. More...
 

Static Private Attributes

static TransportFactorys_factory = 0
 Static instance of the factor -> This is the only instance of this object allowed. More...
 
static std::mutex transport_mutex
 Static instance of the mutex used to ensure the proper reading of the transport database. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Factory< Transport >
void addDeprecatedAlias (const std::string &original, const std::string &alias)
 Add a deprecated alias for an existing registered type. More...
 
- Protected Member Functions inherited from FactoryBase
 FactoryBase ()
 Constructor. More...
 

Detailed Description

Factory class for creating new instances of classes derived from Transport.

Creates 'transport managers', which are classes derived from class Transport that provide transport properties. TransportFactory handles all initialization required, including evaluation of collision integrals and generating polynomial fits. Transport managers can also be created in other ways.

Definition at line 30 of file TransportFactory.h.

Constructor & Destructor Documentation

◆ TransportFactory()

TransportFactory ( )
private

The constructor is private; use static method factory() to get a pointer to a factory instance.

The default constructor for this class sets up m_models[], a mapping between the string name for a transport model and the integer name.

Definition at line 30 of file TransportFactory.cpp.

References Factory< Transport >::addAlias(), TransportFactory::m_CK_mode, and Factory< Transport >::reg().

Referenced by TransportFactory::factory().

Member Function Documentation

◆ factory()

static TransportFactory * factory ( )
inlinestatic

Return a pointer to a TransportFactory instance.

TransportFactory is implemented as a 'singleton', which means that at most one instance may be created. The constructor is private. When a TransportFactory instance is required, call static method factory() to return a pointer to the TransportFactory instance.

static TransportFactory * factory()
Return a pointer to a TransportFactory instance.
TransportFactory()
The constructor is private; use static method factory() to get a pointer to a factory instance.

Definition at line 45 of file TransportFactory.h.

References TransportFactory::s_factory, TransportFactory::transport_mutex, and TransportFactory::TransportFactory().

Referenced by Cantera::newDefaultTransportMgr(), Cantera::newTransport(), Cantera::newTransportMgr(), and Transport::parameters().

◆ deleteFactory()

void deleteFactory ( )
virtual

Deletes the statically allocated factory instance.

Implements FactoryBase.

Definition at line 56 of file TransportFactory.cpp.

References TransportFactory::s_factory, and TransportFactory::transport_mutex.

◆ newTransport() [1/2]

Transport * newTransport ( const std::string &  model,
ThermoPhase thermo,
int  log_level = 0 
)
virtual

Build a new transport manager using a transport manager that may not be the same as in the phase description and return a base class pointer to it.

Parameters
modelString name for the transport manager
thermoThermoPhase object
log_levellog level

Definition at line 63 of file TransportFactory.cpp.

References Factory< Transport >::canonicalize(), Factory< Transport >::create(), Transport::init(), DustyGasTransport::initialize(), TransportFactory::m_CK_mode, Phase::restoreState(), and Phase::saveState().

Referenced by Cantera::newDefaultTransportMgr(), Cantera::newTransport(), TransportFactory::newTransport(), and Cantera::newTransportMgr().

◆ newTransport() [2/2]

Transport * newTransport ( ThermoPhase thermo,
int  log_level = 0 
)
virtual

Build a new transport manager using the default transport manager in the phase description and return a base class pointer to it.

Parameters
thermoThermoPhase object
log_levellog level

Definition at line 94 of file TransportFactory.cpp.

References XML_Node::attrib(), XML_Node::child(), XML_Node::hasChild(), AnyMap::hasKey(), ThermoPhase::input(), TransportFactory::newTransport(), and Phase::xml().

Member Data Documentation

◆ s_factory

TransportFactory * s_factory = 0
staticprivate

Static instance of the factor -> This is the only instance of this object allowed.

Definition at line 77 of file TransportFactory.h.

Referenced by TransportFactory::deleteFactory(), and TransportFactory::factory().

◆ transport_mutex

std::mutex transport_mutex
staticprivate

Static instance of the mutex used to ensure the proper reading of the transport database.

Definition at line 81 of file TransportFactory.h.

Referenced by TransportFactory::deleteFactory(), and TransportFactory::factory().

◆ m_CK_mode

std::map<std::string, bool> m_CK_mode
private

Models included in this map are initialized in CK compatibility mode.

Definition at line 92 of file TransportFactory.h.

Referenced by TransportFactory::newTransport(), and TransportFactory::TransportFactory().


The documentation for this class was generated from the following files: