19#ifndef AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
20#define AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
22#include <Teuchos_RCP.hpp>
23#include <Teuchos_Array.hpp>
24#include <Teuchos_as.hpp>
25#include <Tpetra_MultiVector.hpp>
26#include <Tpetra_Vector_decl.hpp>
28#include "Amesos2_MultiVecAdapter_decl.hpp"
37 template<
typename Scalar,
38 typename LocalOrdinal,
39 typename GlobalOrdinal,
48 typedef Tpetra::MultiVector<Scalar,
52 typedef Scalar scalar_t;
53 typedef LocalOrdinal local_ordinal_t;
54 typedef GlobalOrdinal global_ordinal_t;
56 typedef Tpetra::global_size_t global_size_t;
58 friend Teuchos::RCP<MultiVecAdapter<multivec_t> > createMultiVecAdapter<> (Teuchos::RCP<multivec_t>);
59 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<> (Teuchos::RCP<const multivec_t>);
61 static const char* name;
87 if(getComm()->getSize() == 1){
94 bool isGloballyIndexed()
const;
97 Teuchos::RCP<
const Tpetra::Map<
103 return mv_->getMap();
107 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
109 return mv_->getMap()->getComm();
115 return Teuchos::as<size_t>(mv_->getLocalLength());
122 return mv_->getNumVectors();
129 return mv_->getGlobalLength();
137 return Teuchos::as<global_size_t>(mv_->getNumVectors());
144 return mv_->getStride();
151 return mv_->isConstantStride();
156 Teuchos::RCP<const Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
159 return mv_->getVector(j);
164 Teuchos::RCP<Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
167 return mv_->getVectorNonConst(j);
176 Teuchos::RCP<multivec_t>
210 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
212 node_t> > distribution_map,
215 template<
typename KV>
217 get1dCopy_kokkos_view (
bool bInitialize, KV& v,
219 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
221 node_t> > distribution_map,
249 put1dData (
const Teuchos::ArrayView<const scalar_t>& new_data,
251 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
253 node_t> > source_map,
256 template<
typename KV>
258 put1dData_kokkos_view (KV& kokkos_new_data,
260 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
262 node_t> > source_map,
265 template<
typename KV,
typename host_ordinal_type_array>
267 gather (KV& kokkos_new_view,
268 host_ordinal_type_array &perm_g2l,
269 host_ordinal_type_array &recvCountRows,
270 host_ordinal_type_array &recvDisplRows,
273 template<
typename KV,
typename host_ordinal_type_array>
275 scatter (KV& kokkos_new_view,
276 host_ordinal_type_array &perm_g2l,
277 host_ordinal_type_array &recvCountRows,
278 host_ordinal_type_array &recvDisplRows,
288 const Teuchos::EVerbosityLevel verbLevel =
289 Teuchos::Describable::verbLevel_default)
const;
293 Teuchos::RCP<multivec_t>
mv_;
294 mutable typename multivec_t::host_view_type buf_;
297 typedef Tpetra::Export<local_ordinal_t, global_ordinal_t, node_t>
export_type;
300 typedef Tpetra::Import<local_ordinal_t, global_ordinal_t, node_t>
import_type;
EDistribution
Definition Amesos2_TypeDecl.hpp:89
Tpetra::Import< local_ordinal_t, global_ordinal_t, node_t > import_type
The Tpetra::Import specialization used by this class.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:300
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 > > source_map, EDistribution distribution)
Export data into the global MultiVector space.
multivec_t::impl_scalar_type * getMVPointer_impl() const
Return pointer to vector when number of vectors == 1 and single MPI process.
Teuchos::RCP< const Tpetra::Vector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > > getVector(size_t j) const
Const vector access.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:157
Teuchos::RCP< Tpetra::Vector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > > getVectorNonConst(size_t j)
Nonconst vector access.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:165
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:127
std::string description() const
Get a short description of this adapter class.
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:293
Tpetra::Export< local_ordinal_t, global_ordinal_t, node_t > export_type
The Tpetra::Export specialization used by this class.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:297
Teuchos::RCP< export_type > exporter_
Used for data redistribution from the user's input MultiVector to the solver's input MultiVector.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:308
MultiVecAdapter(const MultiVecAdapter< multivec_t > &adapter)
Copy constructor.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this multi-vector.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:107
Teuchos::ArrayRCP< scalar_t > get1dViewNonConst(bool local=false)
Extracts a 1 dimensional view of this MultiVector's data.
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:120
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.
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:113
bool isLocallyIndexed() const
Checks whether this multivector is local to the calling node.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:85
size_t getStride() const
Return the stride between vectors on this node.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:142
void get1dCopy(const Teuchos::ArrayView< scalar_t > &A, 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.
MultiVecAdapter(const Teuchos::RCP< multivec_t > &m)
Initialize an adapter from a multi-vector RCP.
Teuchos::RCP< import_type > importer_
Used for data redistribution from the solver's output MultiVector to the user's output MultiVector.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:316
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:149
global_size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition Amesos2_TpetraMultiVecAdapter_decl.hpp:135
Teuchos::RCP< multivec_t > clone() const
Clone the multivector.
A templated MultiVector class adapter for Amesos2.
Definition Amesos2_MultiVecAdapter_decl.hpp:142