Cantera  3.1.0a1
Loading...
Searching...
No Matches
PythonExtensionManager Class Reference

Class for managing user-defined Cantera extensions written in Python. More...

#include <PythonExtensionManager.h>

Inheritance diagram for PythonExtensionManager:
[legend]

Detailed Description

Class for managing user-defined Cantera extensions written in Python.

Handles Python initialization if the main application is not the Python interpreter.

Imports a user-specified module, which must be on the Python path and registers user-defined classes that are marked with the @extension decorator. See the documentation for @extension in the Python documentation for more information.

Since
New in Cantera 3.0

Definition at line 24 of file PythonExtensionManager.h.

Public Member Functions

void registerRateBuilders (const string &extensionName) override
 Register ReactionRate defined in a user extension with ReactionRateFactory.
 
void registerRateBuilder (const string &moduleName, const string &className, const string &rateName) override
 Register a user-defined ReactionRate implementation with ReactionRateFactory.
 
void registerRateDataBuilder (const string &moduleName, const string &className, const string &rateName) override
 Register a user-defined ReactionData implementation.
 
virtual void registerRateBuilders (const string &extensionName)
 Register ReactionRate defined in a user extension with ReactionRateFactory.
 
virtual void registerRateBuilder (const string &extensionName, const string &className, const string &rateName)
 Register a user-defined ReactionRate implementation with ReactionRateFactory.
 
virtual void registerRateDataBuilder (const string &extensionName, const string &className, const string &rateName)
 Register a user-defined ReactionData implementation.
 

Static Public Member Functions

static void registerSelf ()
 
- Static Public Member Functions inherited from ExtensionManager
static void wrapReactionData (const string &rateName, ReactionDataDelegator &data)
 Create an object in an external language that wraps the specified ReactionData object.
 
static shared_ptr< ExternalHandlewrapSolution (const string &wrapperType, shared_ptr< Solution > soln)
 Create an object in an external language that wraps the specified Solution object.
 
static void registerReactionDataLinker (const string &rateName, const string &wrapperName, function< void(ReactionDataDelegator &)> link)
 Register a function that can be used to create wrappers for ReactionData objects in an external language and link them to the corresponding C++ object.
 
static void registerSolutionLinker (const string &wrapperName, function< shared_ptr< ExternalHandle >(shared_ptr< Solution >)> link)
 Register a function that can be used to create wrappers for Solution objects in an external language and link it to the corresponding C++ objects.
 
static string getSolutionWrapperType (const string &userType)
 Get the Solution wrapper type corresponding to the specified user-defined reaction rate type.
 

Additional Inherited Members

- Static Protected Attributes inherited from ExtensionManager
static map< string, function< void(ReactionDataDelegator &)> > s_ReactionData_linkers = {}
 Functions for wrapping and linking ReactionData objects.
 
static map< string, function< shared_ptr< ExternalHandle >(shared_ptr< Solution >)> > s_Solution_linkers = {}
 Functions for wrapping and linking Solution objects.
 
static map< string, string > s_userTypeToWrapperType = {}
 Mapping from user-defined rate types to Solution wrapper types.
 

Member Function Documentation

◆ registerRateBuilders()

void registerRateBuilders ( const string &  extensionName)
overridevirtual

Register ReactionRate defined in a user extension with ReactionRateFactory.

Parameters
extensionName

Reimplemented from ExtensionManager.

◆ registerRateBuilder()

void registerRateBuilder ( const string &  extensionName,
const string &  className,
const string &  rateName 
)
overridevirtual

Register a user-defined ReactionRate implementation with ReactionRateFactory.

Parameters
extensionNameThe name of the library/module containing the user-defined rate. For example, the module name for rates implemented in Python.
classNameThe name of the rate in the user's code. For example, the Python class name
rateNameThe name used to construct a rate of this type using the newReactionRate() function or from a YAML input file

Reimplemented from ExtensionManager.

◆ registerRateDataBuilder()

void registerRateDataBuilder ( const string &  extensionName,
const string &  className,
const string &  rateName 
)
overridevirtual

Register a user-defined ReactionData implementation.

Parameters
extensionNameThe name of the library/module containing the user-defined type. For example, the module name for rates implemented in Python.
classNameThe name of the data object in the user's code. For example, the Python class name
rateNameThe name of the corresponding reaction rate type

Reimplemented from ExtensionManager.


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