Cantera
Loading...
Searching...
No Matches
ReactorDelegator< R > Class Template Reference

Delegate methods of the Reactor class to external functions. More...

#include <ReactorDelegator.h>

Inheritance diagram for ReactorDelegator< R >:
[legend]

Detailed Description

template<class R>
class Cantera::ReactorDelegator< R >

Delegate methods of the Reactor class to external functions.

Definition at line 55 of file ReactorDelegator.h.

Public Member Functions

template<class... Args>
 ReactorDelegator (Args &&... args)
string type () const override
void initialize (double t0) override
void getState (span< double > y) override
void updateState (span< const double > y) override
void updateConnected (bool updatePressure) override
void eval (double t, span< double > LHS, span< double > RHS) override
void evalWalls (double t) override
string componentName (size_t k) override
size_t componentIndex (const string &nm) const override
void getJacobianElements (SparseTriplets &trips) override
void setNEq (size_t n) override
 Set the number of equations represented by this reactor.
double expansionRate () const override
 Get the net rate of volume change (for example, from moving walls) [m^3/s].
void setExpansionRate (double v) override
 Set the net rate of volume change (for example, from moving walls) [m^3/s].
double heatRate () const override
 Get the net heat transfer rate (for example, through walls) into the reactor [W].
void setHeatRate (double q) override
 Set the net heat transfer rate (for example, through walls) into the reactor [W].
span< double > surfaceProductionRates () override
 Production rates on surfaces.
Public Member Functions inherited from Delegator
string delegatorName () const
 Get the name of the user-defined class in the extension language.
void setDelegatorName (const string &delegatorName)
 Set the name of the user-defined class in the extension language.
void setDelegate (const string &name, const function< void()> &func, const string &when)
 Set delegates for member functions with the signature void().
void setDelegate (const string &name, const function< void(bool)> &func, const string &when)
 set delegates for member functions with the signature void(bool)
void setDelegate (const string &name, const function< void(double)> &func, const string &when)
 set delegates for member functions with the signature void(double)
void setDelegate (const string &name, const function< void(AnyMap &)> &func, const string &when)
 set delegates for member functions with the signature void(AnyMap&)
void setDelegate (const string &name, const function< void(const AnyMap &, const UnitStack &)> &func, const string &when)
 set delegates for member functions with the signature void(AnyMap&, UnitStack&)
void setDelegate (const string &name, const function< void(const string &, void *)> &func, const string &when)
 set delegates for member functions with the signature void(const string&, void*)
void setDelegate (const string &name, const function< void(span< double >)> &func, const string &when)
 Set delegates for member functions with the signature void(span<double>).
void setDelegate (const string &name, const function< void(double, span< double >)> &func, const string &when)
 Set delegates for member functions with the signature void(double, span<double>).
void setDelegate (const string &name, const function< void(double, span< double >, span< double >)> &func, const string &when)
 Set delegates for member functions with the signature void(double, span<double>, span<double>).
void setDelegate (const string &name, const function< void(span< double >, span< double >, span< double >)> &func, const string &when)
 Set delegates for member functions with the signature void(span<double>, span<double>, span<double>).
void setDelegate (const string &name, const function< int(double &, void *)> &func, const string &when)
 set delegates for member functions with the signature double(void*)
void setDelegate (const string &name, const function< int(string &, size_t)> &func, const string &when)
 Set delegates for member functions with the signature string(size_t).
void setDelegate (const string &name, const function< int(size_t &, const string &)> &func, const string &when)
 Set delegates for member functions with the signature size_t(string).
void setDelegate (const string &name, const function< void(SparseTriplets &)> &func, const string &when)
 Set delegates for member functions with the signature void(SparseTriplets&).
void holdExternalHandle (const string &name, const shared_ptr< ExternalHandle > &handle)
 Store a handle to a wrapper for the delegate from an external language interface.
shared_ptr< ExternalHandlegetExternalHandle (const string &name) const
 Get the handle for a wrapper for the delegate from the external language interface specified by name.

Private Attributes

function< void(double)> m_initialize
function< void(span< double >)> m_getState
function< void(span< double >)> m_updateState
function< void(bool)> m_updateConnected
function< void(double, span< double >, span< double >)> m_eval
function< void(double)> m_evalWalls
function< string(size_t)> m_componentName
function< size_t(const string &)> m_componentIndex
function< void(SparseTriplets &)> m_getJacobianElements

Additional Inherited Members

Protected Member Functions inherited from Delegator
void install (const string &name, function< void()> &target, const function< void()> &func)
 Install a function with the signature void() as being delegatable.
void install (const string &name, function< void(bool)> &target, const function< void(bool)> &func)
 Install a function with the signature void(bool) as being delegatable.
void install (const string &name, function< void(double)> &target, const function< void(double)> &func)
 Install a function with the signature void(double) as being delegatable.
void install (const string &name, function< void(AnyMap &)> &target, const function< void(AnyMap &)> &func)
 Install a function with the signature void(AnyMap&) as being delegatable.
void install (const string &name, function< void(const AnyMap &, const UnitStack &)> &target, const function< void(const AnyMap &, const UnitStack &)> &func)
 Install a function with the signature void(const AnyMap&, const UnitStack&) as being delegatable.
void install (const string &name, function< void(const string &, void *)> &target, const function< void(const string &, void *)> &func)
 Install a function with the signature void(const string&, void*) as being delegatable.
void install (const string &name, function< void(span< double >)> &target, const function< void(span< double >)> &func)
 Install a function with the signature void(span<double>) as being delegatable.
void install (const string &name, function< void(double, span< double >)> &target, const function< void(double, span< double >)> &func)
 Install a function with the signature void(double, span<double>) as being delegatable.
void install (const string &name, function< void(double, span< double >, span< double >)> &target, const function< void(double, span< double >, span< double >)> &func)
 Install a function with the signature void(double, span<double>, span<double>) as being delegatable.
void install (const string &name, function< void(span< double >, span< double >, span< double >)> &target, const function< void(span< double >, span< double >, span< double >)> &base)
 Install a function with the signature void(span<double>, span<double>, span<double>) as being delegatable.
void install (const string &name, function< double(void *)> &target, const function< double(void *)> &func)
 Install a function with the signature double(void*) as being delegatable.
void install (const string &name, function< string(size_t)> &target, const function< string(size_t)> &base)
 Install a function with the signature string(size_t) as being delegatable.
void install (const string &name, function< size_t(const string &)> &target, const function< size_t(const string &)> &base)
 Install a function with the signature size_t(string) as being delegatable.
void install (const string &name, function< void(SparseTriplets &)> &target, const function< void(SparseTriplets &)> &base)
 Install a function with the signature void(SparseTriplets&) as being delegatable.
template<typename BaseFunc, class ... Args>
function< void(Args ...)> makeDelegate (const function< void(Args ...)> &func, const string &when, BaseFunc base)
 Create a delegate for a function with no return value.
template<typename ReturnType, class ... Args>
function< ReturnType(Args ...)> makeDelegate (const string &name, const function< int(ReturnType &, Args ...)> &func, const string &when, const function< ReturnType(Args ...)> &base)
 Create a delegate for a function with a return value.
span< double > stripConst (const span< const double > &s)
 Helper to remove const for cases where the delegated function signature uses span<const double>.
Protected Attributes inherited from Delegator
map< string, shared_ptr< ExternalHandle > > m_handles
 Handles to wrappers for the delegated object in external language interfaces.
string m_delegatorName
 Name of the class in the extension language.
map< string, function< void()> * > m_funcs_v
map< string, function< void(bool)> * > m_funcs_v_b
map< string, function< void(double)> * > m_funcs_v_d
map< string, function< void(AnyMap &)> * > m_funcs_v_AMr
map< string, function< void(const AnyMap &, const UnitStack &)> * > m_funcs_v_cAMr_cUSr
map< string, function< void(const string &, void *)> * > m_funcs_v_csr_vp
map< string, function< void(span< double >)> * > m_funcs_v_dp
map< string, function< void(double, span< double >)> * > m_funcs_v_d_dp
map< string, function< void(double, span< double >, span< double >)> * > m_funcs_v_d_dp_dp
map< string, function< void(span< double >, span< double >, span< double >)> * > m_funcs_v_dp_dp_dp
map< string, function< void(SparseTriplets &)> * > m_funcs_v_vET
map< string, function< double(void *)> > m_base_d_vp
map< string, function< double(void *)> * > m_funcs_d_vp
map< string, function< string(size_t)> > m_base_s_sz
map< string, function< string(size_t)> * > m_funcs_s_sz
map< string, function< size_t(const string &)> > m_base_sz_csr
map< string, function< size_t(const string &)> * > m_funcs_sz_csr

Constructor & Destructor Documentation

◆ ReactorDelegator()

template<class R>
template<class... Args>
ReactorDelegator ( Args &&... args)
inline

Definition at line 59 of file ReactorDelegator.h.

Member Function Documentation

◆ type()

template<class R>
string type ( ) const
inlineoverride

Definition at line 91 of file ReactorDelegator.h.

◆ initialize()

template<class R>
void initialize ( double t0)
inlineoverride

Definition at line 95 of file ReactorDelegator.h.

◆ getState()

template<class R>
void getState ( span< double > y)
inlineoverride

Definition at line 99 of file ReactorDelegator.h.

◆ updateState()

template<class R>
void updateState ( span< const double > y)
inlineoverride

Definition at line 104 of file ReactorDelegator.h.

◆ updateConnected()

template<class R>
void updateConnected ( bool updatePressure)
inlineoverride

Definition at line 109 of file ReactorDelegator.h.

◆ eval()

template<class R>
void eval ( double t,
span< double > LHS,
span< double > RHS )
inlineoverride

Definition at line 113 of file ReactorDelegator.h.

◆ evalWalls()

template<class R>
void evalWalls ( double t)
inlineoverride

Definition at line 119 of file ReactorDelegator.h.

◆ componentName()

template<class R>
string componentName ( size_t k)
inlineoverride

Definition at line 127 of file ReactorDelegator.h.

◆ componentIndex()

template<class R>
size_t componentIndex ( const string & nm) const
inlineoverride

Definition at line 131 of file ReactorDelegator.h.

◆ getJacobianElements()

template<class R>
void getJacobianElements ( SparseTriplets & trips)
inlineoverride

Definition at line 135 of file ReactorDelegator.h.

◆ setNEq()

template<class R>
void setNEq ( size_t n)
inlineoverridevirtual

Set the number of equations represented by this reactor.

Implements ReactorAccessor.

Definition at line 141 of file ReactorDelegator.h.

◆ expansionRate()

template<class R>
double expansionRate ( ) const
inlineoverridevirtual

Get the net rate of volume change (for example, from moving walls) [m^3/s].

Implements ReactorAccessor.

Definition at line 145 of file ReactorDelegator.h.

◆ setExpansionRate()

template<class R>
void setExpansionRate ( double v)
inlineoverridevirtual

Set the net rate of volume change (for example, from moving walls) [m^3/s].

Implements ReactorAccessor.

Definition at line 154 of file ReactorDelegator.h.

◆ heatRate()

template<class R>
double heatRate ( ) const
inlineoverridevirtual

Get the net heat transfer rate (for example, through walls) into the reactor [W].

This value is initialized and calculated as part of Reactor::evalWalls().

Implements ReactorAccessor.

Definition at line 163 of file ReactorDelegator.h.

◆ setHeatRate()

template<class R>
void setHeatRate ( double q)
inlineoverridevirtual

Set the net heat transfer rate (for example, through walls) into the reactor [W].

For a value set using this method to affect the calculations done by Reactor::eval, this method should be called in either a "replace" or "after" delegate for Reactor::evalWalls().

Implements ReactorAccessor.

Definition at line 172 of file ReactorDelegator.h.

◆ surfaceProductionRates()

template<class R>
span< double > surfaceProductionRates ( )
inlineoverridevirtual

Production rates on surfaces.

For bulk reactors, this contains the total production rates [kmol/s] of bulk phase species due to reactions on all adjacent species.

For surfaces, this contains the production rates [kmol/m²/s] of species on the surface and all adjacent phases, in the order defined by the InterfaceKinetics object.

Implements ReactorAccessor.

Definition at line 181 of file ReactorDelegator.h.

Member Data Documentation

◆ m_initialize

template<class R>
function<void(double)> m_initialize
private

Definition at line 186 of file ReactorDelegator.h.

◆ m_getState

template<class R>
function<void(span<double>)> m_getState
private

Definition at line 187 of file ReactorDelegator.h.

◆ m_updateState

template<class R>
function<void(span<double>)> m_updateState
private

Definition at line 188 of file ReactorDelegator.h.

◆ m_updateConnected

template<class R>
function<void(bool)> m_updateConnected
private

Definition at line 189 of file ReactorDelegator.h.

◆ m_eval

template<class R>
function<void(double, span<double>, span<double>)> m_eval
private

Definition at line 190 of file ReactorDelegator.h.

◆ m_evalWalls

template<class R>
function<void(double)> m_evalWalls
private

Definition at line 191 of file ReactorDelegator.h.

◆ m_componentName

template<class R>
function<string(size_t)> m_componentName
private

Definition at line 192 of file ReactorDelegator.h.

◆ m_componentIndex

template<class R>
function<size_t(const string&)> m_componentIndex
private

Definition at line 193 of file ReactorDelegator.h.

◆ m_getJacobianElements

template<class R>
function<void(SparseTriplets&)> m_getJacobianElements
private

Definition at line 194 of file ReactorDelegator.h.


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