19#ifndef AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
20#define AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
29 template <
typename Scalar,
typename ExecutionSpace >
31 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
::MultiVecAdapter(
const Teuchos::RCP<multivec_t>& m )
35 template <
typename Scalar,
typename ExecutionSpace >
36 Teuchos::RCP< Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
38 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::clone()
const
40 using MV = Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>;
41 MV Y(
"clonedY", mv_->extent(0), mv_->extent(1));
42 return Teuchos::rcp( &Y );
45 template <
typename Scalar,
typename ExecutionSpace >
50 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"getMVPointer_impl not implemented.");
53 template <
typename Scalar,
typename ExecutionSpace >
56 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
::get1dCopy(
const Teuchos::ArrayView<scalar_t>& av,
59 const Tpetra::Map<local_ordinal_t, global_ordinal_t,
60 MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>>::node_t>> distribution_map,
63 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"get1dCopy for kokkos not implemented.");
66 template <
typename Scalar,
typename ExecutionSpace >
67 Teuchos::ArrayRCP<Scalar>
71 TEUCHOS_TEST_FOR_EXCEPTION(
72 true, std::logic_error,
"Amesos2::MultiVecAdapter::get1dViewNonConst: "
76 template <
typename Scalar,
typename ExecutionSpace>
79 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
::put1dData(
80 const Teuchos::ArrayView<const scalar_t>& new_data,
83 const Tpetra::Map<local_ordinal_t, global_ordinal_t,
84 MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>>::node_t> > source_map,
87 TEUCHOS_TEST_FOR_EXCEPTION(
88 true, std::logic_error,
"Amesos2::MultiVecAdapter::put1dData: "
92 template <
typename Scalar,
typename ExecutionSpace>
93 template<
typename KV,
typename host_ordinal_type_array>
96 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::gather (
98 host_ordinal_type_array &perm_g2l,
99 host_ordinal_type_array &recvCountRows,
100 host_ordinal_type_array &recvDisplRows,
106 template <
typename Scalar,
typename ExecutionSpace>
107 template<
typename KV,
typename host_ordinal_type_array>
110 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::scatter (
112 host_ordinal_type_array &perm_g2l,
113 host_ordinal_type_array &recvCountRows,
114 host_ordinal_type_array &recvDisplRows,
120 template <
typename Scalar,
typename ExecutionSpace >
123 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
::description()
const
125 std::ostringstream oss;
126 oss <<
"Amesos2 adapter wrapping: ";
127 oss <<
mv_->description();
132 template <
typename Scalar,
typename ExecutionSpace >
135 Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
::describe (Teuchos::FancyOStream& os,
136 const Teuchos::EVerbosityLevel verbLevel)
const
138 mv_->describe (os, verbLevel);
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.
Copy or assign views based on memory spaces.
void put1dData(const Teuchos::ArrayView< const scalar_t > &new_data, size_t lda, Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > distribution_map, EDistribution) const
Export data into the global MultiVector space.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:79
Scalar * getMVPointer_impl() const
Return pointer to vector when number of vectors == 1 and single MPI process.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:48
void describe(Teuchos::FancyOStream &os, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print a description of this adapter to the given output stream.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:135
void get1dCopy(const Teuchos::ArrayView< scalar_t > &av, size_t lda, Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > distribution_map, EDistribution distribution) const
Copies the multivector's data into the user-provided vector.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:56
MultiVecAdapter(const MultiVecAdapter< multivec_t > &adapter)
Copy constructor.
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition Amesos2_KokkosMultiVecAdapter_decl.hpp:281
std::string description() const
Get a short description of this adapter class.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:123
Teuchos::ArrayRCP< scalar_t > get1dViewNonConst(bool local=false)
Extracts a 1 dimensional view of this MultiVector's data.
Definition Amesos2_KokkosMultiVecAdapter_def.hpp:69
EDistribution
Definition Amesos2_TypeDecl.hpp:89
A templated MultiVector class adapter for Amesos2.
Definition Amesos2_MultiVecAdapter_decl.hpp:142