15 MultiJac::MultiJac(OneDim& r)
16 : BandMatrix(r.size(),r.bandwidth(),r.bandwidth())
19 m_points = r.points();
22 m_ssdiag.resize(m_size);
23 m_mask.resize(m_size);
28 while (1.0 + ff != 1.0) {
35 void MultiJac::updateTransient(doublereal rdt, integer* mask)
37 for (
size_t n = 0; n < m_size; n++) {
38 value(n,n) = m_ssdiag[n] - mask[n]*rdt;
42 void MultiJac::incrementDiagonal(
int j, doublereal d)
45 value(j,j) = m_ssdiag[j];
53 size_t n, m, ipt=0, j, nv, mv, iloc;
54 doublereal rdx, dx, xsave;
56 for (j = 0; j < m_points; j++) {
58 for (n = 0; n < nv; n++) {
62 dx = m_atol + fabs(xsave)*m_rtol;
71 for (
size_t i = j - 1; i != j+2; i++) {
72 if (i !=
npos && i < m_points) {
75 for (m = 0; m < mv; m++) {
76 value(m+iloc,ipt) = (m_r1[m+iloc]
77 - resid0[m+iloc])*rdx;
87 for (n = 0; n < m_size; n++) {
88 m_ssdiag[n] =
value(n,n);
91 m_elapsed += double(clock() - t0)/CLOCKS_PER_SEC;
void eval(size_t j, double *x, double *r, doublereal rdt=-1.0, int count=1)
Evaluate the multi-domain residual function.
const size_t npos
index returned by functions to indicate "no position"
size_t loc(size_t jg)
Location in the solution vector of the first component of global point jg.
OneDim * m_resid
Residual evaluator for this jacobian.
doublereal & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
void eval(doublereal *x0, doublereal *resid0, double rdt)
Evaluate the Jacobian at x0.
void bfill(doublereal v=0.0)
Fill or zero the matrix.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
size_t nVars(size_t jg)
Number of solution components at global point jg.