XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
bicub.hpp
Go to the documentation of this file.
1 #ifndef BICUB_HPP
2 #define BICUB_HPP
3 #include "space_settings.hpp"
4 #include "simd.hpp"
5 
6 // The dimensions of this were (0:ndeg, 0:ndeg) - hardcoded to (4,4) here
7 struct BicubCoeff {
8  double coeff[4][4];
9 };
10 
11 // Bicubic spline class
12 template<class Device>
13 class Bicub {
14 
15  // bicub variables
16  int nr, nz;
17  double rmin, dr_inv, zmin, dz_inv;
18  Kokkos::View<double*,Kokkos::LayoutRight,Device> rc;
19  Kokkos::View<double*,Kokkos::LayoutRight,Device> zc;
20  Kokkos::View<BicubCoeff**,Kokkos::LayoutRight,Device> acoeff_all;
21 
22  // Compute value
23  KOKKOS_INLINE_FUNCTION void eval_bicub_0(double x, double y, double xc, double yc, const double (&acoeff)[4][4],
24  double &f00) const;
25 
26  // Compute first derivatives
27  KOKKOS_INLINE_FUNCTION void eval_bicub_1(double x, double y, double xc, double yc, const double (&acoeff)[4][4],
28  double &f00, double &f10, double &f01) const;
29 
30  // Compute first and second derivatives
31  KOKKOS_INLINE_FUNCTION void eval_bicub_2(double x, double y, double xc, double yc, const double (&acoeff)[4][4],
32  double &f00, double &f10, double &f01,
33  double &f11, double &f20, double &f02) const;
34 
35  public:
36 
37  // Constructor
38  Bicub(double *rc_in, double *zc_in, BicubCoeff *acoeff_in, int nr_in, int nz_in,
39  double rmin_in, double zmin_in, double dr_inv_in, double dz_inv_in);
40 
41  // Constructor from grid on r,z
42  Bicub(int eq_mr, int eq_mz, double rmin_in, double zmin_in, double rmax_in, double zmax_in, Kokkos::View<double**, Kokkos::LayoutRight, HostType>& val);
43 
44  // Default constructor
45  Bicub(){}
46 
47  // Get values
48  KOKKOS_INLINE_FUNCTION void der_zero(double x, double y, double &f00) const;
49 
50  // Get first derivatives
51  KOKKOS_INLINE_FUNCTION void der_one(double x, double y, double &f00, double &f10, double &f01) const;
52 
53  // Get first and second derivatives
54  KOKKOS_INLINE_FUNCTION void der_all(double x, double y, double &f00, double &f10, double &f01,
55  double &f11, double &f20, double &f02) const;
56 };
57 
58 #include "bicub.tpp"
59 
60 #endif
double zmin
Definition: bicub.hpp:17
KOKKOS_INLINE_FUNCTION void der_zero(double x, double y, double &f00) const
Definition: bicub.tpp:113
KOKKOS_INLINE_FUNCTION void der_all(double x, double y, double &f00, double &f10, double &f01, double &f11, double &f20, double &f02) const
Definition: bicub.tpp:146
Definition: bicub.hpp:7
KOKKOS_INLINE_FUNCTION void eval_bicub_0(double x, double y, double xc, double yc, const double(&acoeff)[4][4], double &f00) const
Definition: bicub.tpp:163
Kokkos::View< double *, Kokkos::LayoutRight, Device > rc
Array containing the r coordinates of the grid points.
Definition: bicub.hpp:18
Bicub()
Definition: bicub.hpp:45
int nz
Number of points in r and z directions.
Definition: bicub.hpp:16
KOKKOS_INLINE_FUNCTION void eval_bicub_1(double x, double y, double xc, double yc, const double(&acoeff)[4][4], double &f00, double &f10, double &f01) const
Definition: bicub.tpp:194
Kokkos::View< double *, Kokkos::LayoutRight, Device > zc
Array containing the z coordinates of the grid points.
Definition: bicub.hpp:19
Definition: bicub.hpp:13
double coeff[4][4]
Definition: bicub.hpp:8
double dr_inv
Definition: bicub.hpp:17
KOKKOS_INLINE_FUNCTION void eval_bicub_2(double x, double y, double xc, double yc, const double(&acoeff)[4][4], double &f00, double &f10, double &f01, double &f11, double &f20, double &f02) const
Definition: bicub.tpp:250
double rmin
Definition: bicub.hpp:17
int nr
Definition: bicub.hpp:16
double dz_inv
First r and z point, and the inverse of the cell size.
Definition: bicub.hpp:17
KOKKOS_INLINE_FUNCTION void der_one(double x, double y, double &f00, double &f10, double &f01) const
Definition: bicub.tpp:128
Kokkos::View< BicubCoeff **, Kokkos::LayoutRight, Device > acoeff_all
The field for interpolation.
Definition: bicub.hpp:20