GEOSX
|
This class creates and provides basic support for Vec vector object type used in PETSc. More...
#include <PetscVector.hpp>
Public Types | |
using | Vec = struct _p_Vec * |
Alias for PETSc vector struct pointer. | |
Public Member Functions | |
const Vec & | unwrapped () const |
Returns a const pointer to the underlying Vec. More... | |
Vec & | unwrapped () |
Returns a non-const pointer to the underlying Vec. More... | |
Constructor/Destructor Methods | |
PetscVector () | |
Empty vector constructor. | |
PetscVector (PetscVector const &src) | |
Copy constructor. More... | |
PetscVector (PetscVector &&src) noexcept | |
Move constructor. More... | |
PetscVector & | operator= (PetscVector const &src) |
Copy assignment. More... | |
PetscVector & | operator= (PetscVector &&src) noexcept |
Move assignment. More... | |
~PetscVector () | |
Destructor. | |
VectorBase interface | |
virtual bool | created () const override |
Query vector creation status. More... | |
virtual void | createWithLocalSize (localIndex const localSize, MPI_Comm const &comm) override |
Create a vector based on local number of elements. More... | |
virtual void | createWithGlobalSize (globalIndex const globalSize, MPI_Comm const &comm) override |
Create a vector based on global number of elements. More... | |
virtual void | create (arrayView1d< real64 const > const &localValues, MPI_Comm const &comm) override |
Construct parallel vector from a local array. More... | |
virtual void | open () override |
Open the vector for modifying entries. | |
virtual void | close () override |
Assemble vector. More... | |
virtual void | reset () override |
Reset the matrix to default state. | |
virtual void | set (globalIndex const globalRow, real64 const value) override |
Set vector value. More... | |
virtual void | add (globalIndex const globalRow, real64 const value) override |
Add into vector value. More... | |
virtual void | set (globalIndex const *globalIndices, real64 const *values, localIndex size) override |
Set vector values. More... | |
virtual void | add (globalIndex const *globalIndices, real64 const *values, localIndex size) override |
Add vector values. More... | |
virtual void | set (arraySlice1d< globalIndex const > const &globalIndices, arraySlice1d< real64 const > const &values) override |
Set vector values using array1d. More... | |
virtual void | add (arraySlice1d< globalIndex const > const &globalIndices, arraySlice1d< real64 const > const &values) override |
Add into vector values using array1d. More... | |
virtual void | set (real64 const value) override |
Set all elements to a constant value. More... | |
virtual void | zero () override |
Set vector elements to zero. | |
virtual void | rand (unsigned const seed=1984) override |
Set vector elements to random entries. More... | |
virtual void | scale (real64 const scalingFactor) override |
Multiply all elements by scalingFactor. More... | |
virtual void | reciprocal () override |
Replace vector elements by their reciprocals. More... | |
virtual real64 | dot (PetscVector const &vec) const override |
Dot product with the vector vec. More... | |
virtual void | copy (PetscVector const &x) override |
Update vector y as y = x . More... | |
virtual void | axpy (real64 const alpha, PetscVector const &x) override |
Update vector y as y = alpha*x + y . More... | |
virtual void | axpby (real64 const alpha, PetscVector const &x, real64 const beta) override |
Update vector y as y = alpha*x + beta*y . More... | |
virtual void | pointwiseProduct (PetscVector const &x, PetscVector &y) const override |
Compute the componentwise multiplication y = v * x . More... | |
virtual real64 | norm1 () const override |
1-norm of the vector. More... | |
virtual real64 | norm2 () const override |
2-norm of the vector. More... | |
virtual real64 | normInf () const override |
Infinity-norm of the vector. More... | |
virtual globalIndex | globalSize () const override |
Returns the global of the vector. More... | |
virtual localIndex | localSize () const override |
Returns the local size of the vector. More... | |
virtual globalIndex | ilower () const override |
Get lower bound of local partition. More... | |
virtual globalIndex | iupper () const override |
Get upper bound of local partition. More... | |
virtual real64 | get (globalIndex const globalRow) const override |
Get a value by index. More... | |
void | get (arraySlice1d< globalIndex const > const &globalIndices, arraySlice1d< real64 > const &values) const override |
Get a sequence of values by index. More... | |
virtual void | print (std::ostream &os=std::cout) const override |
Print the vector in Trilinos format to the terminal. More... | |
virtual void | write (string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const override |
Write the vector to a file. More... | |
virtual localIndex | getLocalRowID (globalIndex const globalRow) const override |
Map a global row index to local row index. More... | |
virtual globalIndex | getGlobalRowID (localIndex const localRow) const override |
Map a local row index to global row index. More... | |
virtual real64 const * | extractLocalVector () const override |
Extract a view of the local portion of the array. More... | |
virtual real64 * | extractLocalVector () override |
Extract a view of the local portion of the array. More... | |
virtual MPI_Comm | getComm () const override |
Get the communicator used by this vector. More... | |
Protected Attributes | |
Vec | m_vec |
This class creates and provides basic support for Vec vector object type used in PETSc.
Definition at line 44 of file PetscVector.hpp.
geosx::PetscVector::PetscVector | ( | PetscVector const & | src | ) |
Copy constructor.
src | PetscVector to be copied. |
|
noexcept |
Move constructor.
src | PetscVector to move from |
|
overridevirtual |
Add into vector value.
globalRow | global row |
value | Values to add in given row |
Add into vector value at given row.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Add vector values.
globalIndices | global row indices |
values | values to add in given rows |
size | number of elements |
Add vector values at given elements.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Add into vector values using array1d.
globalIndices | global rows indices |
values | values to add in given rows |
Add into vector values at given rows.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
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 |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Update vector y
as y
= alpha*x + y
.
alpha | scaling factor for added vector |
x | vector to add |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Assemble vector.
Performs parallel communication to scatter assembled entries to appropriate locations
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
|
overridevirtual |
Construct parallel vector from a local array.
localValues | local data to put into vector |
comm | MPI communicator to use |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Query vector creation status.
true
if vector has been created Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Create a vector based on global number of elements.
globalSize | Global number of elements |
comm | MPI communicator to use |
Create a vector based on global number of elements. Every processors gets the same number of local elements except proc 0, which gets any remainder elements as well if the split can't be done evenly.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
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. For specifying a global size and having automatic partitioning, see createWithGlobalSize().
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Dot product with the vector vec.
vec | vector to dot-product with |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Extract a view of the local portion of the array.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Extract a view of the local portion of the array.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Get a value by index.
globalRow | global row index |
globalRow
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Get a sequence of values by index.
[in] | globalIndices | array of global row indices |
[out] | values | array of vector values |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Get the communicator used by this vector.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Map a local row index to global row index.
[in] | localRow | the local row index |
localRow
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Map a global row index to local row index.
[in] | globalRow | the global row index |
globalRow
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Returns the global of the vector.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Get lower bound of local partition.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Get upper bound of local partition.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Returns the local size of the vector.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
PetscVector& geosx::PetscVector::operator= | ( | PetscVector const & | src | ) |
|
noexcept |
|
overridevirtual |
Compute the componentwise multiplication y
= v * x
.
x | first vector (input) |
y | second vector (output) |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Print the vector in Trilinos format to the terminal.
os | the output stream to print to |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Set vector elements to random entries.
seed | the random number seed to use |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Replace vector elements by their reciprocals.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Multiply all elements by scalingFactor.
scalingFactor | scaling Factor |
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Set vector value.
globalRow | global row index |
value | Value to add at given row |
Set vector value at given element.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Set vector values.
globalIndices | global row indices |
values | Values to add in given rows |
size | Number of elements |
Set vector values at given elements.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Set vector values using array1d.
globalIndices | global row indices |
values | values to add in given rows |
Set vector values at given elements.
Implements geosx::VectorBase< PetscVector >.
|
overridevirtual |
Set all elements to a constant value.
value | value to set vector elements to |
Implements geosx::VectorBase< PetscVector >.
const Vec& geosx::PetscVector::unwrapped | ( | ) | const |
Returns a const pointer to the underlying Vec.
Vec& geosx::PetscVector::unwrapped | ( | ) |
Returns a non-const pointer to the underlying Vec.
|
overridevirtual |
Write the vector to a file.
filename | name of the output file | |
[in] | format | output format |
Implements geosx::VectorBase< PetscVector >.
|
protected |
Pointer to underlying PETSc Vec
Definition at line 250 of file PetscVector.hpp.