12MultiJac::MultiJac(OneDim& r)
13 : BandMatrix(r.size(),r.bandwidth(),r.bandwidth())
16 m_points = r.points();
19 m_ssdiag.resize(m_size);
20 m_mask.resize(m_size);
23void MultiJac::updateTransient(
double rdt, integer* mask)
25 for (
size_t n = 0; n < m_size; n++) {
26 value(n,n) = m_ssdiag[n] - mask[n]*rdt;
30void MultiJac::incrementDiagonal(
int j,
double d)
33 value(j,j) = m_ssdiag[j];
36void MultiJac::eval(
double* x0,
double* resid0,
double rdt)
43 for (
size_t j = 0; j < m_points; j++) {
44 size_t nv = m_resid->nVars(j);
45 for (
size_t n = 0; n < nv; n++) {
47 double xsave = x0[ipt];
50 dx = xsave*m_rtol + m_atol;
52 dx = xsave*m_rtol - m_atol;
59 m_resid->eval(j, x0, m_r1.data(), rdt, 0);
62 for (
size_t i = j - 1; i != j+2; i++) {
63 if (i !=
npos && i < m_points) {
64 size_t mv = m_resid->nVars(i);
65 size_t iloc = m_resid->loc(i);
66 for (
size_t m = 0; m < mv; m++) {
67 value(m+iloc,ipt) = (m_r1[m+iloc] - resid0[m+iloc])*rdx;
76 for (
size_t n = 0; n < m_size; n++) {
77 m_ssdiag[n] = value(n,n);
80 m_elapsed += double(clock() - t0)/CLOCKS_PER_SEC;
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"