Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AMP::LinearAlgebra::ThyraVector Class Referenceabstract

ThyraVector is a bridge between AMP::LinearAlgebra::Vector and the Thyra::VectorDefaultBase data structure. More...

#include <ThyraVector.h>

Inheritance diagram for AMP::LinearAlgebra::ThyraVector:
Inheritance graph
[legend]

Public Member Functions

virtual std::shared_ptr< const VectorgetManagedVec () const =0
 
virtual std::shared_ptr< VectorgetManagedVec ()=0
 
auto getNativeVec ()
 
auto getNativeVec () const
 
virtual Teuchos::RCP< Thyra::VectorBase< double > > getVec ()
 Obtain Thyra Vector for use in Thyra routines.
 
virtual Teuchos::RCP< const Thyra::VectorBase< double > > getVec () const
 Obtain Thyra Vector for use in Thyra routines.
 
virtual ~ThyraVector ()
 Destructor.
 

Static Public Member Functions

static AMP::LinearAlgebra::Vector::const_shared_ptr constView (const Thyra::VectorBase< double > *vec)
 Return an AMP Vector from the Thyra::VectorBase.
 
static std::shared_ptr< const ThyraVectorconstView (Vector::const_shared_ptr AmpVector)
 If needed, create a Thyra wrapper for AmpVector. Otherwise, return AmpVector.
 
static AMP::LinearAlgebra::Vector::shared_ptr view (Thyra::VectorBase< double > *vec)
 Return an AMP Vector from the Thyra::VectorBase.
 
static std::shared_ptr< ThyraVectorview (Vector::shared_ptr AmpVector)
 If needed, create a Thyra wrapper for AmpVector. Otherwise, return AmpVector.
 

Protected Member Functions

void swapThyraVec (ThyraVector &rhs)
 Swap the underlying PETSc Vec with another AMP::LinearAlgebra::Vector.
 
 ThyraVector ()
 Construct a ThyraVector.
 

Protected Attributes

Teuchos::RCP< Thyra::VectorBase< double > > d_thyraVec
 Thyra Vector holding data in the vector.
 

Detailed Description

ThyraVector is a bridge between AMP::LinearAlgebra::Vector and the Thyra::VectorDefaultBase data structure.

A ThyraVector has a Thyra::VectorDefaultBase data structure. Given an AMP::LinearAlgebra::Vector, this class can create a Thyra view without copying the data. As such, this class serves three purposes:

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

Definition at line 28 of file ThyraVector.h.

Constructor & Destructor Documentation

◆ ~ThyraVector()

virtual AMP::LinearAlgebra::ThyraVector::~ThyraVector ( )
virtual

Destructor.

◆ ThyraVector()

AMP::LinearAlgebra::ThyraVector::ThyraVector ( )
protected

Construct a ThyraVector.

This can only be called by a derived class or the static function below. There is no need to create this vector directly since it is virtual.

Member Function Documentation

◆ constView() [1/2]

static AMP::LinearAlgebra::Vector::const_shared_ptr AMP::LinearAlgebra::ThyraVector::constView ( const Thyra::VectorBase< double > *  vec)
static

Return an AMP Vector from the Thyra::VectorBase.

◆ constView() [2/2]

static std::shared_ptr< const ThyraVector > AMP::LinearAlgebra::ThyraVector::constView ( Vector::const_shared_ptr  AmpVector)
static

If needed, create a Thyra wrapper for AmpVector. Otherwise, return AmpVector.

The function attempts to return a view with the least amount of work. It will never copy data. If the vector cannot be wrapped it wll return an error.

Parameters
AmpVectora shared pointer to a Vector

◆ getManagedVec() [1/2]

virtual std::shared_ptr< const Vector > AMP::LinearAlgebra::ThyraVector::getManagedVec ( ) const
pure virtual

◆ getManagedVec() [2/2]

virtual std::shared_ptr< Vector > AMP::LinearAlgebra::ThyraVector::getManagedVec ( )
pure virtual

◆ getNativeVec() [1/2]

auto AMP::LinearAlgebra::ThyraVector::getNativeVec ( )
inline

Definition at line 77 of file ThyraVector.h.

References getVec().

◆ getNativeVec() [2/2]

auto AMP::LinearAlgebra::ThyraVector::getNativeVec ( ) const
inline

Definition at line 78 of file ThyraVector.h.

References getVec().

◆ getVec() [1/2]

virtual Teuchos::RCP< Thyra::VectorBase< double > > AMP::LinearAlgebra::ThyraVector::getVec ( )
virtual

Obtain Thyra Vector for use in Thyra routines.

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

Referenced by getNativeVec(), and getNativeVec().

◆ getVec() [2/2]

virtual Teuchos::RCP< const Thyra::VectorBase< double > > AMP::LinearAlgebra::ThyraVector::getVec ( ) const
virtual

Obtain Thyra Vector for use in Thyra routines.

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

◆ swapThyraVec()

void AMP::LinearAlgebra::ThyraVector::swapThyraVec ( ThyraVector rhs)
inlineprotected

Swap the underlying PETSc Vec with another AMP::LinearAlgebra::Vector.

Definition at line 96 of file ThyraVector.h.

References d_thyraVec.

◆ view() [1/2]

static AMP::LinearAlgebra::Vector::shared_ptr AMP::LinearAlgebra::ThyraVector::view ( Thyra::VectorBase< double > *  vec)
static

Return an AMP Vector from the Thyra::VectorBase.

◆ view() [2/2]

static std::shared_ptr< ThyraVector > AMP::LinearAlgebra::ThyraVector::view ( Vector::shared_ptr  AmpVector)
static

If needed, create a Thyra wrapper for AmpVector. Otherwise, return AmpVector.

The function attempts to return a view with the least amount of work. It will never copy data. If the vector cannot be wrapped it wll return an error.

Parameters
AmpVectora shared pointer to a Vector

Member Data Documentation

◆ d_thyraVec

Teuchos::RCP<Thyra::VectorBase<double> > AMP::LinearAlgebra::ThyraVector::d_thyraVec
protected

Thyra Vector holding data in the vector.

Whether created with VecCreate (called Native) or a view of an AMP:Vector (called Managed), this pointer is what is used when calling the Thyra Vector interface

Definition at line 90 of file ThyraVector.h.

Referenced by swapThyraVec().


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