53 #ifndef AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
54 #define AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
56 #include <Teuchos_RCP.hpp>
57 #include <Teuchos_Array.hpp>
58 #include <Teuchos_as.hpp>
59 #include <Tpetra_MultiVector.hpp>
60 #include <Tpetra_Vector_decl.hpp>
62 #include "Amesos2_MultiVecAdapter_decl.hpp"
71 template<
typename Scalar,
72 typename LocalOrdinal,
73 typename GlobalOrdinal,
82 typedef Tpetra::MultiVector<Scalar,
86 typedef Scalar scalar_t;
87 typedef LocalOrdinal local_ordinal_t;
88 typedef GlobalOrdinal global_ordinal_t;
90 typedef Tpetra::global_size_t global_size_t;
92 friend Teuchos::RCP<MultiVecAdapter<multivec_t> > createMultiVecAdapter<> (Teuchos::RCP<multivec_t>);
93 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<> (Teuchos::RCP<const multivec_t>);
95 static const char* name;
121 if(getComm()->getSize() == 1){
128 bool isGloballyIndexed()
const;
131 Teuchos::RCP<
const Tpetra::Map<
137 return mv_->getMap();
141 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const
143 return mv_->getMap()->getComm();
149 return Teuchos::as<size_t>(mv_->getLocalLength());
156 return mv_->getNumVectors();
163 return mv_->getGlobalLength();
171 return Teuchos::as<global_size_t>(mv_->getNumVectors());
178 return mv_->getStride();
185 return mv_->isConstantStride();
190 Teuchos::RCP<const Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
193 return mv_->getVector(j);
198 Teuchos::RCP<Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
201 return mv_->getVectorNonConst(j);
205 typename multivec_t::impl_scalar_type * getMVPointer_impl()
const;
236 get1dCopy (
const Teuchos::ArrayView<scalar_t>& A,
238 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
240 node_t> > distribution_map,
256 Teuchos::ArrayRCP<scalar_t> get1dViewNonConst (
bool local =
false);
268 put1dData (
const Teuchos::ArrayView<const scalar_t>& new_data,
270 Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,
272 node_t> > source_map,
276 std::string description ()
const;
280 describe (Teuchos::FancyOStream& os,
281 const Teuchos::EVerbosityLevel verbLevel =
282 Teuchos::Describable::verbLevel_default)
const;
286 Teuchos::RCP<multivec_t>
mv_;
289 typedef Tpetra::Export<local_ordinal_t, global_ordinal_t, node_t>
export_type;
292 typedef Tpetra::Import<local_ordinal_t, global_ordinal_t, node_t>
import_type;
314 #endif // AMESOS2_TPETRA_MULTIVEC_ADAPTER_DECL_HPP
size_t getStride() const
Return the stride between vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:176
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:308
global_size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:169
bool isLocallyIndexed() const
Checks whether this multivector is local to the calling node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:119
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:154
Teuchos::RCP< multivec_t > mv_
The multivector which this adapter wraps.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:286
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:292
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:289
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this multi-vector.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:141
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:300
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:147
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:191
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:161
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176
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:199
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition: Amesos2_TpetraMultiVecAdapter_decl.hpp:183