Cantera
2.5.1
|
Virtual base class for ODE right-hand-side function evaluators. More...
#include <FuncEval.h>
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... | |
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.
|
pure virtual |
Evaluate the right-hand-side function.
Called by the integrator.
[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.
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().
Definition at line 12 of file FuncEval.cpp.
References CanteraError::what(), Cantera::writelog(), and Cantera::writelogendl().
Referenced by Cantera::cvodes_rhs().
|
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.
|
pure virtual |
Number of equations.
Implemented in ReactorNet, and ImplicitSurfChem.
Referenced by CVodesIntegrator::initialize().
|
inlinevirtual |
Number of sensitivity parameters.
Reimplemented in ReactorNet.
Definition at line 61 of file FuncEval.h.
References FuncEval::m_sens_params.
|
inline |
Enable or disable suppression of errors when calling eval()
Definition at line 66 of file FuncEval.h.
|
inline |
Get current state of error suppression.
Definition at line 71 of file FuncEval.h.
Referenced by ReactorNet::setVerbose().
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().
|
inline |
Clear any previously-stored suppressed errors.
Definition at line 79 of file FuncEval.h.
References FuncEval::m_errors.
Referenced by CVodesIntegrator::initialize().
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().
vector_fp m_paramScales |
Scaling factors for each sensitivity parameter.
Definition at line 89 of file FuncEval.h.
|
protected |
Errors occuring during function evaluations.
Definition at line 96 of file FuncEval.h.
Referenced by FuncEval::clearErrors().