32 Vec<2> p = this->flags.wrap(this->dst_mesh->at(index));
44 double d0 = right - left,
46 double x0 = (p.c0 - left) /
d0,
47 x1 = (p.c1 - bottom) /
d1;
50 double hl = ( 2.*
x0 - 3.) *
x0*
x0 + 1.,
92 return this->flags.postprocess(this->dst_mesh->at(index),
110 Vec<3> p = this->flags.wrap(this->dst_mesh->at(index));
136 double d0 = front - back,
139 double x0 = (p.c0 - back) /
d0,
140 x1 = (p.c1 - left) /
d1,
141 x2 = (p.c2 - bottom) /
d2;
235 return this->flags.postprocess(this->dst_mesh->at(index),
254 template <
typename DataT>
255 static void computeDiffs(
DataT*
diffs,
int ax,
const shared_ptr<MeshAxis>& axis,
258 const std::size_t n1 = axis->size() - 1;
260 for (std::size_t i = 1; i != n1; ++i) {
261 const std::size_t idx =
stride * i;
262 const double da = axis->at(i) - axis->at(i-1),
263 db = axis->at(i+1) - axis->at(i);
278 db0 = axis->at(1) - axis->at(0);
279 sb0 = (data[1] - data[0]) /
db0;
291 dan = axis->at(n1) - axis->at(n1-1);
293 dbn = - axis->at(n1);
306 da0 = axis->at(0) - axis->at(n1) + flags.
high(
ax) - flags.
low(
ax);
307 db0 = axis->at(1) - axis->at(0);
308 dan = axis->at(n1) - axis->at(n1-1);
310 sb0 = (data[1] - data[0]) /
db0;
441 template <
typename DataT>
445 const size_t n0 = axis->size();
446 const size_t n1 =
n0 - 1;
448 std::unique_ptr<double[]>
450 dd(
new double[n1 + 1]),
455 double left = (axis->at(0) >= 0.)? 0. : flags.
low(
ax);
456 const double da = 2. * (axis->at(0) - left),
db = axis->at(1) - axis->at(0);
472 const double da = axis->at(i) - axis->at(i-1),
473 db = axis->at(i+1) - axis->at(i);
494 }
else if (axis->at(0) > 0. || flags.
periodic(
ax)) {
495 const double left = (axis->at(0) >= 0.)? 0. : flags.
low(
ax);
497 dd[0] = 2.*axis->at(0) + 2.*axis->at(1) - 4.*left;
498 du[0] = 2. * (axis->at(0) - left);
510 double ih = 0.5 / (axis->at(n1) - axis->at(n1-1));
517 }
else if (axis->at(n1) < 0. || flags.
periodic(
ax)) {
518 const double right = (axis->at(n1) <= 0.)? 0. : flags.
high(
ax);
519 const double da = axis->at(n1) - axis->at(n1-1),
db = 2. * (right - axis->at(n1));
523 dd[n1] = 4.*right - 2.*axis->at(n1) - 2.*axis->at(n1-1);
540 du[0] =
dl[n1-1] = 0.;
550 double id0 = 1. /
dd[0];
559 const double m = 1. / (
dd[i] -
dl[i-1] *
du[i-1]);
575 throw NotImplemented(
"smooth spline for periodic, non-symmetric geometry");
585 const shared_ptr<
const MeshD<2>>& dst_mesh,
591 if (
n0 == 0 || n1 == 0)
592 throw BadMesh(
"interpolate",
"source mesh empty");