45 const int dim = T_GRID::dim;
46 const int axis_x = 0, axis_y = 1;
55 const auto &dx = grid.dX();
56 const auto &one_over_dx = grid.oneOverDX();
61 levelset.phiPrev()(base_i_j), levelset.psiPrev()(base_i_j)[axis_x], levelset.phiPrev()(base_ip1_j),
62 levelset.psiPrev()(base_ip1_j)[axis_x], dx[axis_x], use_gradient_limiting);
64 levelset.phiPrev()(base_i_jp1), levelset.psiPrev()(base_i_jp1)[axis_x], levelset.phiPrev()(base_ip1_jp1),
65 levelset.psiPrev()(base_ip1_jp1)[axis_x], dx[axis_x], use_gradient_limiting);
67 levelset.phiPrev()(base_i_j), levelset.psiPrev()(base_i_j)[axis_y], levelset.phiPrev()(base_i_jp1),
68 levelset.psiPrev()(base_i_jp1)[axis_y], dx[axis_y], use_gradient_limiting);
70 levelset.phiPrev()(base_ip1_j), levelset.psiPrev()(base_ip1_j)[axis_y], levelset.phiPrev()(base_ip1_jp1),
71 levelset.psiPrev()(base_ip1_jp1)[axis_y], dx[axis_y], use_gradient_limiting);
74 levelset.psiPrev()(base_i_j)[axis_y] + dx[axis_x] *
one_third * levelset.phiMixedDerivativesPrev()(base_i_j)[0];
75 T c_2 = levelset.psiPrev()(base_ip1_j)[axis_x] +
76 dx[axis_y] *
one_third * levelset.phiMixedDerivativesPrev()(base_ip1_j)[0];
77 T c_2_prime = levelset.psiPrev()(base_ip1_jp1)[axis_x] -
78 dx[axis_y] *
one_third * levelset.phiMixedDerivativesPrev()(base_ip1_jp1)[0];
79 T c_3 = levelset.psiPrev()(base_i_jp1)[axis_y] +
80 dx[axis_x] *
one_third * levelset.phiMixedDerivativesPrev()(base_i_jp1)[0];
82 T bx[] = {
B0(eta[0]),
B1(eta[0]),
B2(eta[0]),
B3(eta[0])};
84 T by[] = {
B0(eta[1]),
B1(eta[1]),
B2(eta[1]),
B3(eta[1])};
87 T control_points_all[] = {control_points_left.
c_30,
88 control_points_left.
c_21,
89 control_points_left.
c_12,
90 control_points_left.
c_03,
91 control_points_bottom.
c_21,
94 control_points_top.
c_21,
95 control_points_bottom.
c_12,
97 control_points_right.
c_12 - dx[axis_x] *
one_third * c_2_prime,
98 control_points_top.
c_12,
99 control_points_right.
c_30,
100 control_points_right.
c_21,
101 control_points_right.
c_12,
102 control_points_right.
c_03};
104 for (
int i = 0, k = 0; i < 4; ++i)
105 for (
int j = 0; j < 4; ++j) {
110 for (
int i = 0, k = 0; i < 4; ++i)
111 for (
int j = 0; j < 4; ++j) {
112 hermite_fields.
psi_interpolated[axis_x] += bx_prime[i] * by[j] * control_points_all[k];
117 for (
int i = 0, k = 0; i < 4; ++i)
118 for (
int j = 0; j < 4; ++j) {
119 hermite_fields.
psi_interpolated[axis_y] += bx[i] * by_prime[j] * control_points_all[k];
124 return hermite_fields;
127 template <
typename T>
135 const T_GRID &grid = levelset.grid();
139 for (
int i = 0; i < num_cells_interp[0]; ++i)
140 for (
int j = 0; j < num_cells_interp[1]; ++j)
141 for (
int k = 0; k < num_cells_interp[2]; ++k) {
142 const auto &hermite_fields = this->interpolate(grid, x_interp(i, j, k), levelset);
144 levelset.phiInterpPrev()(i, j, k) = hermite_fields.phi_interpolated;
145 levelset.psiInterpPrev()(i, j, k) = hermite_fields.psi_interpolated;
T B0(T eta)
cubic Bernstein polynomials
T_VECTOR psi_interpolated
const Vec3< T > & dX() const
static const double one_third
static struct ControlPoints< T > get_control_points(const T &phi_0, const T &phi_x_0, const T &phi_1, const T &phi_x_1, const T &dx, bool use_gradient_limiting=false)