Skip to content

Commit

Permalink
use check_precondition in get_shift function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Jul 25, 2024
1 parent ddae421 commit 6bc016a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions common/src/KokkosFFT_Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ auto get_shift(const ViewType& inout, axis_type<DIM> _axes, int direction = 1) {

// Assert if the elements are overlapped
constexpr int rank = ViewType::rank();
if (KokkosFFT::Impl::has_duplicate_values(axes)) {
throw std::runtime_error("get_shift: axes are overlapped.");
}
if (KokkosFFT::Impl::is_out_of_range_value_included(axes, rank)) {
throw std::runtime_error(
"get_shift: axes include out of range index."
"axes should be in the range of [-rank, rank-1].");
}
check_precondition(!KokkosFFT::Impl::has_duplicate_values(axes),
"axes are overlapped");
check_precondition(
!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].");

axis_type<rank> shift = {0};
for (int i = 0; i < static_cast<int>(DIM); i++) {
Expand Down

0 comments on commit 6bc016a

Please sign in to comment.