7 #ifndef SHAPEFACTORS_H_
8 #define SHAPEFACTORS_H_
27 template <
int depos_order>
30 template<
typename T >
36 if constexpr (depos_order == 0){
37 const auto j =
static_cast<int>(xmid + T(0.5));
41 else if constexpr (depos_order == 1){
42 const auto j =
static_cast<int>(xmid);
43 const T xint = xmid - T(j);
44 sx[0] = T(1.0) - xint;
48 else if constexpr (depos_order == 2){
49 const auto j =
static_cast<int>(xmid + T(0.5));
50 const T xint = xmid - T(j);
51 sx[0] = T(0.5)*(T(0.5) - xint)*(T(0.5) - xint);
52 sx[1] = T(0.75) - xint*xint;
53 sx[2] = T(0.5)*(T(0.5) + xint)*(T(0.5) + xint);
57 else if constexpr (depos_order == 3){
58 const auto j =
static_cast<int>(xmid);
59 const T xint = xmid - T(j);
60 sx[0] = (T(1.0))/(T(6.0))*(T(1.0) - xint)*(T(1.0) - xint)*(T(1.0) - xint);
61 sx[1] = (T(2.0))/(T(3.0)) - xint*xint*(T(1.0) - xint/(T(2.0)));
62 sx[2] = (T(2.0))/(T(3.0)) - (T(1.0) - xint)*(T(1.0) - xint)*(T(1.0) - T(0.5)*(T(1.0) - xint));
63 sx[3] = (T(1.0))/(T(6.0))*xint*xint*xint;
82 template <
int depos_order>
85 template<
typename T >
90 const int i_new)
const
92 if constexpr (depos_order == 1){
93 const auto i =
static_cast<int>(x_old);
94 const int i_shift =
i - i_new;
95 const T xint = x_old - T(
i);
96 sx[1+i_shift] = T(1.0) - xint;
100 else if constexpr (depos_order == 2){
101 const auto i =
static_cast<int>(x_old + T(0.5));
102 const int i_shift =
i - (i_new + 1);
103 const T xint = x_old - T(
i);
104 sx[1+i_shift] = T(0.5)*(T(0.5) - xint)*(T(0.5) - xint);
105 sx[2+i_shift] = T(0.75) - xint*xint;
106 sx[3+i_shift] = T(0.5)*(T(0.5) + xint)*(T(0.5) + xint);
110 else if constexpr (depos_order == 3){
111 const auto i =
static_cast<int>(x_old);
112 const int i_shift =
i - (i_new + 1);
113 const T xint = x_old -
i;
114 sx[1+i_shift] = (T(1.0))/(T(6.0))*(T(1.0) - xint)*(T(1.0) - xint)*(T(1.0) - xint);
115 sx[2+i_shift] = (T(2.0))/(T(3.0)) - xint*xint*(T(1.0) - xint/(T(2.0)));
116 sx[3+i_shift] = (T(2.0))/(T(3.0)) - (T(1.0) - xint)*(T(1.0) - xint)*(T(1.0) - T(0.5)*(T(1.0) - xint));
117 sx[4+i_shift] = (T(1.0))/(T(6.0))*xint*xint*xint;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define WARPX_ABORT_WITH_MESSAGE(MSG)
Definition: TextMsg.H:15
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
i
Definition: check_interp_points_and_weights.py:174
Definition: ShapeFactors.H:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int operator()(T *const sx, T xmid) const
Definition: ShapeFactors.H:32
Definition: ShapeFactors.H:84
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int operator()(T *const sx, const T x_old, const int i_new) const
Definition: ShapeFactors.H:87