B:BD[
3.3518] → [
3.3518:4210]
B:BD[
3.4210] → [
2.133:177]
∅:D[
2.177] → [
3.4249:5008]
B:BD[
3.4249] → [
3.4249:5008]
array<T, n + 3> xs, ys;
xs[0] = xs[n + 2] = 0 / T(0);
ys[0] = ys[n + 2] = 0 / T(0);
const int i0 = n / 2;
for (int i = -1; i < n; ++i) {
T x = (i - i0) + CENTERING / T(2);
T y = f(x);
xs[i + 2] = x;
ys[i + 2] = y;
}
array<T, 3> x1;
array<T, 3> y1;
for (int off = -1; off < 2; ++off) {
x1[off + 1] = CENTERING / T(4) + off / T(2);
if (off < 0)
y1[off + 1] =
interp1d<CENTERING, CONS, ORDER>()(&ys[i0 + 1], 1, off + 2);
else
y1[off + 1] =
interp1d<CENTERING, CONS, ORDER>()(&ys[i0 + 2], 1, off);
assert(!CCTK_isnan(y1[off + 1]));
}
T dx = x1[1] - x1[0];
T xlo = x1[0];
T xhi = x1[2];
T yint = fint(xhi) - fint(xlo);
if (!(y1[0] / 4 + y1[1] / 2 + y1[2] / 4 == ys[i0 + 2]) ||
!(y1[0] * dx / 2 + y1[1] * dx + y1[2] * dx / 2 == yint)) {
cerr << "settings: CENTERING=" << CENTERING << " ORDER=" << ORDER
<< " order=" << order << "\n";
cerr << "input:\n";
for (int i = -1; i < n; ++i)
cerr << " xs=" << xs[i + 2] << " ys=" << ys[i + 2] << "\n";
cerr << "output:\n";
for (int off = -1; off < 2; ++off)
cerr << " x1=" << x1[off + 1] << " y1=" << y1[off + 1] << "\n";
cerr << "xlo=" << xlo << " xhi=" << xhi << " yint=" << yint << "\n";
// Don't test this, the case (VC,CONS) should not be used
if (false) {
array<T, n + 3> xs, ys;
xs[0] = xs[n + 2] = 0 / T(0);
ys[0] = ys[n + 2] = 0 / T(0);
const int i0 = n / 2;
for (int i = -1; i < n; ++i) {
const T x = (i - i0) + CENTERING / T(2);
// T y = f(x);
const T dx = 1;
const T xlo = x - dx / 2;
const T xhi = x + dx / 2;
const T y = fint(xhi) - fint(xlo);
xs[i + 2] = x;
ys[i + 2] = y;
}
array<T, 3> x1;
array<T, 3> y1;
for (int off = -1; off < 2; ++off) {
x1[off + 1] = CENTERING / T(4) + off / T(2);
if (off < 0)
y1[off + 1] =
interp1d<CENTERING, CONS, ORDER>()(&ys[i0 + 1], 1, off + 2);
else
y1[off + 1] =
interp1d<CENTERING, CONS, ORDER>()(&ys[i0 + 2], 1, off);
assert(!CCTK_isnan(y1[off + 1]));
}
const T dx = x1[1] - x1[0];
const T xlo = x1[0];
const T xhi = x1[2];
const T yint = fint(xhi) - fint(xlo);
if (!(y1[0] / 4 + y1[1] / 2 + y1[2] / 4 == ys[i0 + 2]) ||
!(y1[0] * dx / 2 + y1[1] * dx + y1[2] * dx / 2 == yint)) {
cerr << "settings: CENTERING=" << CENTERING << " ORDER=" << ORDER
<< " order=" << order << "\n";
cerr << "input:\n";
for (int i = -1; i < n; ++i)
cerr << " xs=" << xs[i + 2] << " ys=" << ys[i + 2] << "\n";
cerr << "output:\n";
for (int off = -1; off < 2; ++off)
cerr << " x1=" << x1[off + 1] << " y1=" << y1[off + 1] << "\n";
cerr << "xlo=" << xlo << " xhi=" << xhi << " yint=" << yint << "\n";
}
assert(y1[0] / 4 + y1[1] / 2 + y1[2] / 4 == ys[i0 + 2]);
assert(y1[0] * dx / 2 + y1[1] * dx + y1[2] * dx / 2 == yint);