Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Attributes | Friends | List of all members
Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Class Template Reference

Amesos2 adapter for the Tpetra::MultiVector class. More...

#include <Amesos2_TpetraMultiVecAdapter_decl.hpp>

Public Types

typedef Tpetra::MultiVector
< Scalar, LocalOrdinal,
GlobalOrdinal, Node > 
multivec_t
 
typedef Scalar scalar_t
 
typedef LocalOrdinal local_ordinal_t
 
typedef GlobalOrdinal global_ordinal_t
 
typedef Node node_t
 
typedef Tpetra::global_size_t global_size_t
 

Public Member Functions

bool isLocallyIndexed () const
 Checks whether this multivector is local to the calling node.
 
bool isGloballyIndexed () const
 
Teuchos::RCP< const
Tpetra::Map< local_ordinal_t,
global_ordinal_t, node_t > > 
getMap () const
 
Teuchos::RCP< const
Teuchos::Comm< int > > 
getComm () const
 Returns the Teuchos::Comm object associated with this multi-vector.
 
size_t getLocalLength () const
 Get the length of vectors local to the calling node.
 
size_t getLocalNumVectors () const
 Get the number of vectors on this node.
 
global_size_t getGlobalLength () const
 Get the length of vectors in the global space.
 
global_size_t getGlobalNumVectors () const
 Get the number of global vectors.
 
size_t getStride () const
 Return the stride between vectors on this node.
 
bool isConstantStride () const
 Return true if this MV has constant stride between vectors on this node.
 
Teuchos::RCP< const
Tpetra::Vector< scalar_t,
local_ordinal_t,
global_ordinal_t, node_t > > 
getVector (size_t j) const
 Const vector access.
 
Teuchos::RCP< Tpetra::Vector
< scalar_t, local_ordinal_t,
global_ordinal_t, node_t > > 
getVectorNonConst (size_t j)
 Nonconst vector access.
 
multivec_t::impl_scalar_type * getMVPointer_impl () const
 Return pointer to vector when number of vectors == 1 and single MPI process.
 
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. More...
 
template<typename KV >
void get1dCopy_kokkos_view (KV &v, size_t lda, Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > distribution_map, EDistribution distribution) const
 
Teuchos::ArrayRCP< scalar_t > get1dViewNonConst (bool local=false)
 Extracts a 1 dimensional view of this MultiVector's data. More...
 
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. More...
 
template<typename KV >
void put1dData_kokkos_view (KV &kokkos_new_data, size_t lda, Teuchos::Ptr< const Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > > source_map, EDistribution distribution)
 
std::string description () const
 Get a short description of this adapter class.
 
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.
 

Static Public Attributes

static const char * name
 

Protected Member Functions

 MultiVecAdapter (const MultiVecAdapter< multivec_t > &adapter)
 Copy constructor.
 
 MultiVecAdapter (const Teuchos::RCP< multivec_t > &m)
 Initialize an adapter from a multi-vector RCP. More...
 

Private Types

typedef Tpetra::Export
< local_ordinal_t,
global_ordinal_t, node_t > 
export_type
 The Tpetra::Export specialization used by this class.
 
typedef Tpetra::Import
< local_ordinal_t,
global_ordinal_t, node_t > 
import_type
 The Tpetra::Import specialization used by this class.
 

Private Attributes

Teuchos::RCP< multivec_t > mv_
 The multivector which this adapter wraps.
 
Teuchos::RCP< export_typeexporter_
 Used for data redistribution from the user's input MultiVector to the solver's input MultiVector. More...
 
Teuchos::RCP< import_typeimporter_
 Used for data redistribution from the solver's output MultiVector to the user's output MultiVector. More...
 

Friends

Teuchos::RCP< MultiVecAdapter
< multivec_t > > 
createMultiVecAdapter (Teuchos::RCP< multivec_t >)
 
Teuchos::RCP< const
MultiVecAdapter< multivec_t > > 
createConstMultiVecAdapter (Teuchos::RCP< const multivec_t >)
 

Detailed Description

template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, class Node>
class Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >

Amesos2 adapter for the Tpetra::MultiVector class.

Constructor & Destructor Documentation

template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::MultiVecAdapter ( const Teuchos::RCP< multivec_t > &  m)
protected

Initialize an adapter from a multi-vector RCP.

Parameters
mAn RCP pointing to the multi-vector which is to be wrapped.

Member Function Documentation

template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
void Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::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.

Each vector of the multivector is placed lda apart in the given ArrayView. Giving a distribution map is useful in the case where the data needs to end up on different processors than it currently resides. For example, the SuperLU_DIST interface may receive a B multivector that is distributed across 13 processors, but only 12 of those 13 processors are in SuperLU_DIST's processor grid. The rows of the multivector need to then be distributed amongst the 12 that are in the grid.

Parameters
[in/out]A user-supplied storage for multi-vector data
[in]ldauser-supplied spacing for consecutive vectors in A
[in]distribution_mapis a Tpetra::Map that describes the desired distribution of the multivector's data accross the calling processors. The map describes where the 'rows' of the multivector will end up.
[in]distribution
Exceptions
std::runtime_errorThrown if the space available in A is not large enough given lda , the value of global_copy , and the number of vectors in this.
template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
Teuchos::ArrayRCP<scalar_t> Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::get1dViewNonConst ( bool  local = false)

Extracts a 1 dimensional view of this MultiVector's data.

Guarantees that the view returned will reside in contiguous storage.

Warning
It is recommended to use the get1dCopy function, from a data-hiding perspective. Use if you know what you are doing.
Parameters
localif true , each node will get a view of the vectors it is in possession of. The default, false , will give each calling node a view of the global multivector.
template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
void Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::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.

Parameters
new_dataThe data to be exported into this.
source_mapdescribes how the input array data is distributed accross processors. This data will be redistributed to match the map of the adapted multivector.
[in]distribution

Member Data Documentation

template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
Teuchos::RCP<export_type> Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::exporter_
mutableprivate

Used for data redistribution from the user's input MultiVector to the solver's input MultiVector.

This is an Export, because the user's input data need not necessarily be one-to-one, but the solver's input data must (presumably) always be one-to-one.

template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , class Node >
Teuchos::RCP<import_type> Amesos2::MultiVecAdapter< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > >::importer_
mutableprivate

Used for data redistribution from the solver's output MultiVector to the user's output MultiVector.

This is an Import, because the user's output data need not necessarily be one-to-one, but the solver's output data must (presumably) always be one-to-one.


The documentation for this class was generated from the following file: