30namespace Interpolation {
44template <
int order,
typename Kernel>
50 auto const block = detail::ll_and_dist<order>(pos, grid_spacing, offset);
53 std::array<double, order> w_y{};
54 std::array<double, order> w_z{};
55 for (
int i = 0; i < order; i++) {
56 w_y[
static_cast<unsigned>(i)] = bspline<order>(i,
block.distance[1]);
57 w_z[
static_cast<unsigned>(i)] = bspline<order>(i,
block.distance[2]);
60 std::array<int, 3> ind;
61 for (
int i = 0; i < order; i++) {
62 ind[0] =
block.corner[0] + i;
63 auto const wx = bspline<order>(i,
block.distance[0]);
64 for (
int j = 0; j < order; j++) {
65 ind[1] =
block.corner[1] + j;
66 auto const wxy = wx * w_y[
static_cast<unsigned>(j)];
67 for (
int k = 0; k < order; k++) {
68 ind[2] =
block.corner[2] + k;
69 kernel(ind, wxy * w_z[
static_cast<unsigned>(k)]);
78template <
int order,
typename T,
typename Kernel>
85 [&value, &kernel](std::array<int, 3>
const &ind,
double w) {
86 value += w * kernel(ind);
88 grid_spacing, offset);
Vector implementation and trait types for boost qvm interoperability.
static double * block(double *p, std::size_t index, std::size_t size)
void bspline_3d(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset)
cardinal B-spline interpolation with internal iteration.
T bspline_3d_accumulate(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset, T const &init)
cardinal B-spline weighted sum.
DEVICE_QUALIFIER auto bspline(int i, T x) -> std::enable_if_t<(order > 0) &&(order<=7), T >
Formula of the B-spline.