GEOS
|
Common base template for all vector wrapper types. More...
#include <VectorBase.hpp>
Protected Types | |
using | Vector = VECTOR |
Alias for VECTOR. | |
Protected Member Functions | |
Status query methods | |
bool | closed () const |
Query vector closed status. More... | |
virtual bool | created () const =0 |
Query vector creation status. More... | |
bool | ready () const |
Query vector ready status. More... | |
Create Methods | |
virtual void | create (localIndex const localSize, MPI_Comm const &comm) |
Create a vector based on local number of elements. More... | |
void | setName (string const &name) |
Set a name for the vector (mainly used during various logging). More... | |
Open/close methods | |
virtual arrayView1d< real64 > | open () |
Open the vector for modifying entries. More... | |
virtual void | close ()=0 |
Close vector for modification. More... | |
virtual void | touch ()=0 |
Notify the vector about external modification through direct data pointer. More... | |
virtual void | reset () |
Reset the vector to default state. | |
Modification methods | |
virtual void | set (real64 const value)=0 |
Set all elements to a constant value. More... | |
virtual void | zero () |
Set vector elements to zero. | |
virtual void | rand (unsigned const seed)=0 |
Set vector elements to random entries. More... | |
Algebraic Operations | |
virtual void | scale (real64 const factor)=0 |
Multiply all elements by factor. More... | |
virtual void | reciprocal ()=0 |
Replace vector elements by their reciprocals. More... | |
virtual real64 | dot (Vector const &vec) const =0 |
Dot product with the vector vec. More... | |
virtual void | copy (Vector const &x)=0 |
Update vector y as y = x . More... | |
virtual void | axpy (real64 const alpha, Vector const &x)=0 |
Update vector y as y = alpha*x + y . More... | |
virtual void | axpby (real64 const alpha, Vector const &x, real64 const beta)=0 |
Update vector y as y = alpha*x + beta*y . More... | |
virtual void | pointwiseProduct (Vector const &x, Vector &y) const =0 |
Compute the component-wise multiplication y = v * x . More... | |
virtual real64 | norm1 () const =0 |
1-norm of the vector. More... | |
virtual real64 | norm2 () const =0 |
2-norm of the vector. More... | |
virtual real64 | normInf () const =0 |
Infinity-norm of the vector. More... | |
Accessor Methods | |
virtual globalIndex | globalSize () const =0 |
Returns the global of the vector. More... | |
virtual localIndex | localSize () const =0 |
Returns the local size of the vector. More... | |
virtual globalIndex | ilower () const =0 |
Get lower bound of local partition. More... | |
virtual globalIndex | iupper () const =0 |
Get upper bound of local partition. More... | |
arrayView1d< real64 const > | values () const |
virtual MPI_Comm | comm () const =0 |
Get the communicator used by this vector. More... | |
I/O Methods | |
virtual void | print (std::ostream &os=std::cout) const =0 |
Print the vector in Trilinos format to the terminal. More... | |
virtual void | write (string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const =0 |
Write the vector to a file. More... | |
Protected Attributes | |
bool | m_closed = true |
Flag indicating whether the vector is closed. | |
array1d< real64 > | m_values |
Actual storage for the local vector values. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, Vector const &vec) |
Stream insertion operator for all vector types. More... | |
Common base template for all vector wrapper types.
VECTOR | derived vector type |
This class template provides a common interface for all derived vector wrapper types. Most methods are pure abstract in order to get the compiler to enforce a common interface in all derived classes; however there is no runtime polymorphism or virtual dispatch - derived classes are not related between each other, and pointers/references to base should never be used - the destructor is protected to enforce that.
As an added benefit, the documentation for vector interface also lives here and does not need to be duplicated across vector wrappers. Derived classes should still document specific functions in case a particular LA package's behavior deviates from expectations or has unexpected performance impacts. In that case, @copydoc
tag can be used to copy over the documentation.
Definition at line 48 of file VectorBase.hpp.
|
protectedpure virtual |
Update vector y
as y
= alpha*x + beta*y
.
alpha | scaling factor for added vector |
x | vector to add |
beta | scaling factor for self vector |
Implemented in geos::PetscVector, geos::HypreVector, and geos::EpetraVector.
|
protectedpure virtual |
Update vector y
as y
= alpha*x + y
.
alpha | scaling factor for added vector |
x | vector to add |
Implemented in geos::PetscVector, geos::HypreVector, and geos::EpetraVector.
|
protectedpure virtual |
Close vector for modification.
After calling this method, the view obtained via open() should not be used.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
inlineprotected |
Query vector closed status.
true
if vector has been opened and has not been closed since; false
otherwise Definition at line 64 of file VectorBase.hpp.
|
protectedpure virtual |
Get the communicator used by this vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Update vector y
as y
= x
.
x | vector to copy |
Implemented in geos::PetscVector, geos::HypreVector, and geos::EpetraVector.
|
inlineprotectedvirtual |
Create a vector based on local number of elements.
localSize | local number of elements |
comm | MPI communicator to use |
Create a vector based on local number of elements. Global size is the sum across processors.
Reimplemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
Definition at line 93 of file VectorBase.hpp.
|
protectedpure virtual |
Query vector creation status.
true
if vector has been created Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Dot product with the vector vec.
vec | vector to dot-product with |
Implemented in geos::PetscVector, geos::HypreVector, and geos::EpetraVector.
|
protectedpure virtual |
Returns the global of the vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Get lower bound of local partition.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Get upper bound of local partition.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Returns the local size of the vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
1-norm of the vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
2-norm of the vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Infinity-norm of the vector.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
inlineprotectedvirtual |
Open the vector for modifying entries.
Reimplemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
Definition at line 129 of file VectorBase.hpp.
|
protectedpure virtual |
Compute the component-wise multiplication y
= v * x
.
x | first vector (input) |
y | second vector (output) |
Implemented in geos::PetscVector, geos::HypreVector, and geos::EpetraVector.
|
protectedpure virtual |
Print the vector in Trilinos format to the terminal.
os | the output stream to print to |
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Set vector elements to random entries.
seed | the random number seed to use |
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
inlineprotected |
Query vector ready status.
true
if vector has been created and is currently closed Definition at line 76 of file VectorBase.hpp.
|
protectedpure virtual |
Replace vector elements by their reciprocals.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Multiply all elements by factor.
factor | scaling factor |
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
protectedpure virtual |
Set all elements to a constant value.
value | value to set vector elements to |
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
inlineprotected |
Set a name for the vector (mainly used during various logging).
name | the name |
Definition at line 113 of file VectorBase.hpp.
|
protectedpure virtual |
Notify the vector about external modification through direct data pointer.
This method MUST be called after any changes to vector values performed through direct pointer access, so that the underlying Array object can be made aware of external changes in a specific memory space.
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
inlineprotected |
Definition at line 305 of file VectorBase.hpp.
|
protectedpure virtual |
Write the vector to a file.
filename | name of the output file | |
[in] | format | output format |
Implemented in geos::EpetraVector, geos::PetscVector, and geos::HypreVector.
|
friend |
Stream insertion operator for all vector types.
os | the output stream to print to |
vec | the vector to print |
os
Definition at line 346 of file VectorBase.hpp.