42 #ifndef TPETRA_DETAILS_CASTAWAYCONSTDUALVIEW_HPP
43 #define TPETRA_DETAILS_CASTAWAYCONSTDUALVIEW_HPP
53 #include "Kokkos_DualView.hpp"
62 template<
class ValueType,
class DeviceType>
63 Kokkos::DualView<ValueType*, DeviceType>
66 typedef Kokkos::DualView<const ValueType*, DeviceType> input_dual_view_type;
67 typedef typename input_dual_view_type::t_dev::non_const_type out_dev_view_type;
68 typedef typename input_dual_view_type::t_host::non_const_type out_host_view_type;
70 out_dev_view_type output_view_dev
71 (const_cast<ValueType*> (input_dv.d_view.data ()),
72 input_dv.d_view.extent (0));
73 out_host_view_type output_view_host
74 (const_cast<ValueType*> (input_dv.h_view.data ()),
75 input_dv.h_view.extent (0));
77 Kokkos::DualView<ValueType*, DeviceType> output_dv(output_view_dev,output_view_host);
78 if(input_dv.need_sync_host()) output_dv.modify_device();
79 if(input_dv.need_sync_device()) output_dv.modify_host();
86 #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.