#include <NOX_Epetra_Vector.H>
Public Types | |
enum | MemoryType { CreateView, CreateCopy } |
Type of memory management to use when constructing the vector. More... | |
Public Member Functions | |
Vector (const Teuchos::RCP< Epetra_Vector > &source, NOX::Epetra::Vector::MemoryType memoryType=NOX::Epetra::Vector::CreateCopy, NOX::CopyType type=NOX::DeepCopy, Teuchos::RCP< NOX::Epetra::VectorSpace > vs=Teuchos::null) | |
Constructor that creates a COPY or VIEW of the Epetra_Vector. | |
Vector (const Epetra_Vector &source, NOX::CopyType type=NOX::DeepCopy, Teuchos::RCP< NOX::Epetra::VectorSpace > vs=Teuchos::null) | |
Construct by copying map and/or elements of an Epetra_Vector. | |
Vector (const NOX::Epetra::Vector &source, NOX::CopyType type=NOX::DeepCopy) | |
Copy constructor. | |
~Vector () | |
Destruct Vector. | |
virtual int | length () const |
Return the length of vector. | |
virtual void | print (std::ostream &stream) const |
Print the vector. To be used for debugging only. | |
virtual Teuchos::RCP < NOX::Epetra::VectorSpace > | getVectorSpace () const |
Returns the NOX::Epetra::VectorSpace associated with this vector. | |
virtual Epetra_Vector & | getEpetraVector () |
Get reference to underlying Epetra vector. | |
virtual const Epetra_Vector & | getEpetraVector () const |
Get const reference to underlying Epetra vector. | |
virtual NOX::Abstract::Vector & | init (double gamma) |
Initialize every element of this vector with gamma . | |
virtual NOX::Abstract::Vector & | random (bool useSeed=false, int seed=1) |
Initialize each element of this vector with a random value. | |
virtual NOX::Abstract::Vector & | operator= (const Epetra_Vector &y) |
Copies source vector into "this". | |
virtual NOX::Abstract::Vector & | operator= (const NOX::Epetra::Vector &y) |
virtual NOX::Abstract::Vector & | operator= (const NOX::Abstract::Vector &y) |
Copy source vector y into this vector. | |
virtual NOX::Abstract::Vector & | abs (const NOX::Epetra::Vector &y) |
virtual NOX::Abstract::Vector & | abs (const NOX::Abstract::Vector &y) |
Put element-wise absolute values of source vector y into this vector. | |
virtual NOX::Abstract::Vector & | reciprocal (const NOX::Epetra::Vector &y) |
virtual NOX::Abstract::Vector & | reciprocal (const NOX::Abstract::Vector &y) |
Put element-wise reciprocal of source vector y into this vector. | |
virtual NOX::Abstract::Vector & | scale (double gamma) |
Scale each element of this vector by gamma . | |
virtual NOX::Abstract::Vector & | scale (const NOX::Epetra::Vector &a) |
virtual NOX::Abstract::Vector & | scale (const NOX::Abstract::Vector &a) |
Scale this vector element-by-element by the vector a. | |
virtual NOX::Abstract::Vector & | update (double alpha, const NOX::Epetra::Vector &a, double gamma=0.0) |
virtual NOX::Abstract::Vector & | update (double alpha, const NOX::Abstract::Vector &a, double gamma=0.0) |
Compute x = (alpha * a) + (gamma * x) where x is this vector. | |
virtual NOX::Abstract::Vector & | update (double alpha, const NOX::Epetra::Vector &a, double beta, const NOX::Epetra::Vector &b, double gamma=0.0) |
virtual NOX::Abstract::Vector & | update (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. | |
virtual Teuchos::RCP < NOX::Abstract::Vector > | clone (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 Teuchos::RCP < NOX::Abstract::MultiVector > | createMultiVector (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::MultiVector > | createMultiVector (int numVecs, NOX::CopyType type=NOX::DeepCopy) const |
Create a MultiVector with numVecs columns. | |
virtual double | norm (NOX::Abstract::Vector::NormType type=TwoNorm) const |
Norm. | |
virtual double | norm (const NOX::Epetra::Vector &weights) const |
virtual double | norm (const NOX::Abstract::Vector &weights) const |
Weighted 2-Norm. | |
virtual double | innerProduct (const NOX::Epetra::Vector &y) const |
virtual double | innerProduct (const NOX::Abstract::Vector &y) const |
Inner product with y . | |
Protected Attributes | |
Teuchos::RCP< Epetra_Vector > | epetraVec |
Pointer to petra vector owned by this object. | |
Teuchos::RCP < NOX::Epetra::VectorSpace > | vectorSpace |
Pointer to the vector space. |
Definition at line 63 of file NOX_Epetra_Vector.H.
Type of memory management to use when constructing the vector.
CreateView | Keeps a pointer to and uses the actual Epetra_Vector passed in. |
CreateCopy | Allocates a new underlying Epetra_Vector object. |
Definition at line 68 of file NOX_Epetra_Vector.H.
NOX::Epetra::Vector::Vector | ( | const Teuchos::RCP< Epetra_Vector > & | source, | |
NOX::Epetra::Vector::MemoryType | memoryType = NOX::Epetra::Vector::CreateCopy , |
|||
NOX::CopyType | type = NOX::DeepCopy , |
|||
Teuchos::RCP< NOX::Epetra::VectorSpace > | vs = Teuchos::null | |||
) |
Constructor that creates a COPY or VIEW of the Epetra_Vector.
NOTE: This ctor should just always create a view. It should be implicit from the fact that a RCP object is being passed in that a persisting relationship is present. However, since this could cause confusion, the default is to make a copy and if a user wants a view, they must pass in an explicit flag.
A VIEW of a vector uses the same underlying memory. WARNING: A View can be dangerous since multiple objects can access the same memory locations.
Definition at line 48 of file NOX_Epetra_Vector.C.
References CreateView, NOX::DeepCopy, epetraVec, NOX::ShapeCopy, and vectorSpace.
NOX::Epetra::Vector::Vector | ( | const Epetra_Vector & | source, | |
NOX::CopyType | type = NOX::DeepCopy , |
|||
Teuchos::RCP< NOX::Epetra::VectorSpace > | vs = Teuchos::null | |||
) |
Construct by copying map and/or elements of an Epetra_Vector.
Allocates an entirely new vector. Does NOT allow for a view.
Definition at line 78 of file NOX_Epetra_Vector.C.
References NOX::DeepCopy, epetraVec, NOX::ShapeCopy, and vectorSpace.
NOX::Epetra::Vector::Vector | ( | const NOX::Epetra::Vector & | source, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) |
Copy constructor.
Definition at line 101 of file NOX_Epetra_Vector.C.
References NOX::DeepCopy, epetraVec, getEpetraVector(), NOX::ShapeCopy, and vectorSpace.
NOX::Epetra::Vector::~Vector | ( | ) | [virtual] |
Destruct Vector.
Reimplemented from NOX::Abstract::Vector.
Definition at line 122 of file NOX_Epetra_Vector.C.
Epetra_Vector & NOX::Epetra::Vector::getEpetraVector | ( | ) | [virtual] |
Get reference to underlying Epetra vector.
Definition at line 144 of file NOX_Epetra_Vector.C.
References epetraVec.
Referenced by NOX::Epetra::MatrixFree::Apply(), LOCA::Epetra::AnasaziOperator::Floquet::apply(), LOCA::Epetra::Group::applyComplex(), LOCA::Epetra::Group::applyComplexInverseMultiVector(), LOCA::Epetra::Group::applyComplexTranspose(), LOCA::Epetra::Group::applyComplexTransposeInverseMultiVector(), NOX::Epetra::LinearSystemAztecOO::applyJacobian(), NOX::Epetra::LinearSystemAztecOO::applyJacobianInverse(), NOX::Epetra::LinearSystemAztecOO::applyJacobianTranspose(), LOCA::Epetra::TransposeLinearSystem::LeftPreconditioning::applyJacobianTransposeInverse(), NOX::Epetra::LinearSystemAztecOO::applyRightPreconditioning(), LOCA::Epetra::Group::augmentJacobianForHomotopy(), NOX::Epetra::MatrixFree::Comm(), LOCA::Epetra::ModelEvaluatorInterface::computeDfDp(), NOX::Epetra::Group::computeF(), NOX::Epetra::MatrixFree::computeJacobian(), NOX::Epetra::LinearSystemAztecOO::computeJacobian(), NOX::Epetra::Group::computeNormNewtonSolveResidual(), LOCA::Epetra::Group::computeShiftedMatrix(), createMultiVector(), NOX::Epetra::LinearSystemAztecOO::createPreconditioner(), NOX::Epetra::FiniteDifference::FiniteDifference(), NOX::Epetra::MatrixFree::MatrixFree(), LOCA::Epetra::Group::printSolution(), NOX::Epetra::LinearSystemAztecOO::recomputePreconditioner(), and Vector().
const Epetra_Vector & NOX::Epetra::Vector::getEpetraVector | ( | ) | const [virtual] |
Get const reference to underlying Epetra vector.
Definition at line 149 of file NOX_Epetra_Vector.C.
References epetraVec.
NOX::Abstract::Vector & NOX::Epetra::Vector::init | ( | double | gamma | ) | [virtual] |
Initialize every element of this vector with gamma
.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 154 of file NOX_Epetra_Vector.C.
References epetraVec.
Referenced by NOX::Epetra::LinearSystemAztecOO::applyJacobianInverse(), NOX::Epetra::Group::computeNewton(), and NOX::Epetra::MatrixFree::MatrixFree().
NOX::Abstract::Vector & NOX::Epetra::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.
Reimplemented from NOX::Abstract::Vector.
Definition at line 160 of file NOX_Epetra_Vector.C.
References epetraVec.
NOX::Abstract::Vector & NOX::Epetra::Vector::operator= | ( | const Epetra_Vector & | y | ) | [virtual] |
Copies source vector into "this".
NOTE: this will NOT copy the underlying vector space into the new vector.
Definition at line 127 of file NOX_Epetra_Vector.C.
References epetraVec.
Referenced by operator=().
NOX::Abstract::Vector & NOX::Epetra::Vector::operator= | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Copy source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 133 of file NOX_Epetra_Vector.C.
References operator=().
NOX::Abstract::Vector & NOX::Epetra::Vector::abs | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Put element-wise absolute values of source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 168 of file NOX_Epetra_Vector.C.
NOX::Abstract::Vector & NOX::Epetra::Vector::reciprocal | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Put element-wise reciprocal of source vector y
into this vector.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 179 of file NOX_Epetra_Vector.C.
NOX::Abstract::Vector & NOX::Epetra::Vector::scale | ( | double | gamma | ) | [virtual] |
Scale each element of this vector by gamma
.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 190 of file NOX_Epetra_Vector.C.
References epetraVec.
Referenced by NOX::Epetra::MatrixFree::Apply(), NOX::Epetra::Group::computeNewton(), and scale().
NOX::Abstract::Vector & NOX::Epetra::Vector::scale | ( | const NOX::Abstract::Vector & | a | ) | [virtual] |
Scale this vector element-by-element by the vector a.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 227 of file NOX_Epetra_Vector.C.
References scale().
NOX::Abstract::Vector & NOX::Epetra::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.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 197 of file NOX_Epetra_Vector.C.
NOX::Abstract::Vector & NOX::Epetra::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.
Here x represents this vector, and we update it as
Implements NOX::Abstract::Vector.
Definition at line 210 of file NOX_Epetra_Vector.C.
Teuchos::RCP< NOX::Abstract::Vector > NOX::Epetra::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.
Implements NOX::Abstract::Vector.
Definition at line 239 of file NOX_Epetra_Vector.C.
References epetraVec, and vectorSpace.
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::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
.
The implementation here creates a NOX::Epetra::MultiVector with either Shape or Deep copies of the supplied vectors.
Reimplemented from NOX::Abstract::Vector.
Definition at line 247 of file NOX_Epetra_Vector.C.
References epetraVec, and getEpetraVector().
Teuchos::RCP< NOX::Abstract::MultiVector > NOX::Epetra::Vector::createMultiVector | ( | int | numVecs, | |
NOX::CopyType | type = NOX::DeepCopy | |||
) | const [virtual] |
Create a MultiVector with numVecs
columns.
The implementation here creates a NOX::Epetra::MultiVector with either Shape or Deep copies of the supplied vector.
Reimplemented from NOX::Abstract::Vector.
Definition at line 280 of file NOX_Epetra_Vector.C.
References epetraVec, and NOX::ShapeCopy.
double NOX::Epetra::Vector::norm | ( | NOX::Abstract::Vector::NormType | type = TwoNorm |
) | const [virtual] |
Norm.
Here x represents this vector, and we compute its norm as follows: for each NOX::Abstract::Vector::NormType:
Implements NOX::Abstract::Vector.
Definition at line 310 of file NOX_Epetra_Vector.C.
References epetraVec, and vectorSpace.
Referenced by NOX::Epetra::MatrixFree::Apply(), NOX::Epetra::Group::computeNormNewtonSolveResidual(), norm(), and LOCA::Epetra::Interface::Required::projectToDraw().
double NOX::Epetra::Vector::norm | ( | const NOX::Abstract::Vector & | weights | ) | const [virtual] |
Weighted 2-Norm.
Here x represents this vector, and we compute its weighted norm as follows:
Implements NOX::Abstract::Vector.
Definition at line 315 of file NOX_Epetra_Vector.C.
References norm().
double NOX::Epetra::Vector::innerProduct | ( | const NOX::Abstract::Vector & | y | ) | const [virtual] |
Inner product with y
.
Here x represents this vector, and we compute its inner product with y as follows:
Implements NOX::Abstract::Vector.
Definition at line 326 of file NOX_Epetra_Vector.C.
int NOX::Epetra::Vector::length | ( | ) | const [virtual] |
Return the length of vector.
Implements NOX::Abstract::Vector.
Definition at line 336 of file NOX_Epetra_Vector.C.
References epetraVec.
void NOX::Epetra::Vector::print | ( | std::ostream & | stream | ) | const [virtual] |
Print the vector. To be used for debugging only.
Reimplemented from NOX::Abstract::Vector.
Definition at line 341 of file NOX_Epetra_Vector.C.
References epetraVec.
Teuchos::RCP< NOX::Epetra::VectorSpace > NOX::Epetra::Vector::getVectorSpace | ( | ) | const [virtual] |
Returns the NOX::Epetra::VectorSpace associated with this vector.
Definition at line 348 of file NOX_Epetra_Vector.C.
References vectorSpace.
Referenced by NOX::Epetra::MatrixFree::Apply().
Teuchos::RCP<Epetra_Vector> NOX::Epetra::Vector::epetraVec [protected] |
Pointer to petra vector owned by this object.
Definition at line 232 of file NOX_Epetra_Vector.H.
Referenced by clone(), createMultiVector(), getEpetraVector(), init(), length(), norm(), operator=(), print(), random(), scale(), and Vector().
Teuchos::RCP<NOX::Epetra::VectorSpace> NOX::Epetra::Vector::vectorSpace [protected] |
Pointer to the vector space.
Definition at line 235 of file NOX_Epetra_Vector.H.
Referenced by clone(), getVectorSpace(), norm(), and Vector().