| Cantera 3.0.0

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
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.
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 | 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.

## Static Protected Attributes
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()

virtual void registerRateBuilders | ( | const string & | extensionName | ) |
| inline virtual

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
| ) |  |
| inline virtual

Register a user-defined ReactionRate implementation with ReactionRateFactory.

Parameters

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

Definition at line 53 of file ExtensionManager.h.

## ◆ registerRateDataBuilder()

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

Register a user-defined ReactionData implementation.

Parameters

  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 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

  rateName | The name of the reaction rate type, which corresponds to the name used to register the wrapper generator using registerReactionDataLinker
  data | The 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

  wrapperType | A name specifying the wrapper type, which corresponds to the name used to register the wrapper generator using registerSolutionLinker
  soln | The 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

  rateName | The name of the reaction rate type
  wrapperName | The name used for Solution wrappers to be used with this object, corresponding to a type registered with registerSolutionLinker().
  link | Function 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 = {}
| static protected

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 = {}
| static protected

Functions for wrapping and linking Solution objects.

Definition at line 114 of file ExtensionManager.h.

## ◆ s_userTypeToWrapperType

map< string, string > s_userTypeToWrapperType = {}
| static protected

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:

- ExtensionManager.h
- ExtensionManager.cpp