Cantera  3.0.0
Loading...
Searching...
No Matches

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

#include <ReactionRateDelegator.h>

Inheritance diagram for ReactionRateDelegator:
[legend]

Detailed Description

Delegate methods of the ReactionRate class to external functions.

Since
New in Cantera 3.0

Definition at line 68 of file ReactionRateDelegator.h.

Public Member Functions

unique_ptr< MultiRateBasenewMultiRate () const override
 Create a rate evaluator for reactions of a particular derived type.
 
void setType (const string &type)
 Set the reaction type based on the user-provided reaction rate parameterization.
 
const string type () const override
 String identifying reaction rate specialization.
 
double evalFromStruct (const ReactionDataDelegator &shared_data)
 Evaluate reaction rate.
 
void setParameters (const AnyMap &node, const UnitStack &units) override
 Set parameters.
 
void getParameters (AnyMap &node) const override
 Get parameters.
 
void validate (const string &equation, const Kinetics &kin) override
 Validate the reaction rate expression.
 
- 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(std::array< size_t, 1 >, double *)> &func, const string &when)
 Set delegates for member functions with the signature void(double*)
 
void setDelegate (const string &name, const function< void(std::array< size_t, 1 >, double, double *)> &func, const string &when)
 Set delegates for member functions with the signature void(double, double*)
 
void setDelegate (const string &name, const function< void(std::array< size_t, 2 >, double, double *, double *)> &func, const string &when)
 Set delegates for member functions with the signature void(double, double*, double*)
 
void setDelegate (const string &name, const function< void(std::array< size_t, 3 >, double *, double *, double *)> &func, const string &when)
 Set delegates for member functions with the signature void(double*, double*, 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 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.
 
- Public Member Functions inherited from ReactionRate
 ReactionRate (const ReactionRate &other)
 
ReactionRateoperator= (const ReactionRate &other)
 
virtual unique_ptr< MultiRateBasenewMultiRate () const
 Create a rate evaluator for reactions of a particular derived type.
 
virtual const string type () const =0
 String identifying reaction rate specialization.
 
virtual const string subType () const
 String identifying sub-type of reaction rate specialization.
 
virtual void setParameters (const AnyMap &node, const UnitStack &units)
 Set parameters.
 
AnyMap parameters () const
 Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function.
 
const UnitsconversionUnits () const
 Get the units for converting the leading term in the reaction rate expression.
 
virtual void setRateUnits (const UnitStack &rate_units)
 Set the units of the reaction rate expression.
 
virtual void check (const string &equation)
 Check basic syntax and settings of reaction rate expression.
 
void check (const string &equation, const AnyMap &node)
 Check basic syntax and settings of reaction rate expression.
 
virtual void validate (const string &equation, const Kinetics &kin)
 Validate the reaction rate expression.
 
virtual void validate (const string &equation)
 Validate the reaction rate expression (legacy call)
 
size_t rateIndex () const
 Reaction rate index within kinetics evaluator.
 
void setRateIndex (size_t idx)
 Set reaction rate index within kinetics evaluator.
 
virtual void setContext (const Reaction &rxn, const Kinetics &kin)
 Set context of reaction rate evaluation.
 
double eval (double T)
 Evaluate reaction rate based on temperature.
 
double eval (double T, double extra)
 Evaluate reaction rate based on temperature and an extra parameter.
 
double eval (double T, const vector< double > &extra)
 Evaluate reaction rate based on temperature and an extra vector parameter.
 
bool valid () const
 Get flag indicating whether reaction rate is set up correctly.
 
bool compositionDependent ()
 Boolean indicating whether rate has compositional dependence.
 
void setCompositionDependence (bool comp_dep)
 Set rate compositional dependence.
 

Private Attributes

string m_rateType
 The name of the reaction rate type.
 
function< double(void *)> m_evalFromStruct
 Delegated evalFromStruct method taking a pointer to the corresponding ReactionData wrapper object.
 
function< void(const string &, void *)> m_validate
 
function< void(const AnyMap &, const UnitStack &)> m_setParameters
 
function< void(AnyMap &)> m_getParameters
 

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(std::array< size_t, 1 >, double *)> &target, const function< void(std::array< size_t, 1 >, double *)> &func)
 Install a function with the signature void(double*) as being delegatable.
 
void install (const string &name, function< void(std::array< size_t, 1 >, double, double *)> &target, const function< void(std::array< size_t, 1 >, double, double *)> &func)
 Install a function with the signature void(double, double*) as being delegatable.
 
void install (const string &name, function< void(std::array< size_t, 2 >, double, double *, double *)> &target, const function< void(std::array< size_t, 2 >, double, double *, double *)> &func)
 Install a function with the signature void(double, double*, double*) as being delegatable.
 
void install (const string &name, function< void(std::array< size_t, 3 >, double *, double *, double *)> &target, const function< void(std::array< size_t, 3 >, double *, double *, double *)> &base)
 Install a function with the signature void(double*, double*, 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.
 
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.
 
virtual void getParameters (AnyMap &node) const
 Get parameters.
 
- 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(std::array< size_t, 1 >, double *)> * > m_funcs_v_dp
 
map< string, function< void(std::array< size_t, 1 >, double, double *)> * > m_funcs_v_d_dp
 
map< string, function< void(std::array< size_t, 2 >, double, double *, double *)> * > m_funcs_v_d_dp_dp
 
map< string, function< void(std::array< size_t, 3 >, double *, double *, double *)> * > m_funcs_v_dp_dp_dp
 
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
 
- Protected Attributes inherited from ReactionRate
AnyMap m_input
 Input data used for specific models.
 
size_t m_rate_index = npos
 Index of reaction rate within kinetics evaluator.
 
bool m_valid = false
 Flag indicating whether reaction rate is set up correctly.
 
bool m_composition_dependent_rate = false
 Flag indicating composition dependent rate.
 
Units m_conversion_units {0.}
 Units of the leading term in the reaction rate expression.
 

Constructor & Destructor Documentation

◆ ReactionRateDelegator()

Definition at line 43 of file ReactionRateDelegator.cpp.

Member Function Documentation

◆ newMultiRate()

unique_ptr< MultiRateBase > newMultiRate ( ) const
overridevirtual

Create a rate evaluator for reactions of a particular derived type.

Derived classes usually implement this as:

unique_ptr<MultiRateBase> newMultiRate() const override {
return make_unique<MultiRate<RateType, DataType>>();
unique_ptr< MultiRateBase > newMultiRate() const override
Create a rate evaluator for reactions of a particular derived type.

where RateType is the derived class name and DataType is the corresponding container for parameters needed to evaluate reactions of that type.

Reimplemented from ReactionRate.

Definition at line 61 of file ReactionRateDelegator.cpp.

◆ setType()

void setType ( const string &  type)
inline

Set the reaction type based on the user-provided reaction rate parameterization.

Definition at line 76 of file ReactionRateDelegator.h.

◆ type()

const string type ( ) const
inlineoverridevirtual

String identifying reaction rate specialization.

Implements ReactionRate.

Definition at line 80 of file ReactionRateDelegator.h.

◆ evalFromStruct()

double evalFromStruct ( const ReactionDataDelegator shared_data)
inline

Evaluate reaction rate.

Parameters
shared_datadata shared by all reactions of a given type

Definition at line 89 of file ReactionRateDelegator.h.

◆ setParameters()

void setParameters ( const AnyMap node,
const UnitStack units 
)
inlineoverridevirtual

Set parameters.

Parameters
nodeAnyMap object containing reaction rate specification
unitsunit definitions specific to rate information

Reimplemented from ReactionRate.

Definition at line 93 of file ReactionRateDelegator.h.

◆ getParameters()

void getParameters ( AnyMap node) const
inlineoverridevirtual

Get parameters.

Parameters
nodeAnyMap containing rate information Store the parameters of a ReactionRate needed to reconstruct an identical object. Does not include user-defined fields available in the m_input map.

Reimplemented from ReactionRate.

Definition at line 97 of file ReactionRateDelegator.h.

◆ validate()

void validate ( const string &  equation,
const Kinetics kin 
)
overridevirtual

Validate the reaction rate expression.

Reimplemented from ReactionRate.

Definition at line 70 of file ReactionRateDelegator.cpp.

Member Data Documentation

◆ m_rateType

string m_rateType
private

The name of the reaction rate type.

Definition at line 105 of file ReactionRateDelegator.h.

◆ m_evalFromStruct

function<double(void*)> m_evalFromStruct
private

Delegated evalFromStruct method taking a pointer to the corresponding ReactionData wrapper object.

Definition at line 109 of file ReactionRateDelegator.h.

◆ m_validate

function<void(const string&, void*)> m_validate
private

Definition at line 111 of file ReactionRateDelegator.h.

◆ m_setParameters

function<void(const AnyMap&, const UnitStack&)> m_setParameters
private

Definition at line 112 of file ReactionRateDelegator.h.

◆ m_getParameters

function<void(AnyMap&)> m_getParameters
private

Definition at line 113 of file ReactionRateDelegator.h.


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