51 auto const block = detail::ll_and_dist<order>(pos, grid_spacing, offset);
54 std::array<double, order> w_y;
55 std::array<double, order> w_z;
56 std::array<double, order> dw_y;
57 std::array<double, order> dw_z;
58 for (
int i = 0; i < order; i++) {
59 w_y[i] = bspline<order>(i,
block.distance[1]);
60 w_z[i] = bspline<order>(i,
block.distance[2]);
61 dw_y[i] = bspline_d<order>(i,
block.distance[1]) / grid_spacing[1];
62 dw_z[i] = bspline_d<order>(i,
block.distance[2]) / grid_spacing[2];
65 std::array<int, 3> ind;
66 for (
int i = 0; i < order; i++) {
67 ind[0] =
block.corner[0] + i;
68 auto const w_x = bspline<order>(i,
block.distance[0]);
69 auto const dw_x = bspline_d<order>(i,
block.distance[0]) / grid_spacing[0];
70 for (
int j = 0; j < order; j++) {
71 ind[1] =
block.corner[1] + j;
72 for (
int k = 0; k < order; k++) {
73 ind[2] =
block.corner[2] + k;
74 kernel(ind,
Vector3d{dw_x * w_y[j] * w_z[k], w_x * dw_y[j] * w_z[k],
75 w_x * w_y[j] * dw_z[k]});
T bspline_3d_gradient_accumulate(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset, T const &init)
cardinal B-spline weighted sum.
void bspline_3d_gradient(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset)
cardinal B-spline gradient interpolation with internal iteration.