Cantera  2.5.1
Public Member Functions | Public Attributes | Protected Attributes | List of all members
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 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.

Member Function Documentation

◆ 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]ttime.
[in]ysolution vector, length neq()
[out]ydotrate of change of solution vector, length neq()
[in]psensitivity parameter vector, length nparams()

Implemented in ReactorNet, and ImplicitSurfChem.

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

References CanteraError::what(), Cantera::writelog(), and Cantera::writelogendl().

Referenced by Cantera::cvodes_rhs().

◆ 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 53 of file FuncEval.h.

◆ 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 61 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 66 of file FuncEval.h.

◆ suppressErrors() [2/2]

bool suppressErrors ( ) const
inline

Get current state of error suppression.

Definition at line 71 of file FuncEval.h.

Referenced by 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.

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

◆ clearErrors()

void clearErrors ( )
inline

Clear any previously-stored suppressed errors.

Definition at line 79 of file FuncEval.h.

References FuncEval::m_errors.

Referenced by CVodesIntegrator::initialize().

Member Data Documentation

◆ 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 86 of file FuncEval.h.

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

◆ m_paramScales

vector_fp m_paramScales

Scaling factors for each sensitivity parameter.

Definition at line 89 of file FuncEval.h.

◆ m_errors

std::vector<std::string> m_errors
protected

Errors occuring during function evaluations.

Definition at line 96 of file FuncEval.h.

Referenced by FuncEval::clearErrors().


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