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);
171 typename multivec_t::impl_scalar_type * getMVPointer_impl()
const;
176 Teuchos::RCP<multivec_t>
208 get1dCopy (
const Teuchos::ArrayView<scalar_t>& A,
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,
237 Teuchos::ArrayRCP<scalar_t> get1dViewNonConst (
bool local =
false);
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,
267 std::string description ()
const;
271 describe (Teuchos::FancyOStream& os,
272 const Teuchos::EVerbosityLevel verbLevel =
273 Teuchos::Describable::verbLevel_default)
const;
277 Teuchos::RCP<multivec_t>
mv_;
280 typedef Tpetra::Export<local_ordinal_t, global_ordinal_t, node_t>
export_type;
283 typedef Tpetra::Import<local_ordinal_t, global_ordinal_t, node_t>
import_type;
305 #endif // AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
size_t getStride() const
Return the stride between vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:142
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:299
global_size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:135
bool isLocallyIndexed() const
Checks whether this multivector is local to the calling node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:85
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:120
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:277
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:283
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:280
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::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:291
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:113
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
EDistribution
Definition: Amesos2_TypeDecl.hpp:89
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:127
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:142
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
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:149