43 namespace INTERPOLATION
56 template <
typename T =
double>
59 return cube((T)1.0 - eta);
62 template <
typename T =
double>
65 return (T)3.0 * eta *
sqr((T)1.0 - eta);
68 template <
typename T =
double>
71 return (T)3.0 *
sqr(eta) * ((T)1.0 - eta);
74 template <
typename T =
double>
80 template <
typename T =
double>
83 return -(T)3.0 *
sqr((T)1.0 - eta);
86 template <
typename T =
double>
89 return (T)3 * ((T)1 - eta) * ((T)1 - (T)3 * eta);
92 template <
typename T =
double>
95 return (T)3 * eta * ((T)2 - (T)3 * eta);
98 template <
typename T =
double>
101 return (T)3 *
sqr(eta);
115 template <
typename T>
117 const T &dx,
bool use_gradient_limiting =
false) {
119 control_points.
c_30 = phi_0;
122 control_points.
c_03 = phi_1;
124 if (use_gradient_limiting) {
126 T D1 = (T)3.0 * (control_points.
c_21 - control_points.
c_30);
127 T D2 = (T)3.0 * (control_points.
c_03 - control_points.
c_12);
128 T D3 = (T)1.5 * (control_points.
c_12 - control_points.
c_30);
129 T D4 = (T)1.5 * (control_points.
c_03 - control_points.
c_21);
130 T D5 = control_points.
c_03 - control_points.
c_30;
132 if ((D1 - D3) * (D1 - D5) < (T)0)
133 control_points.
c_12 = (T)2 * control_points.
c_21 - control_points.
c_30;
134 else if ((D2 - D4) * (D2 - D5) < (T)0)
135 control_points.
c_21 = (T)2 * control_points.
c_12 - control_points.
c_03;
136 else if ((D1 - D5) * (D2 - D5) <= (T)0) {
142 return control_points;
149 template <
typename T,
typename T_GRID>
157 template <
typename T>
201 compute(x_interp, levelset);
226 template <
typename T>
270 compute(x_interp, levelset);
295 template <
typename T>
339 compute(x_interp, levelset);
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 3 >, typename GALS::CPU::Grid< T, 3 >::position_type > &x_interp, const GALS::CPU::Array< GALS::CPU::Grid< T, 3 >, T > &alpha, GALS::CPU::Array< GALS::CPU::Grid< T, 3 >, T > &alpha_interpolated)
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 2 >, typename GALS::CPU::Grid< T, 2 >::position_type > &x_interp, CPU::Levelset< GALS::CPU::Grid< T, 2 >, T > &levelset)
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 2 >, typename GALS::CPU::Grid< T, 2 >::position_type > &x_interp, const GALS::CPU::Array< GALS::CPU::Grid< T, 2 >, T > &alpha, GALS::CPU::Array< GALS::CPU::Grid< T, 2 >, T > &alpha_interpolated)
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 3 >, typename GALS::CPU::Grid< T, 3 >::position_type > &x_interp, CPU::Levelset< GALS::CPU::Grid< T, 3 >, T > &levelset)
T B0(T eta)
cubic Bernstein polynomials
static const double two_thirds
#define GALS_FUNCTION_NOT_IMPLEMENTED(var)
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 1 >, typename GALS::CPU::Grid< T, 1 >::position_type > &x_interp, const GALS::CPU::Array< GALS::CPU::Grid< T, 1 >, T > &alpha, GALS::CPU::Array< GALS::CPU::Grid< T, 1 >, T > &alpha_interpolated)
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)
static T sqr(T a)
Compute square.
static T cube(T a)
Compute cube.
void operator()(const GALS::CPU::Array< GALS::CPU::Grid< T, 1 >, typename GALS::CPU::Grid< T, 1 >::position_type > &x_interp, CPU::Levelset< GALS::CPU::Grid< T, 1 >, T > &levelset)