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>
33 typedef Kokkos::DualView<const ValueType*, DeviceType> input_dual_view_type;
34 typedef typename input_dual_view_type::t_dev::non_const_type out_dev_view_type;
35 typedef typename input_dual_view_type::t_host::non_const_type out_host_view_type;
37 out_dev_view_type output_view_dev(const_cast<ValueType*>(input_dv.view_device().data()),
38 input_dv.view_device().extent(0));
39 out_host_view_type output_view_host(const_cast<ValueType*>(input_dv.view_host().data()),
40 input_dv.view_host().extent(0));
42 Kokkos::DualView<ValueType*, DeviceType> output_dv(output_view_dev, output_view_host);
43 if (input_dv.need_sync_host()) output_dv.modify_device();
44 if (input_dv.need_sync_device()) output_dv.modify_host();
51 #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.