kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
extents.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_VIEW_EXTENTS_HPP
2#define KOKKOS_UTILS_VIEW_EXTENTS_HPP
3
5
12
14{
15
16namespace impl
17{
18
20template <concepts::View ViewType, size_t... Ints>
21KOKKOS_FUNCTION
22constexpr auto extents(const ViewType& view, std::index_sequence<Ints...>)
23{
24 Kokkos::Array<size_t, sizeof...(Ints)> extents {};
25 ((extents[Ints] = view.extent(Ints)), ...);
26 return extents;
27}
28
29} // namespace impl
30
32template <concepts::View ViewType>
33KOKKOS_FUNCTION
34constexpr auto extents(const ViewType& view)
35{
36 constexpr auto rank = ViewType::rank();
37 constexpr auto dims = std::make_index_sequence<rank>{};
38 return impl::extents(view, dims);
39}
40
41} // namespace Kokkos::utils::view
42
43#endif // KOKKOS_UTILS_VIEW_EXTENTS_HPP
Specify that a type is a Kokkos::View.
Definition View.hpp:15
KOKKOS_FUNCTION constexpr auto extents(const ViewType &view, std::index_sequence< Ints... >)
Implementation of Kokkos::utils::view::extents.
Definition extents.hpp:22
KOKKOS_FUNCTION constexpr auto extents(const ViewType &view)
Get all extents of view.
Definition extents.hpp:34