Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
AMP::LinearAlgebra::TpetraVector Class Referencefinal

A class that manages an Tpetra::Vector. More...

#include <TpetraVector.h>

Public Member Functions

std::shared_ptr< VectorgetManagedVec ()
 
std::shared_ptr< const VectorgetManagedVec () const
 
Tpetra::Vector & getNativeVec ()
 
const Tpetra::Vector & getNativeVec () const
 
Tpetra::Vector & getTpetra_Vector ()
 Obtain Tpetra::Vector for use in Trilinos routines.
 
const Tpetra::Vector & getTpetra_Vector () const
 Obtain Tpetra::Vector for use in Trilinos routines.
 
 ~TpetraVector ()
 Destructor.
 

Static Public Member Functions

static std::shared_ptr< const TpetraVectorconstView (Vector::const_shared_ptr vec)
 Obtain a view of a vector with an Tpetra::Vector wrapper.
 
static std::shared_ptr< TpetraVectorview (Vector::shared_ptr vec)
 Obtain a view of a vector with an Tpetra::Vector wrapper.
 

Private Member Functions

 TpetraVector ()=delete
 
 TpetraVector (std::shared_ptr< Vector >)
 

Private Attributes

std::shared_ptr< Vectord_AMP
 
std::shared_ptr< Tpetra::Vector<> > d_tpetra
 

Detailed Description

A class that manages an Tpetra::Vector.

See also
EpetraVector
PetscVector
SundialsVector

An TpetraVector presents an Tpetra::Vector class. Given an AMP::LinearAlgebra::Vector, this class can create an Tpetra view without copying the data. As such, this class serves three purposes:

  1. Provides an Tpetra::Vector for derived classes to use, fill, manage, etc.
  2. Provides an interface for accessing this Tpetra::Vector independent of base or derived classes
  3. Provides a static method for creating an Tpetra::Vector view of an AMP Vector.

Definition at line 30 of file TpetraVector.h.

Constructor & Destructor Documentation

◆ ~TpetraVector()

AMP::LinearAlgebra::TpetraVector::~TpetraVector ( )

Destructor.

◆ TpetraVector() [1/2]

AMP::LinearAlgebra::TpetraVector::TpetraVector ( )
privatedelete

◆ TpetraVector() [2/2]

AMP::LinearAlgebra::TpetraVector::TpetraVector ( std::shared_ptr< Vector )
explicitprivate

Member Function Documentation

◆ constView()

static std::shared_ptr< const TpetraVector > AMP::LinearAlgebra::TpetraVector::constView ( Vector::const_shared_ptr  vec)
static

Obtain a view of a vector with an Tpetra::Vector wrapper.

Parameters
[in]vecThe vector to get an Tpetra::Vector view of.
Returns
A Vector::shared_ptr guaranteed to have an Tpetra::Vector wrapper available through the getTpetra_Vector() interface.
See also
getTpetra_Vector()

If the vector has an Tpetra::Vector wrapper already created, it is returned. Otherwise, it will try to create an Tpetra::Vector wrapper around the Vector. If it fails, an exception is thrown.

◆ getManagedVec() [1/2]

std::shared_ptr< Vector > AMP::LinearAlgebra::TpetraVector::getManagedVec ( )
inline

Definition at line 110 of file TpetraVector.h.

References d_AMP.

◆ getManagedVec() [2/2]

std::shared_ptr< const Vector > AMP::LinearAlgebra::TpetraVector::getManagedVec ( ) const
inline

Definition at line 111 of file TpetraVector.h.

References d_AMP.

◆ getNativeVec() [1/2]

Tpetra::Vector & AMP::LinearAlgebra::TpetraVector::getNativeVec ( )
inline

Definition at line 108 of file TpetraVector.h.

References d_tpetra.

◆ getNativeVec() [2/2]

const Tpetra::Vector & AMP::LinearAlgebra::TpetraVector::getNativeVec ( ) const
inline

Definition at line 109 of file TpetraVector.h.

References d_tpetra.

◆ getTpetra_Vector() [1/2]

Tpetra::Vector & AMP::LinearAlgebra::TpetraVector::getTpetra_Vector ( )
inline

Obtain Tpetra::Vector for use in Trilinos routines.

This function is used to get a Tpetra vector. The following idiom should be used since it fails gracefully. In this function, a view may be created before the Vec is extracted

See also
view()
Returns
Tpetra::Vector wrapper for this vector
double DoTpetraMax( Vector::shared_ptr &in )
{
// Create an Tpetra::Vector, if necessary
auto view = TpetraVector::view( in );
// Extract the Tpetra::Vector
Tpetra::Vector &in_vec = view->getTpetra_Vector();
// Perform an Tpetra::Vector operation
retrun in_vec.MaxValue ( &abs );
}
static std::shared_ptr< TpetraVector > view(Vector::shared_ptr vec)
Obtain a view of a vector with an Tpetra::Vector wrapper.
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60

Definition at line 57 of file TpetraVector.h.

References d_tpetra.

◆ getTpetra_Vector() [2/2]

const Tpetra::Vector & AMP::LinearAlgebra::TpetraVector::getTpetra_Vector ( ) const
inline

Obtain Tpetra::Vector for use in Trilinos routines.

See also
view()
Returns
Tpetra::Vector wrapper for this vector

This function is used to get a Tpetra vector. The following idiom should be used since it fails gracefully. In this function, a view may be created before the Tpetra::Vector is extracted

double DoTpetraMax( Vector::shared_ptr &in )
{
// Create an Tpetra::Vector, if necessary
auto view = TpetraVector::view( in );
// Extract the Tpetra::Vector
Tpetra::Vector &in_vec = view->getTpetra_Vector();
// Perform an Tpetra::Vector operation
retrun in_vec.MaxValue ( &abs );
}

Definition at line 79 of file TpetraVector.h.

References d_tpetra.

◆ view()

static std::shared_ptr< TpetraVector > AMP::LinearAlgebra::TpetraVector::view ( Vector::shared_ptr  vec)
static

Obtain a view of a vector with an Tpetra::Vector wrapper.

Parameters
[in]vecThe vector to get an Tpetra::Vector view of.
Returns
A Vector::shared_ptr guaranteed to have an Tpetra::Vector wrapper available through the getTpetra::Vector() interface.
See also
getTpetra_Vector()

If the vector has an Tpetra::Vector wrapper already created, it is returned. Otherwise, it will try to create an Tpetra::Vector wrapper around the Vector. If it fails, an exception is thrown.

Member Data Documentation

◆ d_AMP

std::shared_ptr<Vector> AMP::LinearAlgebra::TpetraVector::d_AMP
private

Definition at line 119 of file TpetraVector.h.

Referenced by getManagedVec(), and getManagedVec().

◆ d_tpetra

std::shared_ptr<Tpetra::Vector<> > AMP::LinearAlgebra::TpetraVector::d_tpetra
private

Definition at line 118 of file TpetraVector.h.

Referenced by getNativeVec(), getNativeVec(), getTpetra_Vector(), and getTpetra_Vector().


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:43.
Comments on this page