53#ifndef AMESOS2_EPETRA_MULTIVEC_ADAPTER_DECL_HPP
54#define AMESOS2_EPETRA_MULTIVEC_ADAPTER_DECL_HPP
56#include <Teuchos_RCP.hpp>
57#include <Teuchos_Array.hpp>
58#include <Teuchos_as.hpp>
60#include <Tpetra_Vector.hpp>
61#include <Tpetra_Map.hpp>
63#include <Epetra_MultiVector.h>
65#include "Amesos2_MultiVecAdapter_decl.hpp"
81 typedef double scalar_t;
82 typedef int local_ordinal_t;
83 typedef Tpetra::Map<>::global_ordinal_type global_ordinal_t;
84 typedef size_t global_size_t;
85 typedef Tpetra::Map<>::node_type node_t;
86 typedef Epetra_MultiVector multivec_t;
89 friend Teuchos::RCP<const MultiVecAdapter<multivec_t> > createConstMultiVecAdapter<>(Teuchos::RCP<const multivec_t>);
92 static const char* name;
115 bool isGloballyIndexed()
const;
118 Teuchos::RCP<Epetra_MultiVector> clone()
const;
126 Teuchos::RCP<const Tpetra::Map<local_ordinal_t, global_ordinal_t, node_t> >
130 const Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const;
158 Teuchos::RCP<const Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
169 Teuchos::RCP<Tpetra::Vector<scalar_t,local_ordinal_t,global_ordinal_t,node_t> >
181 void get1dCopy(
const Teuchos::ArrayView<scalar_t>& A,
184 const Tpetra::Map<local_ordinal_t,
186 node_t> > distribution_map,
189 template<
typename KV>
190 bool get1dCopy_kokkos_view(
bool bInitialize, KV & A,
193 const Tpetra::Map<local_ordinal_t,
195 node_t> > distribution_map,
197 Kokkos::View<double**, Kokkos::LayoutLeft, Kokkos::HostSpace> host_new_data;
198 get1dCopy_kokkos_view_host(host_new_data, lda, distribution_map, distribution);
200 deep_copy_or_assign_view(bInitialize, A, host_new_data, bAssigned);
204 void get1dCopy_kokkos_view_host(
205 Kokkos::View<scalar_t**, Kokkos::LayoutLeft, Kokkos::HostSpace> & new_data,
208 const Tpetra::Map<local_ordinal_t,
210 node_t> > distribution_map,
243 void put1dData(
const Teuchos::ArrayView<const scalar_t>& new_data,
246 const Tpetra::Map<local_ordinal_t,
248 node_t> > source_map,
251 template<
typename KV>
252 void put1dData_kokkos_view(
256 const Tpetra::Map<local_ordinal_t,
258 node_t> > source_map,
260 Kokkos::View<scalar_t**, Kokkos::LayoutLeft, Kokkos::HostSpace> host_new_data(
261 Kokkos::ViewAllocateWithoutInitializing(
"host_new_data"),
262 new_data.extent(0), new_data.extent(1));
263 Kokkos::deep_copy(host_new_data, new_data);
264 put1dData_kokkos_view_host(host_new_data, lda, source_map, distribution);
267 void put1dData_kokkos_view_host(
268 Kokkos::View<scalar_t**, Kokkos::LayoutLeft, Kokkos::HostSpace> & new_data,
271 const Tpetra::Map<local_ordinal_t,
273 node_t> > source_map,
281 void describe( Teuchos::FancyOStream& os,
282 const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const;
288 Teuchos::RCP<multivec_t>
mv_;
290 mutable Teuchos::RCP<Epetra_Import> importer_;
291 mutable Teuchos::RCP<Epetra_Export> exporter_;
293 mutable Teuchos::RCP<const Epetra_BlockMap> mv_map_;
Copy or assign views based on memory spaces.
Teuchos::RCP< multivec_t > mv_
The multi-vector this adapter wraps.
Definition Amesos2_EpetraMultiVecAdapter_decl.hpp:288
bool isLocallyIndexed() const
Checks whether this multi-vector is local to the calling node.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:92
bool isConstantStride() const
Return true if this MV has constant stride between vectors on this node.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:141
size_t getGlobalNumVectors() const
Get the number of global vectors.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:129
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 newVals into the global MultiVector space.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:373
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the Teuchos::Comm object associated with this multi-vector.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:104
size_t getLocalNumVectors() const
Get the number of vectors on this node.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:116
size_t getLocalLength() const
Get the length of vectors local to the calling node.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:110
Teuchos::ArrayRCP< scalar_t > get1dViewNonConst(bool local=false)
Extracts a 1 dimensional view of this multi-vector's data.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:317
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_EpetraMultiVecAdapter_def.hpp:151
size_t getStride() const
Return the stride between vectors on this node.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:135
std::string description() const
Get a short description of this adapter class.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:445
void describe(Teuchos::FancyOStream &os, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print a description of this adapter to the Fancy Output Stream.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:453
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 multi-vector's data into the user-provided vector.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:221
Teuchos::RCP< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > getMap() const
Get a Tpetra::Map that describes this MultiVector.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:468
double * getMVPointer_impl() const
Return pointer to vector when number of vectors == 1 and num procs == 1.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:210
Teuchos::RCP< Tpetra::Vector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > > getVectorNonConst(size_t j)
Nonconst vector access.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:183
global_size_t getGlobalLength() const
Get the length of vectors in the global space.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:123
MultiVecAdapter(const MultiVecAdapter< multivec_t > &adapter)
Copy constructor.
Definition Amesos2_EpetraMultiVecAdapter_def.hpp:71
EDistribution
Definition Amesos2_TypeDecl.hpp:123
Teuchos::RCP< MultiVecAdapter< MV > > createMultiVecAdapter(Teuchos::RCP< MV > mv)
Factory creation method for MultiVecAdapters.
Definition Amesos2_MultiVecAdapter_decl.hpp:188