Class for managing user-defined Cantera extensions written in Python. More...
#include <PythonExtensionManager.h>
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.
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< ExternalHandle > | wrapSolution (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. | |
|
overridevirtual |
Register ReactionRate defined in a user extension with ReactionRateFactory.
extensionName |
Reimplemented from ExtensionManager.
|
overridevirtual |
Register a user-defined ReactionRate implementation with ReactionRateFactory.
extensionName | The name of the library/module containing the user-defined rate. For example, the module name for rates implemented in Python. |
className | The name of the rate in the user's code. For example, the Python class name |
rateName | The name used to construct a rate of this type using the newReactionRate() function or from a YAML input file |
Reimplemented from ExtensionManager.
|
overridevirtual |
Register a user-defined ReactionData implementation.
extensionName | The name of the library/module containing the user-defined type. For example, the module name for rates implemented in Python. |
className | The name of the data object in the user's code. For example, the Python class name |
rateName | The name of the corresponding reaction rate type |
Reimplemented from ExtensionManager.