30#ifndef dftefe_SplineDeviceKernels_h
31#define dftefe_SplineDeviceKernels_h
48 splineFindIdx(
const double xi,
51 const bool isSubdivGrid,
58 if (xi > knotX[nKnots - 1])
62 double rDiff = r_param - 1.0;
65 if (rDiff < 1e-6 && rDiff > -1e-6)
72 log(xi * rDiff / a_param + 1.0) / log(r_param));
74 a_param * (pow(r_param,
static_cast<double>(n_gp)) - 1.0) /
77 a_param * pow(r_param,
static_cast<double>(n_gp));
79 static_cast<double>(numSubDiv) * (xi - segStart) / segWidth);
82 return (idx >= nKnots) ? nKnots - 1 : idx;
88 if (xi >= knotX[nKnots - 1])
108 SplineEvalKernel(
const double x,
109 const double * knotX,
110 const double * knotY,
111 const double * coefB,
112 const double * coefC,
113 const double * coefD,
116 const bool isSubdivGrid,
117 const double a_param,
118 const double r_param,
123 xi, knotX, nKnots, isSubdivGrid, a_param, r_param, numSubDiv);
124 double h = xi - knotX[idx];
127 interpol = (c0 * h + coefB[0]) * h + knotY[0];
128 else if (xi > knotX[nKnots - 1])
130 (coefC[nKnots - 1] * h + coefB[nKnots - 1]) * h + knotY[nKnots - 1];
133 ((coefD[idx] * h + coefC[idx]) * h + coefB[idx]) * h + knotY[idx];
141 SplineDerivKernel(
const int derivOrder,
143 const double * knotX,
144 const double * coefB,
145 const double * coefC,
146 const double * coefD,
149 const bool isSubdivGrid,
150 const double a_param,
151 const double r_param,
156 xi, knotX, nKnots, isSubdivGrid, a_param, r_param, numSubDiv);
157 double h = xi - knotX[idx];
158 double interpol = 0.0;
162 interpol = 2.0 * c0 * h + coefB[0];
163 else if (derivOrder == 2)
166 else if (xi > knotX[nKnots - 1])
169 interpol = 2.0 * coefC[nKnots - 1] * h + coefB[nKnots - 1];
170 else if (derivOrder == 2)
171 interpol = 2.0 * coefC[nKnots - 1];
177 (3.0 * coefD[idx] * h + 2.0 * coefC[idx]) * h + coefB[idx];
178 else if (derivOrder == 2)
179 interpol = 6.0 * coefD[idx] * h + 2.0 * coefC[idx];
180 else if (derivOrder == 3)
181 interpol = 6.0 * coefD[idx];
188 template <dftefe::utils::MemorySpace memorySpace>
190 const double * knotY,
191 const double * coefB,
192 const double * coefC,
193 const double * coefD,
207 , d_isSubdivGrid(isSubdivGrid)
210 , d_numSubDiv(numSubDiv)
213 template <dftefe::utils::MemorySpace memorySpace>
217 return SplineEvalKernel(xi,
231 template <dftefe::utils::MemorySpace memorySpace>
235 return SplineDerivKernel(order,
#define DFTEFE_HOST_DEVICE_FUNC
Definition: DeviceKernelLauncherHelpers.h:306
DFTEFE_HOST_DEVICE_FUNC double eval(double xi) const
Definition: SplineKernels.h:215
Func()
Definition: Spline.h:56
DFTEFE_HOST_DEVICE_FUNC double deriv(int order, double xi) const
Definition: SplineKernels.h:233
double d_r
Definition: Spline.h:128
double d_c0
Definition: Spline.h:122
dftefe::size_type d_numSubDiv
Definition: Spline.h:129
double d_a
Definition: Spline.h:128
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9