18 Indx(
size_t nv,
size_t np) : m_nv(nv), m_np(np) {}
20 size_t operator()(
size_t m,
size_t j) {
31 doublereal
bound_step(
const doublereal* x,
const doublereal* step,
39 doublereal above, below, val, newval;
41 doublereal fbound = 1.0;
42 bool wroteTitle =
false;
43 for (m = 0; m < nv; m++) {
47 for (j = 0; j < np; j++) {
50 if (val > above + 1.0e-12 || val < below - 1.0e-12) {
51 sprintf(buf,
"domain %s: %20s(%s) = %10.3e (%10.3e, %10.3e)\n",
55 writelog(
string(
"\nERROR: solution out of bounds.\n")+buf);
59 newval = val + step[index(m,j)];
63 (above - val)/(newval - val)));
64 }
else if (newval < below) {
65 fbound =
std::min(fbound, (val - below)/(val - newval));
68 if (loglevel > 1 && (newval > above || newval < below)) {
70 writelog(
"\nNewton step takes solution out of bounds.\n\n");
71 sprintf(buf,
" %12s %12s %4s %10s %10s %10s %10s\n",
72 "domain",
"component",
"pt",
"value",
"step",
"min",
"max");
76 sprintf(buf,
" %4s %12s %4s %10.3e %10.3e %10.3e %10.3e\n",
79 val, step[index(m,j)], below, above);
114 const doublereal* step,
Domain1D& r)
116 doublereal f, ewt, esum, sum = 0.0;
118 doublereal f2max = 0.0;
122 for (n = 0; n < nv; n++) {
124 for (j = 0; j < np; j++) {
125 esum += fabs(x[nv*j + n]);
127 ewt = r.
rtol(n)*esum/np + r.
atol(n);
128 for (j = 0; j < np; j++) {
129 f = step[nv*j + n]/ewt;