7
7
8
8
#include < Kokkos_Core.hpp>
9
9
#include " KokkosFFT_common_types.hpp"
10
+ #include " KokkosFFT_traits.hpp"
10
11
#include " KokkosFFT_utils.hpp"
11
12
12
13
namespace KokkosFFT {
@@ -131,16 +132,6 @@ void roll(const ExecutionSpace& exec_space, ViewType& inout, axis_type<2> shift,
131
132
template <typename ExecutionSpace, typename ViewType, std::size_t DIM = 1 >
132
133
void fftshift_impl (const ExecutionSpace& exec_space, ViewType& inout,
133
134
axis_type<DIM> axes) {
134
- static_assert (Kokkos::is_view<ViewType>::value,
135
- " fftshift_impl: ViewType is not a Kokkos::View." );
136
- static_assert (
137
- KokkosFFT::Impl::is_layout_left_or_right_v<ViewType>,
138
- " fftshift_impl: ViewType must be either LayoutLeft or LayoutRight." );
139
- static_assert (
140
- Kokkos::SpaceAccessibility<ExecutionSpace,
141
- typename ViewType::memory_space>::accessible,
142
- " fftshift_impl: execution_space cannot access data in ViewType" );
143
-
144
135
static_assert (ViewType::rank () >= DIM,
145
136
" fftshift_impl: Rank of View must be larger thane "
146
137
" or equal to the Rank of shift axes." );
@@ -151,16 +142,6 @@ void fftshift_impl(const ExecutionSpace& exec_space, ViewType& inout,
151
142
template <typename ExecutionSpace, typename ViewType, std::size_t DIM = 1 >
152
143
void ifftshift_impl (const ExecutionSpace& exec_space, ViewType& inout,
153
144
axis_type<DIM> axes) {
154
- static_assert (Kokkos::is_view<ViewType>::value,
155
- " ifftshift_impl: ViewType is not a Kokkos::View." );
156
- static_assert (
157
- KokkosFFT::Impl::is_layout_left_or_right_v<ViewType>,
158
- " ifftshift_impl: ViewType must be either LayoutLeft or LayoutRight." );
159
- static_assert (
160
- Kokkos::SpaceAccessibility<ExecutionSpace,
161
- typename ViewType::memory_space>::accessible,
162
- " ifftshift_impl: execution_space cannot access data in ViewType" );
163
-
164
145
static_assert (ViewType::rank () >= DIM,
165
146
" ifftshift_impl: Rank of View must be larger "
166
147
" thane or equal to the Rank of shift axes." );
@@ -243,6 +224,11 @@ auto rfftfreq(const ExecutionSpace&, const std::size_t n,
243
224
template <typename ExecutionSpace, typename ViewType>
244
225
void fftshift (const ExecutionSpace& exec_space, ViewType& inout,
245
226
std::optional<int > axes = std::nullopt) {
227
+ static_assert (KokkosFFT::Impl::is_operatable_view_v<ExecutionSpace, ViewType>,
228
+ " fftshift: View value type must be float, double, "
229
+ " Kokkos::Complex<float>, or Kokkos::Complex<double>. "
230
+ " Layout must be either LayoutLeft or LayoutRight. "
231
+ " ExecutionSpace must be able to access data in ViewType" );
246
232
if (axes) {
247
233
axis_type<1 > _axes{axes.value ()};
248
234
KokkosFFT::Impl::fftshift_impl (exec_space, inout, _axes);
@@ -262,6 +248,11 @@ void fftshift(const ExecutionSpace& exec_space, ViewType& inout,
262
248
template <typename ExecutionSpace, typename ViewType, std::size_t DIM = 1 >
263
249
void fftshift (const ExecutionSpace& exec_space, ViewType& inout,
264
250
axis_type<DIM> axes) {
251
+ static_assert (KokkosFFT::Impl::is_operatable_view_v<ExecutionSpace, ViewType>,
252
+ " fftshift: View value type must be float, double, "
253
+ " Kokkos::Complex<float>, or Kokkos::Complex<double>. "
254
+ " Layout must be either LayoutLeft or LayoutRight. "
255
+ " ExecutionSpace must be able to access data in ViewType" );
265
256
KokkosFFT::Impl::fftshift_impl (exec_space, inout, axes);
266
257
}
267
258
@@ -273,6 +264,11 @@ void fftshift(const ExecutionSpace& exec_space, ViewType& inout,
273
264
template <typename ExecutionSpace, typename ViewType>
274
265
void ifftshift (const ExecutionSpace& exec_space, ViewType& inout,
275
266
std::optional<int > axes = std::nullopt) {
267
+ static_assert (KokkosFFT::Impl::is_operatable_view_v<ExecutionSpace, ViewType>,
268
+ " ifftshift: View value type must be float, double, "
269
+ " Kokkos::Complex<float>, or Kokkos::Complex<double>. "
270
+ " Layout must be either LayoutLeft or LayoutRight. "
271
+ " ExecutionSpace must be able to access data in ViewType" );
276
272
if (axes) {
277
273
axis_type<1 > _axes{axes.value ()};
278
274
KokkosFFT::Impl::ifftshift_impl (exec_space, inout, _axes);
@@ -292,6 +288,11 @@ void ifftshift(const ExecutionSpace& exec_space, ViewType& inout,
292
288
template <typename ExecutionSpace, typename ViewType, std::size_t DIM = 1 >
293
289
void ifftshift (const ExecutionSpace& exec_space, ViewType& inout,
294
290
axis_type<DIM> axes) {
291
+ static_assert (KokkosFFT::Impl::is_operatable_view_v<ExecutionSpace, ViewType>,
292
+ " ifftshift: View value type must be float, double, "
293
+ " Kokkos::Complex<float>, or Kokkos::Complex<double>. "
294
+ " Layout must be either LayoutLeft or LayoutRight. "
295
+ " ExecutionSpace must be able to access data in ViewType" );
295
296
KokkosFFT::Impl::ifftshift_impl (exec_space, inout, axes);
296
297
}
297
298
} // namespace KokkosFFT
0 commit comments