SplineInterpolator1D< NT, Coordinates > Class Template Reference#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
A spline interpolator for 1D data, callable from host AND device code. More...
#include <spline_interpolator_1d.hh>
Public Types | |
| using | ctype = typename Coordinates::ctype |
| using | value_type = NT |
Public Member Functions | |
| SplineInterpolator1D (const Coordinates &coordinates) | |
| Construct a SplineInterpolator1D with internal, zeroed data and a coordinate system. | |
| KOKKOS_DEFAULTED_FUNCTION | SplineInterpolator1D (const SplineInterpolator1D &)=default |
| Shallow copy of ALL views, valid in host and in device code. See LinearInterpolator1D. | |
| template<typename NT2 > | |
| void | update (const NT2 *in_data, const ctype lower_y1=std::numeric_limits< ctype >::max(), const ctype upper_y1=std::numeric_limits< ctype >::max()) |
| Replace the data, leaving host AND device current. The only mutator. | |
| NT | operator[] (size_t i) const |
| Host-side element access. Always valid, including on a copy. | |
| ctype KOKKOS_FUNCTION | index (const typename Coordinates::ctype x) const |
| Map a physical coordinate onto the (clamped) grid index. | |
| NT KOKKOS_FUNCTION | at (const ctype raw_idx) const |
| Interpolate at a grid index previously obtained from index(). | |
| NT KOKKOS_FUNCTION | operator() (const typename Coordinates::ctype x) const |
| Interpolate the data at a given point. | |
| const Coordinates & | get_coordinates () const |
| Get the coordinate system of the data. | |
| const NT * | data () const |
| Read-only handle to the host values. | |
Static Public Attributes | |
| static constexpr size_t | dim = 1 |
Private Types | |
| using | ValueViewType = Kokkos::View<NT *, GPU_memory, Kokkos::MemoryTraits<Kokkos::RandomAccess>> |
| using | CoeffViewType = ValueViewType |
| using | HostValueViewType = typename ValueViewType::host_mirror_type |
| using | HostCoeffViewType = typename CoeffViewType::host_mirror_type |
Private Member Functions | |
| KOKKOS_FORCEINLINE_FUNCTION NT | value (const size_t i) const |
| Read one value from whichever buffer belongs to the executing side. | |
| KOKKOS_FORCEINLINE_FUNCTION NT | coeff (const size_t i) const |
| Read one spline coefficient from whichever buffer belongs to the executing side. | |
| void | build_y2 (const ctype lower_y1, const ctype upper_y1) |
Private Attributes | |
| const Coordinates | coordinates |
| const size_t | size |
| ValueViewType | device_values |
| CoeffViewType | device_coeffs |
| HostValueViewType | host_values |
| HostCoeffViewType | host_coeffs |
Static Private Attributes | |
| static constexpr bool | has_separate_device |
Detailed Description
class DiFfRG::SplineInterpolator1D< NT, Coordinates >
A spline interpolator for 1D data, callable from host AND device code.
See LinearInterpolator1D for the host/device dispatch rationale.
- Template Parameters
-
NT input data type Coordinates coordinate system of the input data
Member Typedef Documentation
◆ CoeffViewType
|
private |
◆ ctype
| using DiFfRG::SplineInterpolator1D< NT, Coordinates >::ctype = typename Coordinates::ctype |
◆ HostCoeffViewType
|
private |
◆ HostValueViewType
|
private |
◆ value_type
| using DiFfRG::SplineInterpolator1D< NT, Coordinates >::value_type = NT |
◆ ValueViewType
|
private |
Constructor & Destructor Documentation
◆ SplineInterpolator1D() [1/2]
|
inline |
Construct a SplineInterpolator1D with internal, zeroed data and a coordinate system.
- Parameters
-
coordinates coordinate system of the data
◆ SplineInterpolator1D() [2/2]
|
default |
Shallow copy of ALL views, valid in host and in device code. See LinearInterpolator1D.
Member Function Documentation
◆ at()
|
inline |
Interpolate at a grid index previously obtained from index().
Clamping lives here, not in index(), so that index() depends ONLY on the coordinate system. That is exactly the precondition under which a caller may share one index across several interpolators; folding a size-dependent clamp into it would silently break sharing between interpolators of different length.
◆ build_y2()
|
inlineprivate |
◆ coeff()
|
inlineprivate |
Read one spline coefficient from whichever buffer belongs to the executing side.
◆ data()
|
inline |
Read-only handle to the host values.
Deliberately const: a host-side write would leave both the device buffers and the spline coefficients stale, and there is no public way to push it. Route mutations through update().
◆ get_coordinates()
|
inline |
Get the coordinate system of the data.
- Returns
- const Coordinates& the coordinate system
◆ index()
|
inline |
Map a physical coordinate onto the (clamped) grid index.
Split out of operator() because it is the expensive half: for a logarithmic axis Coordinates::backward is a fp64 log1p, which costs ~200 fp64 instructions on current NVIDIA parts, against ~10 for the spline evaluation itself. A generated kernel that evaluates many dressings at the SAME momentum pays that log1p once per dressing, because each interpolator owns its own coordinates members and the compiler cannot prove they are equal across objects – so it cannot CSE the transform. Hoisting index() lets the caller pay it once.
The returned index is only meaningful for interpolators sharing this coordinate system.
◆ operator()()
|
inline |
Interpolate the data at a given point.
- Parameters
-
x the point at which to interpolate
- Returns
- NT the interpolated value
◆ operator[]()
|
inline |
Host-side element access. Always valid, including on a copy.
◆ update()
|
inline |
Replace the data, leaving host AND device current. The only mutator.
See LinearInterpolator1D::update() for why the host fill is a plain copy and why the single trailing fence is not optional.
◆ value()
|
inlineprivate |
Read one value from whichever buffer belongs to the executing side.
Member Data Documentation
◆ coordinates
|
private |
◆ device_coeffs
|
private |
◆ device_values
|
private |
◆ dim
|
staticconstexpr |
◆ has_separate_device
|
staticconstexprprivate |
◆ host_coeffs
|
private |
◆ host_values
|
private |
◆ size
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/interpolation/spline_interpolator_1d.hh
Generated by