diff --git a/doc/sphinx/src/databox.rst b/doc/sphinx/src/databox.rst index 624e187cf..a75dd7f4e 100644 --- a/doc/sphinx/src/databox.rst +++ b/doc/sphinx/src/databox.rst @@ -479,6 +479,15 @@ so on. These interpolation routines are hand-tuned for performance. or try to interpolate on indices that are not interpolatable. This is checked with an ``assert`` statement. +.. warning:: + The ``DataBox::interpToReal`` method is deprecated, and will be replaced by + the ``DataBox::interpToScalar`` method. The ``DataBox::interpToScalar`` + method is already available, so we recommend changing your code to use that + instead so as to future-proof your code against the upcoming removal of + ``DataBox::interpToReal``. The semantics of the two functions are + identical, but the change to ``DataBox::interpToScalar`` will enable new + features and improve maintainability of Spiner. + Mixed interpolation and indexing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spiner/databox.hpp b/spiner/databox.hpp index 52149da06..6802ca4d5 100644 --- a/spiner/databox.hpp +++ b/spiner/databox.hpp @@ -190,11 +190,6 @@ class DataBox { // Interpolates whole DataBox to a real number, // x1 is fastest index. xN is slowest. - // TODO: We _might_ be able to get rid of all the interpToReal wrappers and - // just use interpolate directly. If we do, then we should rename - // interpolate back to interpToReal despite my concerns noted below. - // -- If we keep the interpToReal wrappers, then should interpolate be - // made private? PORTABLE_FORCEINLINE_FUNCTION T interpToReal(const T x) const noexcept; PORTABLE_FORCEINLINE_FUNCTION T interpToReal(const T x2, const T x1) const noexcept; @@ -220,9 +215,9 @@ class DataBox { // * T : a coordinate to interpolate to that point on that axis template PORTABLE_FORCEINLINE_FUNCTION T - interpolate(const Coords... coords) const noexcept; + interpToScalar(const Coords... coords) const noexcept; - // TODO: In principle, the logic for interpolate and interp_core could be + // TODO: In principle, the logic for interpToScalar and interp_core could be // extended to work on these routines. I've not looked at how easy it // would be, so it may be more work than it's worth? // Interpolates SLOWEST indices of databox to a new @@ -502,7 +497,7 @@ inline void DataBox::setArray(PortableMDArray &A) { template template -PORTABLE_INLINE_FUNCTION T DataBox::interpolate( +PORTABLE_INLINE_FUNCTION T DataBox::interpToScalar( const Coords... coords) const noexcept { constexpr std::size_t N = sizeof...(Coords); assert(canInterpToReal_(N)); @@ -541,25 +536,25 @@ PORTABLE_FORCEINLINE_FUNCTION T DataBox::interp_core( template PORTABLE_INLINE_FUNCTION T DataBox::interpToReal(const T x) const noexcept { - return interpolate(x); + return interpToScalar(x); } template PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( const T x2, const T x1) const noexcept { - return interpolate(x2, x1); + return interpToScalar(x2, x1); } template PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( const T x3, const T x2, const T x1) const noexcept { - return interpolate(x3, x2, x1); + return interpToScalar(x3, x2, x1); } template PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( const T x3, const T x2, const T x1, const int idx) const noexcept { - return interpolate(x3, x2, x1, idx); + return interpToScalar(x3, x2, x1, idx); } // DH: this is a large function to force an inline, perhaps just make it a @@ -567,14 +562,14 @@ PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( template PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( const T x4, const T x3, const T x2, const T x1) const noexcept { - return interpolate(x4, x3, x2, x1); + return interpToScalar(x4, x3, x2, x1); } template PORTABLE_FORCEINLINE_FUNCTION T DataBox::interpToReal( const T x4, const T x3, const T x2, const int idx, const T x1) const noexcept { - return interpolate(x4, x3, x2, idx, x1); + return interpToScalar(x4, x3, x2, idx, x1); } template