20 const int c_GE_ZERO = 1;
21 const int c_GT_ZERO = 2;
22 const int c_LE_ZERO = -1;
23 const int c_LT_ZERO = -2;
49 virtual void constrain(
const int k,
const int flag) {
50 m_constrain[k] = flag;
52 int constraint(
const int k)
const {
53 return getValue(m_constrain, k, c_NONE);
68 if ((
int)
m_alg.size() < (k+1)) {
74 virtual bool isAlgebraic(
const int k) {
75 return (
m_alg[k] == 1);
85 virtual int eval(
const doublereal t,
const doublereal*
const y,
86 const doublereal*
const ydot,
87 doublereal*
const r) {
88 throw CanteraError(
"ResidEval::eval()",
"base class called");
91 virtual int evalSS(
const doublereal t,
const doublereal*
const y,
92 doublereal*
const r) {
93 return eval(t, y, 0, r);
96 virtual int evalSimpleTD(
const doublereal t,
const doublereal*
const y,
97 const doublereal*
const yold, doublereal deltaT,
98 doublereal*
const r) {
101 for (
int i = 0; i < nn; i++) {
102 ydot[i] = (y[i] - yold[i]) / deltaT;
120 doublereal*
const ydot) {
122 throw CanteraError(
"ResidEval::GetInitialConditions()",
"base class called");
137 const int time_step_num,
138 const double* y,
const double* ydot) {
140 printf(
"ResidEval::writeSolution\n");
141 printf(
" Time = %g, ievent = %d, deltaT = %g\n", time, ievent, deltaT);
143 printf(
" k y[] ydot[]\n");
145 printf(
"%d %g %g\n", k, y[k], ydot[k]);
150 printf(
"%d %g \n", k, y[k]);
172 std::map<int, int> m_constrain;
virtual void initSizes()
Initialization function.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
virtual void writeSolution(int ievent, const double time, const double deltaT, const int time_step_num, const double *y, const double *ydot)
Write out to a file or to standard output the current solution.
virtual int getInitialConditions(const doublereal t0, doublereal *const y, doublereal *const ydot)
Fill in the initial conditions.
Virtual base class for DAE residual function evaluators.
int nparams() const
Return the number of parameters in the calculation.
Base class for exceptions thrown by Cantera classes.
const U & getValue(const std::map< T, U > &m, const T &key)
Const accessor for a value in a std::map.
virtual int nEquations() const =0
Return the number of equations in the equation system.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual void constrain(const int k, const int flag)
Constrain solution component k.
virtual void setAlgebraic(const int k)
Specify that solution component k is purely algebraic - that is, the derivative of this component doe...
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual int eval(const doublereal t, const doublereal *const y, const doublereal *const ydot, doublereal *const r)
Evaluate the residual function.
std::vector< int > m_alg
Mapping vector that stores whether a degree of freedom is a DAE or not.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...