Cantera
2.3.0
|
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 | 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... | |
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.
Referenced by FuncEval::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().
Definition at line 12 of file FuncEval.cpp.
References FuncEval::eval(), CanteraError::getMessage(), FuncEval::m_errors, FuncEval::m_sens_params, FuncEval::suppressErrors(), CanteraError::what(), Cantera::writelog(), and Cantera::writelogendl().
Referenced by Cantera::cvodes_rhs().
|
inlinevirtual |
Fill the solution vector with the initial conditions at initial time t0.
Reimplemented in ReactorNet, and ImplicitSurfChem.
Definition at line 57 of file FuncEval.h.
References FuncEval::getState(), and Cantera::warn_deprecated().
|
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().
|
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 72 of file FuncEval.h.
References FuncEval::m_sens_params.
|
inline |
Enable or disable suppression of errors when calling eval()
Definition at line 77 of file FuncEval.h.
|
inline |
Get current state of error suppression.
Definition at line 82 of file FuncEval.h.
Referenced by FuncEval::eval_nothrow(), and ReactorNet::setVerbose().
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().
|
inline |
Clear any previously-stored suppressed errors.
Definition at line 90 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 92 of file FuncEval.h.
Referenced by FuncEval::eval_nothrow(), FuncEval::nparams(), and ReactorNet::nparams().
vector_fp m_paramScales |
Scaling factors for each sensitivity parameter.
Definition at line 100 of file FuncEval.h.
|
protected |
Errors occuring during function evaluations.
Definition at line 107 of file FuncEval.h.
Referenced by FuncEval::clearErrors(), FuncEval::eval_nothrow(), and FuncEval::getErrors().