15 #ifndef LAGRANGE_WEIGHTS_HPP
16 #define LAGRANGE_WEIGHTS_HPP
18 #define LAGRANGE_MAX_ORDER 8
46 set(var, inv_d, order);
58 KOKKOS_INLINE_FUNCTION
void set(
double var,
double inv_d,
int order){
59 double var_over_d, cell_loc, delta;
61 var_over_d = (order > 0) ? var*inv_d/order : var*inv_d;
62 idx = floor(var_over_d);
63 cell_loc = var_over_d -
idx;
67 else if(cell_loc > 0.5){
73 for (
int kk = 0; kk <= order; kk++){
75 for (
int jj = 0; jj <= order; jj++){
77 w[kk] *= (cell_loc - jj*delta)/(kk*delta - jj*delta);
95 KOKKOS_INLINE_FUNCTION
void set_idx(
int new_idx){
int idx
The lower cell index on the grid where one cell comprises order+1 grid points.
Definition: lagrange_weights.hpp:39
KOKKOS_INLINE_FUNCTION lagrange_weights(double var, double inv_d, int order)
Definition: lagrange_weights.hpp:45
KOKKOS_INLINE_FUNCTION void set(double var, double inv_d, int order)
Definition: lagrange_weights.hpp:58
This struct contains interpolation weights for 1D Lagrange interpolating polynomials of arbitrary ord...
Definition: lagrange_weights.hpp:37
#define LAGRANGE_MAX_ORDER
Definition: lagrange_weights.hpp:18
double w[LAGRANGE_MAX_ORDER]
Stores the Lagrange weights of the grid points i, i+1, i+2, ..., i+order in one cell.
Definition: lagrange_weights.hpp:40
KOKKOS_INLINE_FUNCTION lagrange_weights()
Definition: lagrange_weights.hpp:42
KOKKOS_INLINE_FUNCTION void set_idx(int new_idx)
Definition: lagrange_weights.hpp:95