Cantera  2.3.0
FuncEval Class Referenceabstract

Virtual base class for ODE right-hand-side function evaluators. More...

#include <FuncEval.h>

Inheritance diagram for FuncEval:
[legend]

Public Member Functions

virtual void eval (double t, double *y, double *ydot, double *p)=0
Evaluate the right-hand-side function. More...

int eval_nothrow (double t, double *y, double *ydot)
Evaluate the right-hand side using return code to indicate status. More...

virtual void getInitialConditions (double t0, size_t leny, double *y)
Fill the solution vector with the initial conditions at initial time t0. More...

virtual void getState (double *y)
Fill in the vector y with the current state of the system. More...

virtual size_t neq ()=0
Number of equations. More...

virtual size_t nparams ()
Number of sensitivity parameters. More...

void suppressErrors (bool suppress)
Enable or disable suppression of errors when calling eval() More...

bool suppressErrors () const
Get current state of error suppression. More...

std::string getErrors () const
Return a string containing the text of any suppressed errors. More...

void clearErrors ()
Clear any previously-stored suppressed errors. More...

Public Attributes

vector_fp m_sens_params
Values for the problem parameters for which sensitivities are computed This is the array which is perturbed and passed back as the fourth argument to eval(). More...

vector_fp m_paramScales
Scaling factors for each sensitivity parameter. More...

Protected Attributes

bool m_suppress_errors

std::vector< std::string > m_errors
Errors occuring during function evaluations. More...

Detailed Description

Virtual base class for ODE right-hand-side function evaluators.

Classes derived from FuncEval evaluate the right-hand-side function $$\vec{F}(t,\vec{y})$$ in

$\dot{\vec{y}} = \vec{F}(t,\vec{y}).$

Definition at line 26 of file FuncEval.h.

◆ eval()

 virtual void eval ( double t, double * y, double * ydot, double * p )
pure virtual

Evaluate the right-hand-side function.

Called by the integrator.

Parameters
 [in] t time. [in] y solution vector, length neq() [out] ydot rate of change of solution vector, length neq() [in] p sensitivity parameter vector, length nparams()

Implemented in ReactorNet, and ImplicitSurfChem.

Referenced by FuncEval::eval_nothrow().

◆ eval_nothrow()

 int eval_nothrow ( double t, double * y, double * ydot )

Evaluate the right-hand side using return code to indicate status.

Errors are indicated using the return value, rather than by throwing exceptions. This method is used when calling from a C-based integrator such as CVODES. Exceptions may either be stored or printed, based on the setting of suppressErrors().

Returns
0 for a successful evaluation; 1 after a potentially- recoverable error; -1 after an unrecoverable error.

Definition at line 12 of file FuncEval.cpp.

Referenced by Cantera::cvodes_rhs().

◆ getInitialConditions()

 virtual void getInitialConditions ( double t0, size_t leny, double * y )
inlinevirtual

Fill the solution vector with the initial conditions at initial time t0.

Deprecated:
Use getState() instead. To be removed after Cantera 2.3.

Reimplemented in ReactorNet, and ImplicitSurfChem.

Definition at line 57 of file FuncEval.h.

References FuncEval::getState(), and Cantera::warn_deprecated().

◆ getState()

 virtual void getState ( double * y )
inlinevirtual

Fill in the vector y with the current state of the system.

Reimplemented in ReactorNet, and ImplicitSurfChem.

Definition at line 64 of file FuncEval.h.

Referenced by FuncEval::getInitialConditions().

◆ neq()

 virtual size_t neq ( )
pure virtual

Number of equations.

Implemented in ReactorNet, and ImplicitSurfChem.

Referenced by CVodesIntegrator::initialize().

◆ nparams()

 virtual size_t nparams ( )
inlinevirtual

Number of sensitivity parameters.

Reimplemented in ReactorNet.

Definition at line 72 of file FuncEval.h.

References FuncEval::m_sens_params.

◆ suppressErrors() [1/2]

 void suppressErrors ( bool suppress )
inline

Enable or disable suppression of errors when calling eval()

Definition at line 77 of file FuncEval.h.

◆ suppressErrors() [2/2]

 bool suppressErrors ( ) const
inline

Get current state of error suppression.

Definition at line 82 of file FuncEval.h.

Referenced by FuncEval::eval_nothrow(), and ReactorNet::setVerbose().

◆ getErrors()

 std::string getErrors ( ) const

Return a string containing the text of any suppressed errors.

Definition at line 45 of file FuncEval.cpp.

References FuncEval::m_errors.

Referenced by CVodesIntegrator::integrate(), and CVodesIntegrator::step().

◆ clearErrors()

 void clearErrors ( )
inline

Clear any previously-stored suppressed errors.

Definition at line 90 of file FuncEval.h.

References FuncEval::m_errors.

Referenced by CVodesIntegrator::initialize().

◆ m_sens_params

 vector_fp m_sens_params

Values for the problem parameters for which sensitivities are computed This is the array which is perturbed and passed back as the fourth argument to eval().

Definition at line 92 of file FuncEval.h.

Referenced by FuncEval::eval_nothrow(), FuncEval::nparams(), and ReactorNet::nparams().

◆ m_paramScales

 vector_fp m_paramScales

Scaling factors for each sensitivity parameter.

Definition at line 100 of file FuncEval.h.

◆ m_errors

 std::vector m_errors
protected

Errors occuring during function evaluations.

Definition at line 107 of file FuncEval.h.

Referenced by FuncEval::clearErrors(), FuncEval::eval_nothrow(), and FuncEval::getErrors().

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