Cantera  3.1.0a1
ExtensionManager Class Reference

Base class for managing user-defined Cantera extensions written in other languages. More...

#include <ExtensionManager.h>

Inheritance diagram for ExtensionManager:
[legend]

Detailed Description

Base class for managing user-defined Cantera extensions written in other languages.

Since
New in Cantera 3.0

Definition at line 35 of file ExtensionManager.h.

Public Member Functions

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

Static Public Member Functions

static void wrapReactionData (const string &rateName, ReactionDataDelegator &data)
 Create an object in an external language that wraps the specified ReactionData object. More...
 
static shared_ptr< ExternalHandlewrapSolution (const string &wrapperType, shared_ptr< Solution > soln)
 Create an object in an external language that wraps the specified Solution object. More...
 
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. More...
 
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. More...
 
static string getSolutionWrapperType (const string &userType)
 Get the Solution wrapper type corresponding to the specified user-defined reaction rate type. More...
 

Static Protected Attributes

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

Member Function Documentation

◆ registerRateBuilders()

virtual void registerRateBuilders ( const string &  extensionName)
inlinevirtual

Register ReactionRate defined in a user extension with ReactionRateFactory.

Parameters
extensionName

Reimplemented in PythonExtensionManager.

Definition at line 42 of file ExtensionManager.h.

◆ registerRateBuilder()

virtual void registerRateBuilder ( const string &  extensionName,
const string &  className,
const string &  rateName 
)
inlinevirtual

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 in PythonExtensionManager.

Definition at line 53 of file ExtensionManager.h.

◆ registerRateDataBuilder()

virtual void registerRateDataBuilder ( const string &  extensionName,
const string &  className,
const string &  rateName 
)
inlinevirtual

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 in PythonExtensionManager.

Definition at line 65 of file ExtensionManager.h.

◆ wrapReactionData()

void wrapReactionData ( const string &  rateName,
ReactionDataDelegator data 
)
static

Create an object in an external language that wraps the specified ReactionData object.

Parameters
rateNameThe name of the reaction rate type, which corresponds to the name used to register the wrapper generator using registerReactionDataLinker
dataThe ReactionData object to be wrapped

Definition at line 16 of file ExtensionManager.cpp.

◆ wrapSolution()

shared_ptr< ExternalHandle > wrapSolution ( const string &  wrapperType,
shared_ptr< Solution soln 
)
static

Create an object in an external language that wraps the specified Solution object.

Parameters
wrapperTypeA name specifying the wrapper type, which corresponds to the name used to register the wrapper generator using registerSolutionLinker
solnThe Solution object to be wrapped

Definition at line 35 of file ExtensionManager.cpp.

◆ registerReactionDataLinker()

void registerReactionDataLinker ( const string &  rateName,
const string &  wrapperName,
function< void(ReactionDataDelegator &)>  link 
)
static

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.

Parameters
rateNameThe name of the reaction rate type
wrapperNameThe name used for Solution wrappers to be used with this object, corresponding to a type registered with registerSolutionLinker().
linkFunction that creates ReactionData wrapper and links it to the provided C++ object

Definition at line 28 of file ExtensionManager.cpp.

◆ registerSolutionLinker()

void registerSolutionLinker ( const string &  wrapperName,
function< shared_ptr< ExternalHandle >(shared_ptr< Solution >)>  link 
)
static

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.

Definition at line 47 of file ExtensionManager.cpp.

◆ getSolutionWrapperType()

string getSolutionWrapperType ( const string &  userType)
static

Get the Solution wrapper type corresponding to the specified user-defined reaction rate type.

Definition at line 53 of file ExtensionManager.cpp.

Member Data Documentation

◆ s_ReactionData_linkers

map< string, function< void(ReactionDataDelegator &)> > s_ReactionData_linkers = {}
staticprotected

Functions for wrapping and linking ReactionData objects.

Definition at line 110 of file ExtensionManager.h.

◆ s_Solution_linkers

map< string, function< shared_ptr< ExternalHandle >shared_ptr< Solution >)> > s_Solution_linkers = {}
staticprotected

Functions for wrapping and linking Solution objects.

Definition at line 114 of file ExtensionManager.h.

◆ s_userTypeToWrapperType

map< string, string > s_userTypeToWrapperType = {}
staticprotected

Mapping from user-defined rate types to Solution wrapper types.

Definition at line 117 of file ExtensionManager.h.


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