Go to the documentation of this file.
19 const int c_GE_ZERO = 1;
20 const int c_GT_ZERO = 2;
21 const int c_LE_ZERO = -1;
22 const int c_LT_ZERO = -2;
48 virtual void constrain(
const int k,
const int flag) {
49 m_constrain[k] = flag;
51 int constraint(
const int k)
const {
52 return getValue(m_constrain, k, c_NONE);
66 if ((
int)
m_alg.size() < (k+1)) {
72 virtual bool isAlgebraic(
const int k) {
73 return (
m_alg[k] == 1);
83 virtual int eval(
const doublereal t,
const doublereal*
const y,
84 const doublereal*
const ydot,
85 doublereal*
const r) {
89 virtual int evalSS(
const doublereal t,
const doublereal*
const y,
90 doublereal*
const r) {
91 return eval(t, y, 0, r);
94 virtual int evalSimpleTD(
const doublereal t,
const doublereal*
const y,
95 const doublereal*
const yold, doublereal deltaT,
96 doublereal*
const r) {
99 for (
int i = 0; i < nn; i++) {
100 ydot[i] = (y[i] - yold[i]) / deltaT;
102 return eval(t, y, ydot.data(), r);
118 doublereal*
const ydot) {
134 const int time_step_num,
135 const double* y,
const double* ydot) {
137 writelog(
"ResidEval::writeSolution\n");
138 writelogf(
" Time = %g, ievent = %d, deltaT = %g\n", time, ievent, deltaT);
142 writelogf(
"%d %g %g\n", k, y[k], ydot[k]);
168 std::map<int, int> m_constrain;
Virtual base class for DAE residual function evaluators.
void writelog(const std::string &fmt, const Args &... args)
Write a formatted message to the screen.
virtual int eval(const doublereal t, const doublereal *const y, const doublereal *const ydot, doublereal *const r)
Evaluate the residual function.
An error indicating that an unimplemented function has been called.
virtual int getInitialConditions(const doublereal t0, doublereal *const y, doublereal *const ydot)
Fill in the initial conditions.
virtual int nEquations() const =0
Return the number of equations in the equation system.
virtual void setAlgebraic(const int k)
Specify that solution component k is purely algebraic - that is, the derivative of this component doe...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
vector_int m_alg
Mapping vector that stores whether a degree of freedom is a DAE or not.
virtual void constrain(const int k, const int flag)
Constrain solution component k.
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.
const U & getValue(const std::map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a std::map.
void writelogf(const char *fmt, const Args &... args)
Write a formatted message to the screen.
virtual void initSizes()
Initialization function.
std::vector< int > vector_int
Vector of ints.
int nparams() const
Return the number of parameters in the calculation.
Namespace for the Cantera kernel.