HDINLINE float_X operator()(const float_X x) { /* - * | 1/6*(4 - 6*x^2 + 3*|x|^3) if 0<=|x|<1 * W(x)=<| 1/6*(2 - |x|)^3 if 1<=|x|<2 * | 0 otherwise * - */ float_X abs_x = algorithms::math::abs(x); const bool below_1 = (abs_x < float_X(1.0)); const bool below_2 = (abs_x < float_X(2.0)); return float_X(below_1) * ff_1st_radius(abs_x) + float_X(below_2 && !below_1) * ff_2nd_radius(abs_x); }
/** form factor of this particle shape. * \param x has to be within [-support/2, support/2] */ HDINLINE float_X operator()(const float_X x) { /* - * | 3/4 - x^2 if |x|<1/2 * W(x)=<| * | 1/2*(3/2 - |x|)^2 if 1/2<=|x|<3/2 * - */ float_X abs_x = algorithms::math::abs(x); const bool below_05 = (abs_x < float_X(0.5)); const float_X fbelow_05 = float_X(below_05); return fbelow_05 * ff_1st_radius(abs_x) + float_X(!below_05) * ff_2nd_radius(abs_x); }
HDINLINE float_X operator()(const float_X x) { /* - * | 1/6*(4 - 6*x^2 + 3*|x|^3) if 0<=|x|<1 * W(x)=<| * | 1/6*(2 - |x|)^3 if 1<=|x|<2 * - */ float_X abs_x = algorithms::math::abs(x); const bool below_1 = (abs_x < float_X(1.0)); return float_X(below_1) * ff_1st_radius(abs_x) + float_X(!below_1) * ff_2nd_radius(abs_x); /* Semantix: if (abs_x < float_X(1.0)) return ff_1st_radius(abs_x); return ff_2nd_radius(abs_x); */ }