diff --git a/common/src/KokkosFFT_Helpers.hpp b/common/src/KokkosFFT_Helpers.hpp index db70833b..d05d2cbc 100644 --- a/common/src/KokkosFFT_Helpers.hpp +++ b/common/src/KokkosFFT_Helpers.hpp @@ -24,11 +24,11 @@ auto get_shift(const ViewType& inout, axis_type _axes, int direction = 1) { // Assert if the elements are overlapped constexpr int rank = ViewType::rank(); KOKKOSFFT_EXPECTS(!KokkosFFT::Impl::has_duplicate_values(axes), - "axes are overlapped"); + "Axes overlap"); KOKKOSFFT_EXPECTS( !KokkosFFT::Impl::is_out_of_range_value_included(axes, rank), - "axes include out of range index." - "axes should be in the range of [-rank, rank-1]."); + "Axes include an out-of-range index." + "Axes must be in the range of [-rank, rank-1]."); axis_type shift = {0}; for (int i = 0; i < static_cast(DIM); i++) { diff --git a/common/src/KokkosFFT_layouts.hpp b/common/src/KokkosFFT_layouts.hpp index df62c0ff..065b898c 100644 --- a/common/src/KokkosFFT_layouts.hpp +++ b/common/src/KokkosFFT_layouts.hpp @@ -70,8 +70,8 @@ auto get_extents(const InViewType& in, const OutViewType& out, KOKKOSFFT_EXPECTS( _out_extents.at(inner_most_axis) == _in_extents.at(inner_most_axis) / 2 + 1, - "For R2C, the output extent of transform should be input extent / " - "2 + 1"); + "For R2C, the 'output extent' of transform must be equal to " + "'input extent'/2 + 1"); } else { throw std::runtime_error( "If the input type is real, the output type should be complex"); @@ -84,8 +84,8 @@ auto get_extents(const InViewType& in, const OutViewType& out, KOKKOSFFT_EXPECTS( _in_extents.at(inner_most_axis) == _out_extents.at(inner_most_axis) / 2 + 1, - "For C2R, the input extent of transform should be output extent / " - "2 + 1"); + "For C2R, the 'input extent' of transform must be equal to " + "'output extent' / 2 + 1"); } else { throw std::runtime_error( "If the output type is real, the input type should be complex"); diff --git a/common/src/KokkosFFT_padding.hpp b/common/src/KokkosFFT_padding.hpp index 92a8ab87..3fc059be 100644 --- a/common/src/KokkosFFT_padding.hpp +++ b/common/src/KokkosFFT_padding.hpp @@ -52,11 +52,11 @@ auto get_modified_shape(const InViewType in, const OutViewType /* out */, // Assert if the elements are overlapped KOKKOSFFT_EXPECTS(!KokkosFFT::Impl::has_duplicate_values(positive_axes), - "axes are overlapped"); + "Axes overlap"); KOKKOSFFT_EXPECTS( !KokkosFFT::Impl::is_out_of_range_value_included(positive_axes, rank), - "axes include out of range index." - "axes should be in the range of [-rank, rank-1]."); + "Axes include an out-of-range index." + "Axes must be in the range of [-rank, rank-1]."); using full_shape_type = shape_type; full_shape_type modified_shape; diff --git a/common/src/KokkosFFT_utils.hpp b/common/src/KokkosFFT_utils.hpp index eb9f94cc..b7a3ad3b 100644 --- a/common/src/KokkosFFT_utils.hpp +++ b/common/src/KokkosFFT_utils.hpp @@ -13,46 +13,45 @@ #include #include "KokkosFFT_traits.hpp" -#ifndef KOKKOS_ENABLE_CXX17 -#include -#define KOKKOSFFT_EXPECTS(expression, msg) \ - KokkosFFT::Impl::check_precondition((expression), msg, \ - std::source_location::current()) -#else +#if defined(KOKKOS_ENABLE_CXX17) #include #define KOKKOSFFT_EXPECTS(expression, msg) \ KokkosFFT::Impl::check_precondition((expression), msg, __FILE__, __LINE__, \ __FUNCTION__) +#else +#include +#define KOKKOSFFT_EXPECTS(expression, msg) \ + KokkosFFT::Impl::check_precondition((expression), msg, \ + std::source_location::current()) #endif namespace KokkosFFT { namespace Impl { -#ifndef KOKKOS_ENABLE_CXX17 +#if defined(KOKKOS_ENABLE_CXX17) inline void check_precondition(const bool expression, const std::string& msg, - std::source_location location) { + const char* file_name, int line, + const char* function_name) { std::stringstream ss("file: "); - ss << location.file_name() << '(' << location.line() << ':' - << location.column() << ") `" << location.function_name() << "`: " << msg + ss << file_name << '(' << line << ") `" << function_name << "`: " << msg << '\n'; - if (!expression) { throw std::runtime_error(ss.str()); } } #else inline void check_precondition(const bool expression, const std::string& msg, - const char* file_name, int line, - const char* function_name) { + std::source_location location) { std::stringstream ss("file: "); - ss << file_name << '(' << line << ") `" << function_name << "`: " << msg + ss << location.file_name() << '(' << location.line() << ':' + << location.column() << ") `" << location.function_name() << "`: " << msg << '\n'; + if (!expression) { throw std::runtime_error(ss.str()); } } #endif - template auto convert_negative_axis(ViewType, int _axis = -1) { static_assert(Kokkos::is_view::value, @@ -60,7 +59,7 @@ auto convert_negative_axis(ViewType, int _axis = -1) { int rank = static_cast(ViewType::rank()); KOKKOSFFT_EXPECTS(_axis >= -rank && _axis < rank, - "axis should be in [-rank, rank-1]"); + "Axis must be in [-rank, rank-1]"); int axis = _axis < 0 ? rank + _axis : _axis; return axis;