19 #ifndef AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
20 #define AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
22 #include <Teuchos_RCP.hpp>
23 #include <Teuchos_Array.hpp>
24 #include <Teuchos_as.hpp>
25 #include <Tpetra_Core.hpp>
27 #include "Amesos2_MultiVecAdapter_decl.hpp"
37 template<
typename Scalar,
38 typename ExecutionSpace >
39 class MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
43 typedef Tpetra::Map<>::node_type node_t;
44 typedef Kokkos::View<Scalar**,Kokkos::LayoutLeft, ExecutionSpace> multivec_t;
45 typedef int local_ordinal_t;
46 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
47 typedef size_t global_size_t;
48 typedef Scalar scalar_t;
50 typedef Kokkos::View<scalar_t**, Kokkos::LayoutLeft, ExecutionSpace> kokkos_view_t;
52 friend Teuchos::RCP<MultiVecAdapter<multivec_t> > createMultiVecAdapter<> (Teuchos::RCP<multivec_t>);
53 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<> (Teuchos::RCP<const multivec_t>);
55 static const char* name;
81 if(getComm()->getSize() == 1){
87 bool isGloballyIndexed()
const;
89 Teuchos::RCP<
const Tpetra::Map<
99 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
101 return Tpetra::getDefaultComm();
107 return mv_->extent(0);
114 return mv_->extent(1);
121 return mv_->extent(0);
128 return mv_->extent(1);
135 return mv_->getStride();
142 return mv_->isConstantStride();
146 Scalar * getMVPointer_impl()
const;
149 Teuchos::RCP<multivec_t> clone()
const;
180 get1dCopy (
const Teuchos::ArrayView<scalar_t>& av,
183 const Tpetra::Map<local_ordinal_t,
185 node_t> > distribution_map,
188 template<
typename KV>
190 get1dCopy_kokkos_view (
191 bool bInitialize, KV& kokkos_view,
192 [[maybe_unused]]
size_t lda,
193 [[maybe_unused]] Teuchos::Ptr<
194 const Tpetra::Map<local_ordinal_t,
201 deep_copy_or_assign_view(bInitialize, kokkos_view, *mv_, bAssigned);
218 Teuchos::ArrayRCP<scalar_t> get1dViewNonConst (
bool local =
false);
230 put1dData (
const Teuchos::ArrayView<const scalar_t>& new_data,
233 const Tpetra::Map<local_ordinal_t,
235 node_t> > distribution_map,
238 template<
typename KV>
240 put1dData_kokkos_view (
242 [[maybe_unused]]
size_t lda,
243 [[maybe_unused]] Teuchos::Ptr<
244 const Tpetra::Map<local_ordinal_t,
250 deep_copy_or_assign_view(*mv_, kokkos_new_data);
255 std::string description ()
const;
259 describe (Teuchos::FancyOStream& os,
260 const Teuchos::EVerbosityLevel verbLevel =
261 Teuchos::Describable::verbLevel_default)
const;
266 Teuchos::RCP<multivec_t>
mv_;
269 typedef Tpetra::Export<local_ordinal_t, global_ordinal_t, node_t>
export_type;
272 typedef Tpetra::Import<local_ordinal_t, global_ordinal_t, node_t>
import_type;
295 #endif // AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:266
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:119
global_size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:126
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:112
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:140
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this multi-vector.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:99
Teuchos::RCP< import_type > importer_
Used for data redistribution from the solver's output MultiVector to the user's output MultiVector...
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:288
Copy or assign views based on memory spaces.
Tpetra::Export< local_ordinal_t, global_ordinal_t, node_t > export_type
The Tpetra::Export specialization used by this class.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:269
size_t getStride() const
Return the stride between vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:133
Teuchos::RCP< export_type > exporter_
Used for data redistribution from the user's input MultiVector to the solver's input MultiVector...
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:280
Tpetra::Import< local_ordinal_t, global_ordinal_t, node_t > import_type
The Tpetra::Import specialization used by this class.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:272
EDistribution
Definition: Amesos2_TypeDecl.hpp:89
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:105
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:142
bool isLocallyIndexed() const
Checks whether this multivector is local to the calling node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:79