10 #ifndef TPETRA_DETAILS_CASTAWAYCONSTDUALVIEW_HPP
11 #define TPETRA_DETAILS_CASTAWAYCONSTDUALVIEW_HPP
21 #include "Kokkos_DualView.hpp"
30 template<
class ValueType,
class DeviceType>
31 Kokkos::DualView<ValueType*, DeviceType>
34 typedef Kokkos::DualView<const ValueType*, DeviceType> input_dual_view_type;
35 typedef typename input_dual_view_type::t_dev::non_const_type out_dev_view_type;
36 typedef typename input_dual_view_type::t_host::non_const_type out_host_view_type;
38 out_dev_view_type output_view_dev
39 (const_cast<ValueType*> (input_dv.d_view.data ()),
40 input_dv.d_view.extent (0));
41 out_host_view_type output_view_host
42 (const_cast<ValueType*> (input_dv.h_view.data ()),
43 input_dv.h_view.extent (0));
45 Kokkos::DualView<ValueType*, DeviceType> output_dv(output_view_dev,output_view_host);
46 if(input_dv.need_sync_host()) output_dv.modify_device();
47 if(input_dv.need_sync_device()) output_dv.modify_host();
54 #endif // TPETRA_DETAILS_CASTAWAYCONSTDUALVIEW_HPP
Kokkos::DualView< ValueType *, DeviceType > castAwayConstDualView(const Kokkos::DualView< const ValueType *, DeviceType > &input_dv)
Cast away const-ness of a 1-D Kokkos::DualView.