Chi-Tech
|
#include <ParallelVector.h>
Public Member Functions | |
ParallelVector (uint64_t local_size, uint64_t global_size, MPI_Comm communicator) | |
ParallelVector (const ParallelVector &other) | |
ParallelVector (ParallelVector &&other) noexcept | |
virtual std::unique_ptr< ParallelVector > | MakeCopy () const =0 |
virtual std::unique_ptr< ParallelVector > | MakeClone () const =0 |
virtual double * | Data ()=0 |
virtual const double * | Data () const =0 |
uint64_t | LocalSize () const |
Return the size of the locally owned portion of the parallel vector. More... | |
uint64_t | GlobalSize () const |
Return the global size of the parallel vector. More... | |
virtual double | operator[] (int64_t local_id) const =0 |
virtual double & | operator[] (int64_t local_id)=0 |
virtual std::vector< double > | MakeLocalVector ()=0 |
Return a vector containing the locally owned data. More... | |
virtual void | Set (double value)=0 |
virtual void | Set (const std::vector< double > &local_vector)=0 |
virtual void | BlockSet (const std::vector< double > &y, int64_t local_offset, int64_t num_values)=0 |
virtual void | CopyLocalValues (const ParallelVector &y)=0 |
virtual void | CopyLocalValues (Vec y)=0 |
virtual void | BlockCopyLocalValues (const ParallelVector &y, int64_t y_offset, int64_t local_offset, int64_t num_values)=0 |
virtual void | BlockCopyLocalValues (Vec y, int64_t y_offset, int64_t local_offset, int64_t num_values)=0 |
virtual void | SetValue (int64_t global_id, double value, VecOpType op_type)=0 |
virtual void | SetValues (const std::vector< int64_t > &global_ids, const std::vector< double > &values, VecOpType op_type)=0 |
virtual void | operator+= (const ParallelVector &y)=0 |
virtual void | PlusAY (const ParallelVector &y, double a)=0 |
virtual void | AXPlusY (double a, const ParallelVector &y)=0 |
virtual void | Scale (double a)=0 |
virtual void | Shift (double a)=0 |
virtual double | ComputeNorm (chi_math::NormType norm_type) const =0 |
virtual void | Assemble ()=0 |
virtual std::string | PrintStr () const =0 |
Print the local vectors to stings. More... | |
virtual void | CommunicateGhostEntries () |
virtual | ~ParallelVector ()=default |
Protected Attributes | |
const uint64_t | local_size_ |
const uint64_t | global_size_ |
const int | location_id_ |
const int | process_count_ |
const MPI_Comm | comm_ |
An abstract implementation of a parallel vector.
Definition at line 21 of file ParallelVector.h.
chi_math::ParallelVector::ParallelVector | ( | uint64_t | local_size, |
uint64_t | global_size, | ||
MPI_Comm | communicator | ||
) |
Initialize a parallel vector with the given local and global sizes with the given communicator whose entries are set to zero.
Definition at line 8 of file ParallelVector.cc.
chi_math::ParallelVector::ParallelVector | ( | const ParallelVector & | other | ) |
Copy constructor.
Definition at line 19 of file ParallelVector.cc.
|
noexcept |
Move constructor.
Definition at line 28 of file ParallelVector.cc.
|
virtualdefault |
|
pure virtual |
Communicate all operations stored within the operation cache to the corresponding processes that own the respective global indices, and apply the operations.
This routine clears the respective operation cache once completed.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Performs x = a*x + y with the current vector being x.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Copies a contiguous block of local data (num_values entries) from the source vector (starting at y_offset) to the current vector starting at local_offset.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Copies a contiguous block of local data (num_values entries) from the source vector (starting at y_offset) to the current vector starting at local_offset. PETSc flavor.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Copies a contiguous block of data from the source STL vector to the current vector starting at local_offset. The input STL vector must have exactly num_values entries.
Implemented in chi_math::ParallelSTLVector.
|
inlinevirtual |
Communicate the current ghost entries, if applicable, to all other processes to update the locally stored ghost data.
Reimplemented in chi_math::GhostedParallelSTLVector.
Definition at line 181 of file ParallelVector.h.
|
pure virtual |
Returns the specified norm of the vector.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Sets the local values of one vector equal to another. The sizes must be compatible.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Sets the local values of the vector equal to that of the PETSc vector. The sizes must be compatible.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Returns a direct const pointer to the memory array used internally by the vector to store its owned elements
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Returns a direct pointer to the memory array used internally by the vector to store its owned elements
Implemented in chi_math::ParallelSTLVector.
|
inline |
Return the global size of the parallel vector.
Definition at line 58 of file ParallelVector.h.
|
inline |
Return the size of the locally owned portion of the parallel vector.
Definition at line 55 of file ParallelVector.h.
|
pure virtual |
Creates a copy of the vector datastructures but NOT the values. The values are defaulted to zero. This routine requires no communication.
Implemented in chi_math::GhostedParallelSTLVector, and chi_math::ParallelSTLVector.
|
pure virtual |
Creates a copy of the vector datastructures AND values. This routine requires no communication.
Implemented in chi_math::GhostedParallelSTLVector, and chi_math::ParallelSTLVector.
|
pure virtual |
Return a vector containing the locally owned data.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
In place adding of vectors. The sizes must be compatible.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Read only accessor to the entry at the given local index of the local vector.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Read/write accessor to the entry at the given local index of the local vector.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Adds a vector multiplied by scalar a, x=x+a*y. Optimized for a=1.0 and -1.0
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Print the local vectors to stings.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Scales a vector by a scalar
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Set the entries of the locally owned portion of the parallel vector to the given STL vector.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Set the entries of the locally owned portion of the parallel vector to the given value.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Define a set or add operation for the given global id-value pair
This routine adds the global id-value pair to the set operation cache, which upon execution of Assemble, communicates the operations to the appropriate process.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Group multiple operations into a single call.
This routine goes through the given global id-value pairs and calls SetValue for each.
Implemented in chi_math::ParallelSTLVector.
|
pure virtual |
Adds a constant scalar value to all the entries of the vector
Implemented in chi_math::ParallelSTLVector.
|
protected |
Definition at line 191 of file ParallelVector.h.
|
protected |
Definition at line 187 of file ParallelVector.h.
|
protected |
Definition at line 186 of file ParallelVector.h.
|
protected |
Definition at line 189 of file ParallelVector.h.
|
protected |
Definition at line 190 of file ParallelVector.h.