diff --git a/common/src/KokkosFFT_Helpers.hpp b/common/src/KokkosFFT_Helpers.hpp index 01872fd7..e53cadff 100644 --- a/common/src/KokkosFFT_Helpers.hpp +++ b/common/src/KokkosFFT_Helpers.hpp @@ -7,6 +7,7 @@ #include #include "KokkosFFT_common_types.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_utils.hpp" namespace KokkosFFT { @@ -131,16 +132,6 @@ void roll(const ExecutionSpace& exec_space, ViewType& inout, axis_type<2> shift, template void fftshift_impl(const ExecutionSpace& exec_space, ViewType& inout, axis_type axes) { - static_assert(Kokkos::is_view::value, - "fftshift_impl: ViewType is not a Kokkos::View."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "fftshift_impl: ViewType must be either LayoutLeft or LayoutRight."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "fftshift_impl: execution_space cannot access data in ViewType"); - static_assert(ViewType::rank() >= DIM, "fftshift_impl: Rank of View must be larger thane " "or equal to the Rank of shift axes."); @@ -151,16 +142,6 @@ void fftshift_impl(const ExecutionSpace& exec_space, ViewType& inout, template void ifftshift_impl(const ExecutionSpace& exec_space, ViewType& inout, axis_type axes) { - static_assert(Kokkos::is_view::value, - "ifftshift_impl: ViewType is not a Kokkos::View."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "ifftshift_impl: ViewType must be either LayoutLeft or LayoutRight."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "ifftshift_impl: execution_space cannot access data in ViewType"); - static_assert(ViewType::rank() >= DIM, "ifftshift_impl: Rank of View must be larger " "thane or equal to the Rank of shift axes."); @@ -243,6 +224,11 @@ auto rfftfreq(const ExecutionSpace&, const std::size_t n, template void fftshift(const ExecutionSpace& exec_space, ViewType& inout, std::optional axes = std::nullopt) { + static_assert(KokkosFFT::Impl::is_operatable_view_v, + "fftshift: View value type must be float, double, " + "Kokkos::Complex, or Kokkos::Complex. " + "Layout must be either LayoutLeft or LayoutRight. " + "ExecutionSpace must be able to access data in ViewType"); if (axes) { axis_type<1> _axes{axes.value()}; KokkosFFT::Impl::fftshift_impl(exec_space, inout, _axes); @@ -262,6 +248,11 @@ void fftshift(const ExecutionSpace& exec_space, ViewType& inout, template void fftshift(const ExecutionSpace& exec_space, ViewType& inout, axis_type axes) { + static_assert(KokkosFFT::Impl::is_operatable_view_v, + "fftshift: View value type must be float, double, " + "Kokkos::Complex, or Kokkos::Complex. " + "Layout must be either LayoutLeft or LayoutRight. " + "ExecutionSpace must be able to access data in ViewType"); KokkosFFT::Impl::fftshift_impl(exec_space, inout, axes); } @@ -273,6 +264,11 @@ void fftshift(const ExecutionSpace& exec_space, ViewType& inout, template void ifftshift(const ExecutionSpace& exec_space, ViewType& inout, std::optional axes = std::nullopt) { + static_assert(KokkosFFT::Impl::is_operatable_view_v, + "ifftshift: View value type must be float, double, " + "Kokkos::Complex, or Kokkos::Complex. " + "Layout must be either LayoutLeft or LayoutRight. " + "ExecutionSpace must be able to access data in ViewType"); if (axes) { axis_type<1> _axes{axes.value()}; KokkosFFT::Impl::ifftshift_impl(exec_space, inout, _axes); @@ -292,6 +288,11 @@ void ifftshift(const ExecutionSpace& exec_space, ViewType& inout, template void ifftshift(const ExecutionSpace& exec_space, ViewType& inout, axis_type axes) { + static_assert(KokkosFFT::Impl::is_operatable_view_v, + "ifftshift: View value type must be float, double, " + "Kokkos::Complex, or Kokkos::Complex. " + "Layout must be either LayoutLeft or LayoutRight. " + "ExecutionSpace must be able to access data in ViewType"); KokkosFFT::Impl::ifftshift_impl(exec_space, inout, axes); } } // namespace KokkosFFT diff --git a/fft/src/KokkosFFT_Plans.hpp b/fft/src/KokkosFFT_Plans.hpp index ec19fc99..7a4aef18 100644 --- a/fft/src/KokkosFFT_Plans.hpp +++ b/fft/src/KokkosFFT_Plans.hpp @@ -13,6 +13,7 @@ #include #include "KokkosFFT_default_types.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_transpose.hpp" #include "KokkosFFT_padding.hpp" #include "KokkosFFT_utils.hpp" @@ -158,33 +159,14 @@ class Plan { OutViewType& out, KokkosFFT::Direction direction, int axis, std::optional n = std::nullopt) : m_exec_space(exec_space), m_axes({axis}), m_direction(direction) { - static_assert(Kokkos::is_view::value, - "Plan::Plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "Plan::Plan: OutViewType is not a Kokkos::View."); static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "Plan::Plan: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "Plan::Plan: OutViewType must be either LayoutLeft or LayoutRight."); - - static_assert(InViewType::rank() == OutViewType::rank(), - "Plan::Plan: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "Plan::Plan: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename InViewType::memory_space>::accessible, - "Plan::Plan: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "Plan::Plan: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "Plan::Plan: InViewType and OutViewType must have the same base " + "floating point type (float/double), the same layout " + "(LayoutLeft/LayoutRight), " + "and the same rank. ExecutionSpace must be accessible to the data in " + "InViewType and OutViewType."); if (KokkosFFT::Impl::is_real_v && m_direction != KokkosFFT::Direction::forward) { @@ -230,34 +212,14 @@ class Plan { OutViewType& out, KokkosFFT::Direction direction, axis_type axes, shape_type s = {0}) : m_exec_space(exec_space), m_axes(axes), m_direction(direction) { - static_assert(Kokkos::is_view::value, - "Plan::Plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "Plan::Plan: OutViewType is not a Kokkos::View."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "Plan::Plan: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "Plan::Plan: OutViewType must be either LayoutLeft or LayoutRight."); - - static_assert(InViewType::rank() == OutViewType::rank(), - "Plan::Plan: InViewType and OutViewType must have " - "the same rank."); - - static_assert(std::is_same_v, - "Plan::Plan: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename InViewType::memory_space>::accessible, - "Plan::Plan: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "Plan::Plan: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "Plan::Plan: InViewType and OutViewType must have the same base " + "floating point type (float/double), the same layout " + "(LayoutLeft/LayoutRight), " + "and the same rank. ExecutionSpace must be accessible to the data in " + "InViewType and OutViewType."); if (std::is_floating_point::value && m_direction != KokkosFFT::Direction::forward) { @@ -302,15 +264,6 @@ class Plan { /// \param out [in] Ouput data template void good(const InViewType2& in, const OutViewType2& out) const { - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename InViewType2::memory_space>::accessible, - "Plan::good: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType2::memory_space>::accessible, - "Plan::good: execution_space cannot access data in OutViewType"); - using nonConstInViewType2 = std::remove_cv_t; using nonConstOutViewType2 = std::remove_cv_t; static_assert(std::is_same_v, diff --git a/fft/src/KokkosFFT_Transform.hpp b/fft/src/KokkosFFT_Transform.hpp index c8ac41b2..6e9ca1f9 100644 --- a/fft/src/KokkosFFT_Transform.hpp +++ b/fft/src/KokkosFFT_Transform.hpp @@ -7,6 +7,7 @@ #include #include "KokkosFFT_default_types.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_utils.hpp" #include "KokkosFFT_normalization.hpp" #include "KokkosFFT_transpose.hpp" @@ -50,37 +51,9 @@ template void exec_impl( const PlanType& plan, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward) { - static_assert(Kokkos::is_view::value, - "exec_impl: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "exec_impl: OutViewType is not a Kokkos::View."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "exec_impl: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "exec_impl: OutViewType must be either LayoutLeft or LayoutRight."); - - static_assert(InViewType::rank() == OutViewType::rank(), - "exec_impl: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "exec_impl: InViewType and OutViewType must have " - "the same Layout."); - - using ExecutionSpace = typename PlanType::execSpace; - static_assert( - Kokkos::SpaceAccessibility::accessible, - "exec_impl: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "exec_impl: execution_space cannot access data in OutViewType"); - using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; + using ExecutionSpace = typename PlanType::execSpace; auto* idata = reinterpret_cast::type*>(in.data()); @@ -99,34 +72,15 @@ void fft_exec_impl( const PlanType& plan, const InViewType& in, OutViewType& out, // KokkosFFT::Direction direction, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward) { - static_assert(Kokkos::is_view::value, - "fft_exec_impl: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "fft_exec_impl: OutViewType is not a Kokkos::View."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "fft_exec_impl: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "fft_exec_impl: OutViewType must be either LayoutLeft or LayoutRight."); - - static_assert(InViewType::rank() == OutViewType::rank(), - "fft_exec_impl: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "fft_exec_impl: InViewType and OutViewType must have " - "the same Layout."); - using ExecutionSpace = typename PlanType::execSpace; static_assert( - Kokkos::SpaceAccessibility::accessible, - "fft_exec_impl: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "fft_exec_impl: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "fft_exec_impl: InViewType and OutViewType must have the same base " + "floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); plan.template good(in, out); @@ -178,30 +132,13 @@ void fft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "fft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "fft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "fft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "fft: InViewType and OutViewType must have " - "the same Layout."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "fft: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "fft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "fft: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::forward, axis, n); @@ -221,30 +158,13 @@ void ifft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "ifft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "ifft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "ifft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "ifft: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "ifft: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "ifft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "ifft: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::backward, axis, n); @@ -264,30 +184,13 @@ void rfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "rfft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "rfft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "rfft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "rfft: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "rfft: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "rfft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "rfft: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -313,30 +216,14 @@ void irfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "irfft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "irfft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "irfft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rifft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "irfft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "irfft: InViewType and OutViewType must have " - "the same Layout."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "irfft: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "irfft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "irfft: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -361,30 +248,13 @@ void hfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "hfft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "hfft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "hfft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "hfft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "hfft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "hfft: InViewType and OutViewType must have " - "the same Layout."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "hfft: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "hfft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "hfft: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); // [TO DO] // allow real type as input, need to obtain complex view type from in view @@ -417,30 +287,14 @@ void ihfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, int axis = -1, std::optional n = std::nullopt) { - static_assert(Kokkos::is_view::value, - "ihfft: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "ihfft: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ihfft: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ihfft: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "ihfft: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "ihfft: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "ihfft: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "ihfft: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "ihfft: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -471,30 +325,13 @@ void fft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, axis_type<2> axes = {-2, -1}, shape_type<2> s = {0}) { - static_assert(Kokkos::is_view::value, - "fft2: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "fft2: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fft2: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fft2: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "fft2: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "fft2: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "fft2: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "fft2: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "fft2: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::forward, axes, s); @@ -514,30 +351,14 @@ void ifft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, axis_type<2> axes = {-2, -1}, shape_type<2> s = {0}) { - static_assert(Kokkos::is_view::value, - "ifft2: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "ifft2: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifft2: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifft2: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "ifft2: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "ifft2: InViewType and OutViewType must have " - "the same Layout."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "ifft2: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "ifft2: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "ifft2: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::backward, axes, s); @@ -557,31 +378,14 @@ void rfft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, axis_type<2> axes = {-2, -1}, shape_type<2> s = {0}) { - static_assert(Kokkos::is_view::value, - "rfft2: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "rfft2: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfft2: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfft2: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "rfft2: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "rfft2: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "rfft2: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "rfft2: execution_space cannot access data in OutViewType"); - + KokkosFFT::Impl::are_operatable_views_v, + "rfft2: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -606,31 +410,14 @@ void irfft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, axis_type<2> axes = {-2, -1}, shape_type<2> s = {0}) { - static_assert(Kokkos::is_view::value, - "irfft2: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "irfft2: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "irfft2: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "irfft2: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "irfft2: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "irfft2: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "irfft2: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "irfft2: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "irfft2: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -659,30 +446,13 @@ void fftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type axes, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, shape_type s = {0}) { - static_assert(Kokkos::is_view::value, - "fftn: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "fftn: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fftn: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "fftn: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "fftn: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "fftn: InViewType and OutViewType must have " - "the same Layout."); - static_assert( - Kokkos::SpaceAccessibility::accessible, - "fftn: execution_space cannot access data in InViewType"); - static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "fftn: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "fftn: InViewType and OutViewType must have the same base floating point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::forward, axes, s); @@ -703,30 +473,14 @@ void ifftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type axes, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, shape_type s = {0}) { - static_assert(Kokkos::is_view::value, - "ifftn: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "ifftn: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifftn: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "ifftn: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "ifftn: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "ifftn: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "ifftn: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "ifftn: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "ifftn: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); KokkosFFT::Impl::Plan plan(exec_space, in, out, KokkosFFT::Direction::backward, axes, s); @@ -747,30 +501,14 @@ void rfftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type axes, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, shape_type s = {0}) { - static_assert(Kokkos::is_view::value, - "rfftn: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "rfftn: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfftn: InViewType must be either LayoutLeft or LayoutRight."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "rfftn: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "rfftn: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "rfftn: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "rfftn: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "rfftn: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "rfftn: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type; @@ -797,31 +535,14 @@ void irfftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type axes, KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward, shape_type s = {0}) { - static_assert(Kokkos::is_view::value, - "irfftn: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "irfftn: OutViewType is not a Kokkos::View."); - static_assert(KokkosFFT::Impl::is_layout_left_or_right_v, - "irfftn: InViewType must be either LayoutLeft or LayoutRight."); - static_assert( - KokkosFFT::Impl::is_layout_left_or_right_v, - "irfftn: OutViewType must be either LayoutLeft or LayoutRight."); - static_assert(InViewType::rank() == OutViewType::rank(), - "irfftn: InViewType and OutViewType must have " - "the same rank."); - static_assert(std::is_same_v, - "irfftn: InViewType and OutViewType must have " - "the same Layout."); - - static_assert( - Kokkos::SpaceAccessibility::accessible, - "irfftn: execution_space cannot access data in InViewType"); static_assert( - Kokkos::SpaceAccessibility< - ExecutionSpace, typename OutViewType::memory_space>::accessible, - "irfftn: execution_space cannot access data in OutViewType"); + KokkosFFT::Impl::are_operatable_views_v, + "irfftn: InViewType and OutViewType must have the same base floating " + "point " + "type (float/double), the same layout (LayoutLeft/LayoutRight), and the " + "same rank. ExecutionSpace must be accessible to the data in InViewType " + "and OutViewType."); using in_value_type = typename InViewType::non_const_value_type; using out_value_type = typename OutViewType::non_const_value_type;