NOX Development
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NOX::Petsc::Vector Class Reference

Implementation of NOX::Abstract::Vector for Petsc vectors. More...

#include <NOX_Petsc_Vector.H>

Inheritance diagram for NOX::Petsc::Vector:
Inheritance graph
[legend]
Collaboration diagram for NOX::Petsc::Vector:
Collaboration graph
[legend]

Public Member Functions

 Vector (const Vec &source, CopyType type=DeepCopy)
 Construct by copying map and/or elements of a Petsc Vec.
 
 Vector (const Vec &source, std::string name="Unnamed", CopyType type=DeepCopy)
 Construct by copying map and/or elements of a Petsc Vec.
 
 Vector (const Vector &source, CopyType type=DeepCopy)
 Construct by copying a NOX::Petsc::Vector.
 
 ~Vector ()
 Destruct Vector.
 
virtual Vec & getPetscVector ()
 Get reference to underlying Petsc vector.
 
virtual const Vec & getPetscVector () const
 Get const reference to underlying Petsc vector.
 
virtual Abstract::Vectorinit (double value)
 Initialize every element of this vector with gamma.
 
virtual Abstract::Vectoroperator= (const Vec &source)
 Copies source vector into "this".
 
virtual Abstract::Vectoroperator= (const Vector &source)
 
virtual Abstract::Vectoroperator= (const Abstract::Vector &source)
 See above.
 
virtual Abstract::Vectorabs (const Vector &source)
 
virtual Abstract::Vectorabs (const Abstract::Vector &source)
 See above.
 
virtual Abstract::Vectorrandom (bool useSeed=false, int seed=1)
 Initialize each element of this vector with a random value.
 
virtual Abstract::Vectorreciprocal (const Vector &source)
 
virtual Abstract::Vectorreciprocal (const Abstract::Vector &source)
 See above.
 
virtual Abstract::Vectorscale (double gammaval)
 Scale each element of this vector by gamma.
 
virtual Abstract::Vectorscale (const Vector &a)
 
virtual Abstract::Vectorscale (const Abstract::Vector &a)
 See above.
 
virtual Abstract::Vectorupdate (double alpha, const Vector &a, double gammaval=0.0)
 
virtual Abstract::Vectorupdate (double alpha, const Abstract::Vector &a, double gammaval=0.0)
 See above.
 
virtual Abstract::Vectorupdate (double alpha, const Vector &a, double beta, const Vector &b, double gammaval=0.0)
 
virtual Abstract::Vectorupdate (double alpha, const Abstract::Vector &a, double beta, const Abstract::Vector &b, double gammaval=0.0)
 See above.
 
virtual Teuchos::RCP< NOX::Abstract::Vectorclone (CopyType type=DeepCopy) const
 Create a new Vector of the same underlying type by cloning "this", and return a pointer to the new vector.
 
virtual double norm (Abstract::Vector::NormType type=TwoNorm) const
 Norm.
 
virtual double norm (const Vector &weights) const
 
virtual double norm (const Abstract::Vector &weights) const
 See above.
 
virtual double innerProduct (const Vector &y) const
 
virtual double innerProduct (const Abstract::Vector &y) const
 See above.
 
virtual NOX::size_type length () const
 Return the length of vector.
 
std::string Name ()
 
- Public Member Functions inherited from NOX::Abstract::Vector
 Vector ()
 Abstract Vector constructor (does nothing)
 
virtual ~Vector ()
 Abstract Vector destructor (does nothing)
 
virtual NOX::Abstract::Vectorinit (double gamma)=0
 Initialize every element of this vector with gamma.
 
virtual NOX::Abstract::Vectorrandom (bool useSeed=false, int seed=1)=0
 Initialize each element of this vector with a random value.
 
virtual NOX::Abstract::Vectorabs (const NOX::Abstract::Vector &y)=0
 Put element-wise absolute values of source vector y into this vector.
 
virtual NOX::Abstract::Vectoroperator= (const NOX::Abstract::Vector &y)=0
 Copy source vector y into this vector.
 
virtual NOX::Abstract::Vectorreciprocal (const NOX::Abstract::Vector &y)=0
 Put element-wise reciprocal of source vector y into this vector.
 
virtual NOX::Abstract::Vectorscale (double gamma)=0
 Scale each element of this vector by gamma.
 
virtual NOX::Abstract::Vectorscale (const NOX::Abstract::Vector &a)=0
 Scale this vector element-by-element by the vector a.
 
virtual NOX::Abstract::Vectorupdate (double alpha, const NOX::Abstract::Vector &a, double gamma=0.0)=0
 Compute x = (alpha * a) + (gamma * x) where x is this vector.
 
virtual NOX::Abstract::Vectorupdate (double alpha, const NOX::Abstract::Vector &a, double beta, const NOX::Abstract::Vector &b, double gamma=0.0)=0
 Compute x = (alpha * a) + (beta * b) + (gamma * x) where x is this vector.
 
virtual Teuchos::RCP< NOX::Abstract::Vectorclone (NOX::CopyType type=NOX::DeepCopy) const =0
 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.
 
virtual double norm (NOX::Abstract::Vector::NormType type=NOX::Abstract::Vector::TwoNorm) const =0
 Norm.
 
virtual double norm (const NOX::Abstract::Vector &weights) const =0
 Weighted 2-Norm.
 
virtual double innerProduct (const NOX::Abstract::Vector &y) const =0
 Inner product with y.
 
virtual NOX::size_type length () const =0
 Return the length of vector.
 
virtual void print (std::ostream &stream) const
 Print the vector. To be used for debugging only.
 

Protected Member Functions

virtual int allocate (const Vec &source, CopyType type=DeepCopy)
 

Protected Attributes

Vec petscVec
 Pointer to Petsc vector owned by this object.
 
bool isAlloc
 Flag to indicate if the vector has been allocated.
 
std::string name
 

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::Abstract::Vector for Petsc vectors.

Constructor & Destructor Documentation

◆ ~Vector()

Vector::~Vector ( )
virtual

Destruct Vector.

Reimplemented from NOX::Abstract::Vector.

References isAlloc.

Member Function Documentation

◆ abs()

Abstract::Vector & Vector::abs ( const Abstract::Vector source)
virtual

See above.

Implements NOX::Abstract::Vector.

◆ clone()

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

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

If type is NOX::DeepCopy, then we need to create an exact replica of "this". Otherwise, if type is NOX::ShapeCopy, we need only replicate the shape of "this" (the memory is allocated for the objects, but the current values are not copied into the vector). Note that there is no assumption that a vector created by ShapeCopy is initialized to zeros.

Returns
Pointer to newly created vector or NULL if clone is not supported.

Implements NOX::Abstract::Vector.

References petscVec.

◆ init()

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

Initialize every element of this vector with gamma.

Here x represents this vector, and we update it as

\[ x_i = \gamma \quad \mbox{for } i=1,\dots,n \]

Returns
Reference to this object

Implements NOX::Abstract::Vector.

References petscVec.

◆ innerProduct()

double Vector::innerProduct ( const Abstract::Vector y) const
virtual

See above.

Implements NOX::Abstract::Vector.

◆ length()

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

Return the length of vector.

Returns
The length of this vector
Note
Even if the vector is distributed across processors, this should return the global length of the vector.

Implements NOX::Abstract::Vector.

References petscVec.

◆ norm() [1/2]

double Vector::norm ( Abstract::Vector::NormType  type = TwoNorm) const
virtual

◆ norm() [2/2]

double Vector::norm ( const Abstract::Vector weights) const
virtual

See above.

Implements NOX::Abstract::Vector.

References norm().

◆ operator=()

Abstract::Vector & Vector::operator= ( const Abstract::Vector source)
virtual

See above.

Implements NOX::Abstract::Vector.

References operator=().

◆ random()

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

Initialize each element of this vector with a random value.

If useSeed is true, uses the value of seed to seed the random number generator before filling the entries of this vector. So, if two calls are made where useSeed is true and seed is the same, then the vectors returned should be the same.

Default implementation throw an error. Only referenced by LOCA methods.

Returns
Reference to this object

Implements NOX::Abstract::Vector.

References petscVec.

◆ reciprocal()

Abstract::Vector & Vector::reciprocal ( const Abstract::Vector source)
virtual

See above.

Implements NOX::Abstract::Vector.

◆ scale() [1/2]

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

See above.

Implements NOX::Abstract::Vector.

References scale().

◆ scale() [2/2]

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

Scale each element of this vector by gamma.

Here x represents this vector, and we update it as

\[ x_i = \gamma x_i \quad \mbox{for } i=1,\dots,n \]

Returns
Reference to this object

Implements NOX::Abstract::Vector.

References petscVec.

Referenced by NOX::Petsc::Group::computeNewton(), and scale().

◆ update() [1/2]

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

See above.

Implements NOX::Abstract::Vector.

◆ update() [2/2]

Abstract::Vector & Vector::update ( double  alpha,
const Abstract::Vector a,
double  gammaval = 0.0 
)
virtual

See above.

Implements NOX::Abstract::Vector.


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