NOX Development
Loading...
Searching...
No Matches
NOX::Thyra::Vector Class Reference

Implementation of NOX::Thyra::Vector. More...

#include <NOX_Thyra_Vector.H>

Inheritance diagram for NOX::Thyra::Vector:
Collaboration diagram for NOX::Thyra::Vector:

Public Member Functions

 Vector (const Teuchos::RCP< ::Thyra::VectorBase< double > > &src)
 Construct a vector as a view of a given Thyra vector.
 Vector (const ::Thyra::VectorBase< double > &source)
 Construct a vector from a given Thyra vector.
 Vector (const NOX::Thyra::Vector &source, NOX::CopyType type=NOX::DeepCopy)
 Copy constructor.
 ~Vector ()
 Destruct Vector.
virtual ::Thyra::VectorBase< double > & getThyraVector ()
 Get reference to underlying Thyra vector.
virtual const ::Thyra::VectorBase< double > & getThyraVector () const
 Get const reference to underlying Thyra vector.
virtual Teuchos::RCP< ::Thyra::VectorBase< double > > getThyraRCPVector ()
 Get RCP to underlying Thyra vector.
virtual Teuchos::RCP< const ::Thyra::VectorBase< double > > getThyraRCPVector () const
 Get RCP to underlying Thyra vector.
NOX::Abstract::Vectorinit (double gamma)
 Initialize every element of this vector with gamma.
NOX::Abstract::Vectorrandom (bool useSeed=false, int seed=1)
 Initialize every element of this vector with random values.
NOX::Abstract::Vectoroperator= (const NOX::Abstract::Vector &y)
 Copy source vector y into this vector.
NOX::Abstract::Vectoroperator= (const NOX::Thyra::Vector &y)
NOX::Abstract::Vectorabs (const NOX::Abstract::Vector &y)
 Put element-wise absolute values of source vector y into this vector.
NOX::Abstract::Vectorreciprocal (const NOX::Abstract::Vector &y)
 Put element-wise reciprocal of source vector y into this vector.
NOX::Abstract::Vectorscale (double gamma)
 Scale each element of this vector by gamma.
NOX::Abstract::Vectorscale (const NOX::Abstract::Vector &a)
 Scale this vector element-by-element by the vector a.
NOX::Abstract::Vectorupdate (double alpha, const NOX::Abstract::Vector &a, double gamma=0.0)
 Compute x = (alpha * a) + (gamma * x) where x is this vector.
NOX::Abstract::Vectorupdate (double alpha, const NOX::Abstract::Vector &a, double beta, const NOX::Abstract::Vector &b, double gamma=0.0)
 Compute x = (alpha * a) + (beta * b) + (gamma * x) where x is this vector.
Teuchos::RCP< NOX::Abstract::Vectorclone (NOX::CopyType type=NOX::DeepCopy) const
 Create a new Vector of the same underlying type by cloning "this", and return a pointer to the new vector.
virtual Teuchos::RCP< NOX::Abstract::MultiVectorcreateMultiVector (const NOX::Abstract::Vector *const *vecs, int numVecs, NOX::CopyType type=NOX::DeepCopy) const
 Create a MultiVector with numVecs+1 columns out of an array of Vectors. The vector stored under this will be the first column with the remaining numVecs columns given by vecs.
virtual Teuchos::RCP< NOX::Abstract::MultiVectorcreateMultiVector (int numVecs, NOX::CopyType type=NOX::DeepCopy) const
 Create a MultiVector with numVecs columns.
double norm (NOX::Abstract::Vector::NormType type=NOX::Abstract::Vector::TwoNorm) const
 ! Norm
double norm (const NOX::Abstract::Vector &weights) const
 Weighted 2-Norm.
double innerProduct (const NOX::Abstract::Vector &y) const
 Inner product with y.
NOX::size_type length () const
 Return the length of vector.
void print (std::ostream &stream) const
 Print the vector. To be used for debugging only.
void setWeightVector (const Teuchos::RCP< const ::Thyra::VectorBase< double > > &weightVec)
 Set the weighting vector used for inner products and norms.
bool hasWeightVector () const
Teuchos::RCP< const ::Thyra::VectorBase< double > > getWeightVector () const
 Returns a weighting vector if one was set, otherwise throws.
bool getImplicitWeighting () const
 Return true if implicit weighting is currently enabled.
void setImplicitWeighting (bool do_implicit_weighting)
 Set to true to enable implicit weighting, false disables.
Public Member Functions inherited from NOX::Abstract::Vector
 Vector ()
 Abstract Vector constructor (does nothing)

Protected Attributes

Teuchos::RCP< ::Thyra::VectorBase< double > > thyraVec
 Pointer to Thyra vector owned by this object.
Teuchos::RCP< const ::Thyra::VectorBase< double > > weightVec_
 Thyra vector used for weighting inner product and norms.
Teuchos::RCP< ::Thyra::VectorBase< double > > tmpVec_
 Thyra vector used for weighting inner product and norms.
bool do_implicit_weighting_
 True if implicit weighting is enabled (i.e. a nonnull wieghtVec_).

Additional Inherited Members

Public Types inherited from NOX::Abstract::Vector
enum  NormType { TwoNorm , OneNorm , MaxNorm }
 Norm types used in norm() calculations. More...

Detailed Description

Implementation of NOX::Thyra::Vector.

Constructor & Destructor Documentation

◆ Vector() [1/3]

NOX::Thyra::Vector::Vector ( const Teuchos::RCP< ::Thyra::VectorBase< double > > & src)

Construct a vector as a view of a given Thyra vector.

Creates a view and does not allocate a new vector

References do_implicit_weighting_, and thyraVec.

◆ Vector() [2/3]

NOX::Thyra::Vector::Vector ( const ::Thyra::VectorBase< double > & source)

Construct a vector from a given Thyra vector.

Allocates an entirely new vector

References do_implicit_weighting_, and thyraVec.

◆ Vector() [3/3]

NOX::Thyra::Vector::Vector ( const NOX::Thyra::Vector & source,
NOX::CopyType type = NOX::DeepCopy )

Copy constructor.

References do_implicit_weighting_, thyraVec, and weightVec_.

◆ ~Vector()

NOX::Thyra::Vector::~Vector ( )
virtual

Destruct Vector.

Reimplemented from NOX::Abstract::Vector.

Member Function Documentation

◆ abs()

NOX::Abstract::Vector & NOX::Thyra::Vector::abs ( const NOX::Abstract::Vector & y)
virtual

Put element-wise absolute values of source vector y into this vector.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ clone()

Teuchos::RCP< NOX::Abstract::Vector > NOX::Thyra::Vector::clone ( NOX::CopyType type = NOX::DeepCopy) const
virtual

Create a new Vector of the same underlying type by cloning "this", and return a pointer to the new vector.

Implements NOX::Abstract::Vector.

◆ createMultiVector() [1/2]

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::Vector::createMultiVector ( const NOX::Abstract::Vector *const * vecs,
int numVecs,
NOX::CopyType type = NOX::DeepCopy ) const
virtual

Create a MultiVector with numVecs+1 columns out of an array of Vectors. The vector stored under this will be the first column with the remaining numVecs columns given by vecs.

Reimplemented from NOX::Abstract::Vector.

References NOX::DeepCopy, thyraVec, and weightVec_.

◆ createMultiVector() [2/2]

Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Thyra::Vector::createMultiVector ( int numVecs,
NOX::CopyType type = NOX::DeepCopy ) const
virtual

Create a MultiVector with numVecs columns.

Reimplemented from NOX::Abstract::Vector.

References NOX::DeepCopy, do_implicit_weighting_, thyraVec, and weightVec_.

◆ getImplicitWeighting()

bool NOX::Thyra::Vector::getImplicitWeighting ( ) const
virtual

Return true if implicit weighting is currently enabled.

CAUTION: This is a power user feature and should only be used in concert with specialized NOX::Abstract::Vector implementations.

Implements NOX::Abstract::ImplicitWeighting.

References do_implicit_weighting_.

◆ getThyraRCPVector() [1/2]

Teuchos::RCP<::Thyra::VectorBase< double > > NOX::Thyra::Vector::getThyraRCPVector ( )
virtual

◆ getThyraRCPVector() [2/2]

Teuchos::RCP< const::Thyra::VectorBase< double > > NOX::Thyra::Vector::getThyraRCPVector ( ) const
virtual

Get RCP to underlying Thyra vector.

References thyraVec.

◆ getThyraVector() [1/2]

Thyra::VectorBase< double > & NOX::Thyra::Vector::getThyraVector ( )

◆ getThyraVector() [2/2]

const::Thyra::VectorBase< double > & NOX::Thyra::Vector::getThyraVector ( ) const
virtual

Get const reference to underlying Thyra vector.

References thyraVec.

◆ getWeightVector()

Teuchos::RCP< const::Thyra::VectorBase< double > > NOX::Thyra::Vector::getWeightVector ( ) const

Returns a weighting vector if one was set, otherwise throws.

References weightVec_.

◆ init()

NOX::Abstract::Vector & NOX::Thyra::Vector::init ( double gamma)
virtual

Initialize every element of this vector with gamma.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ innerProduct()

double NOX::Thyra::Vector::innerProduct ( const NOX::Abstract::Vector & y) const
virtual

Inner product with y.

Implements NOX::Abstract::Vector.

References do_implicit_weighting_, thyraVec, tmpVec_, and weightVec_.

◆ length()

NOX::size_type NOX::Thyra::Vector::length ( ) const
virtual

Return the length of vector.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ norm() [1/2]

double NOX::Thyra::Vector::norm ( const NOX::Abstract::Vector & weights) const
virtual

Weighted 2-Norm.

Implements NOX::Abstract::Vector.

References do_implicit_weighting_, thyraVec, tmpVec_, and weightVec_.

◆ norm() [2/2]

◆ operator=()

NOX::Abstract::Vector & NOX::Thyra::Vector::operator= ( const NOX::Abstract::Vector & y)
virtual

Copy source vector y into this vector.

Implements NOX::Abstract::Vector.

References operator=().

Referenced by operator=().

◆ print()

void NOX::Thyra::Vector::print ( std::ostream & stream) const
virtual

Print the vector. To be used for debugging only.

Reimplemented from NOX::Abstract::Vector.

References thyraVec.

◆ random()

NOX::Abstract::Vector & NOX::Thyra::Vector::random ( bool useSeed = false,
int seed = 1 )
virtual

Initialize every element of this vector with random values.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ reciprocal()

NOX::Abstract::Vector & NOX::Thyra::Vector::reciprocal ( const NOX::Abstract::Vector & y)
virtual

Put element-wise reciprocal of source vector y into this vector.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ scale() [1/2]

NOX::Abstract::Vector & NOX::Thyra::Vector::scale ( const NOX::Abstract::Vector & a)
virtual

Scale this vector element-by-element by the vector a.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ scale() [2/2]

NOX::Abstract::Vector & NOX::Thyra::Vector::scale ( double gamma)
virtual

Scale each element of this vector by gamma.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ setImplicitWeighting()

void NOX::Thyra::Vector::setImplicitWeighting ( bool do_implicit_weighting)
virtual

Set to true to enable implicit weighting, false disables.

CAUTION: This is a power user feature and should only be used in concert with specialized NOX::Abstract::Vector implementations.

Implements NOX::Abstract::ImplicitWeighting.

References do_implicit_weighting_.

◆ setWeightVector()

void NOX::Thyra::Vector::setWeightVector ( const Teuchos::RCP< const ::Thyra::VectorBase< double > > & weightVec)

Set the weighting vector used for inner products and norms.

References do_implicit_weighting_, tmpVec_, and weightVec_.

◆ update() [1/2]

NOX::Abstract::Vector & NOX::Thyra::Vector::update ( double alpha,
const NOX::Abstract::Vector & a,
double beta,
const NOX::Abstract::Vector & b,
double gamma = 0.0 )
virtual

Compute x = (alpha * a) + (beta * b) + (gamma * x) where x is this vector.

Implements NOX::Abstract::Vector.

References thyraVec.

◆ update() [2/2]

NOX::Abstract::Vector & NOX::Thyra::Vector::update ( double alpha,
const NOX::Abstract::Vector & a,
double gamma = 0.0 )
virtual

Compute x = (alpha * a) + (gamma * x) where x is this vector.

Implements NOX::Abstract::Vector.

References thyraVec.

Member Data Documentation

◆ do_implicit_weighting_

bool NOX::Thyra::Vector::do_implicit_weighting_
protected

True if implicit weighting is enabled (i.e. a nonnull wieghtVec_).

Referenced by createMultiVector(), getImplicitWeighting(), innerProduct(), norm(), norm(), setImplicitWeighting(), setWeightVector(), Vector(), Vector(), and Vector().

◆ thyraVec

◆ tmpVec_

Teuchos::RCP< ::Thyra::VectorBase<double> > NOX::Thyra::Vector::tmpVec_
protected

Thyra vector used for weighting inner product and norms.

Referenced by innerProduct(), norm(), norm(), and setWeightVector().

◆ weightVec_

Teuchos::RCP<const ::Thyra::VectorBase<double> > NOX::Thyra::Vector::weightVec_
protected

Thyra vector used for weighting inner product and norms.

Referenced by createMultiVector(), createMultiVector(), getWeightVector(), innerProduct(), norm(), norm(), setWeightVector(), and Vector().


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