53 #ifndef AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
54 #define AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
56 #include <Teuchos_RCP.hpp>
57 #include <Teuchos_Array.hpp>
58 #include <Teuchos_as.hpp>
59 #include <Tpetra_Core.hpp>
61 #include "Amesos2_MultiVecAdapter_decl.hpp"
71 template<
typename Scalar,
72 typename ExecutionSpace >
73 class MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
77 typedef Tpetra::Map<>::node_type node_t;
78 typedef Kokkos::View<Scalar**,Kokkos::LayoutLeft, ExecutionSpace> multivec_t;
79 typedef int local_ordinal_t;
80 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
81 typedef size_t global_size_t;
82 typedef Scalar scalar_t;
84 typedef Kokkos::View<scalar_t**, Kokkos::LayoutLeft, ExecutionSpace> kokkos_view_t;
86 friend Teuchos::RCP<MultiVecAdapter<multivec_t> > createMultiVecAdapter<> (Teuchos::RCP<multivec_t>);
87 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<> (Teuchos::RCP<const multivec_t>);
89 static const char* name;
115 if(getComm()->getSize() == 1){
121 bool isGloballyIndexed()
const;
123 Teuchos::RCP<
const Tpetra::Map<
129 return Teuchos::null;
133 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
135 return Tpetra::getDefaultComm();
141 return mv_->extent(0);
148 return mv_->extent(1);
155 return mv_->extent(0);
162 return mv_->extent(1);
169 return mv_->getStride();
176 return mv_->isConstantStride();
180 Scalar * getMVPointer_impl()
const;
211 get1dCopy (
const Teuchos::ArrayView<scalar_t>& av,
214 const Tpetra::Map<local_ordinal_t,
216 node_t> > distribution_map,
219 template<
typename KV>
221 get1dCopy_kokkos_view (KV& kokkos_view,
224 const Tpetra::Map<local_ordinal_t,
226 node_t> > distribution_map,
228 deep_copy_or_assign_view(kokkos_view, *mv_);
244 Teuchos::ArrayRCP<scalar_t> get1dViewNonConst (
bool local =
false);
256 put1dData (
const Teuchos::ArrayView<const scalar_t>& new_data,
259 const Tpetra::Map<local_ordinal_t,
261 node_t> > distribution_map,
264 template<
typename KV>
266 put1dData_kokkos_view (KV& kokkos_new_data,
269 const Tpetra::Map<local_ordinal_t,
271 node_t> > distribution_map,
273 deep_copy_or_assign_view(*mv_, kokkos_new_data);
278 std::string description ()
const;
282 describe (Teuchos::FancyOStream& os,
283 const Teuchos::EVerbosityLevel verbLevel =
284 Teuchos::Describable::verbLevel_default)
const;
289 Teuchos::RCP<multivec_t>
mv_;
292 typedef Tpetra::Export<local_ordinal_t, global_ordinal_t, node_t>
export_type;
295 typedef Tpetra::Import<local_ordinal_t, global_ordinal_t, node_t>
import_type;
318 #endif // AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DECL_HPP
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:289
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:153
global_size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:160
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:146
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:174
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this multi-vector.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:133
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:311
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:292
size_t getStride() const
Return the stride between vectors on this node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:167
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:303
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:295
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:139
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176
bool isLocallyIndexed() const
Checks whether this multivector is local to the calling node.
Definition: Amesos2_KokkosMultiVecAdapter_decl.hpp:113