Skip to content

Commit

Permalink
add aliases from ViewTraits to new mdspan-based View
Browse files Browse the repository at this point in the history
  • Loading branch information
nmm0 committed Jul 10, 2024
1 parent ceded76 commit e7635dd
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions core/src/Kokkos_View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,
namespace Impl {
template<class ... Properties>
struct BasicViewFromTraits {
using view_traits = ViewTraits<Properties...>;
using view_traits = ViewTraits<Properties...>;
using mdspan_view_traits = MDSpanViewTraits<view_traits>;
using element_type = typename view_traits::value_type;
using extents_type = typename mdspan_view_traits::extents_type;
using layout_type = typename mdspan_view_traits::mdspan_layout_type;
using accessor_type = typename mdspan_view_traits::accessor_type;
using element_type = typename view_traits::value_type;
using extents_type = typename mdspan_view_traits::extents_type;
using layout_type = typename mdspan_view_traits::mdspan_layout_type;
using accessor_type = typename mdspan_view_traits::accessor_type;

using type = BasicView<element_type,extents_type,layout_type,accessor_type>;
using type =
BasicView<element_type, extents_type, layout_type, accessor_type>;
};
} // namespace Impl

Expand Down Expand Up @@ -148,16 +149,18 @@ class View : public Impl::BasicViewFromTraits<DataType, Properties...>::type {

public:
// typedefs originally from ViewTraits
using data_type = DataType;
using traits = ViewTraits<DataType, Properties...>;
using view_tracker_type = Impl::ViewTracker<View>;
using array_layout = typename traits::array_layout;
using device_type = typename traits::device_type;

using data_type = DataType;
using traits = ViewTraits<DataType, Properties...>;
using const_data_type = typename traits::const_data_type;
using non_const_data_type = typename traits::non_const_data_type;
using view_tracker_type = Impl::ViewTracker<View>;
using array_layout = typename traits::array_layout;
using device_type = typename traits::device_type;

// typedefs from BasicView
using mdspan_type = typename base_t::mdspan_type;
using pointer_type = typename base_t::data_handle_type;
using reference_type = typename base_t::reference;
using mdspan_type = typename base_t::mdspan_type;
using pointer_type = typename base_t::data_handle_type;
using reference_type = typename base_t::reference;

//----------------------------------------
/** \brief Compatible view of array of scalar types */
Expand Down

0 comments on commit e7635dd

Please sign in to comment.