Class ParallelSTLVector
Defined in File parallel_stl_vector.h
Inheritance Relationships
Base Type
public opensn::ParallelVector
(Class ParallelVector)
Derived Type
public opensn::GhostedParallelSTLVector
(Class GhostedParallelSTLVector)
Class Documentation
-
class ParallelSTLVector : public opensn::ParallelVector
An implementation of a parallel vector.
Subclassed by opensn::GhostedParallelSTLVector
Public Functions
-
ParallelSTLVector(uint64_t local_size, uint64_t global_size, const mpi::Communicator &communicator)
Initialize a parallel vector with the given local and global sizes with the given communicator whose entries are set to zero.
-
ParallelSTLVector(const ParallelSTLVector &other)
Copy constructor.
-
ParallelSTLVector(ParallelSTLVector &&other) noexcept
Move constructor.
-
virtual std::unique_ptr<ParallelVector> MakeCopy() const override
Creates a copy of the vector datastructures AND values. This routine requires no communication.
-
virtual std::unique_ptr<ParallelVector> MakeClone() const override
Creates a copy of the vector datastructures but NOT the values. The values are defaulted to zero. This routine requires no communication.
-
virtual double *GetData() override
Returns a direct pointer to the memory array used internally by the vector to store its owned elements.
-
virtual const double *GetData() const override
Returns a direct const pointer to the memory array used internally by the vector to store its owned elements
-
const std::vector<double> &GetLocalSTLData() const
Returns a constant reference to the local data of the vector.
-
std::vector<double> &GetLocalSTLData()
Returns a reference to the local data of the vector.
-
virtual double operator[](int64_t local_id) const override
Read only accessor to the entry at the given local index of the local vector.
Note
This accessor allows access to all locally stored elements, including any data beyond local_size_ that may exist in derived classes.
-
virtual double &operator[](int64_t local_id) override
Read/write accessor to the entry at the given local index of the local vector.
Note
This accessor allows access to all locally stored elements, including any data beyond local_size_ that may exist in derived classes.
-
virtual std::vector<double> MakeLocalVector() override
Return a vector containing the locally owned data.
-
virtual void Set(double value) override
Set the entries of the locally owned portion of the parallel vector to the given value.
-
virtual void Set(const std::vector<double> &local_vector) override
Set the entries of the locally owned portion of the parallel vector to the given STL vector.
-
virtual void BlockSet(const std::vector<double> &y, int64_t local_offset, int64_t num_values) override
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.
-
virtual void CopyLocalValues(const ParallelVector &y) override
Sets the local values of one vector equal to another. The sizes must be compatible.
-
virtual void CopyLocalValues(Vec y) override
Sets the local values of the vector equal to that of the PETSc vector. The sizes must be compatible.
-
virtual void BlockCopyLocalValues(const ParallelVector &y, int64_t y_offset, int64_t local_offset, int64_t num_values) override
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.
-
virtual void BlockCopyLocalValues(Vec y, int64_t y_offset, int64_t local_offset, int64_t num_values) override
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.
-
virtual void SetValue(int64_t global_id, double value, VecOpType op_type) override
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.
-
virtual void SetValues(const std::vector<int64_t> &global_ids, const std::vector<double> &values, VecOpType op_type) override
Group multiple operations into a single call.
This routine goes through the given global id-value pairs and calls SetValue for each.
-
virtual void operator+=(const ParallelVector &y) override
In place adding of vectors. The sizes must be compatible.
-
virtual void PlusAY(const ParallelVector &y, double a) override
Adds a vector multiplied by scalar a,
x = x + a*y
. Optimized for a=1.0 and -1.0.
-
virtual void AXPlusY(double a, const ParallelVector &y) override
Performs x = a*x + y with the current vector being x.
-
virtual void Scale(double a) override
Adds a constant scalar value to all the entries of the vector.
-
virtual void Shift(double a) override
Returns the specified norm of the vector.
-
virtual double ComputeNorm(NormType norm_type) const override
Returns the specified norm of the vector.
-
virtual void Assemble() override
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.
-
virtual std::string PrintStr() const override
Print the local vectors to stings.
Protected Types
-
using Operation = std::pair<int64_t, double>
-
ParallelSTLVector(uint64_t local_size, uint64_t global_size, const mpi::Communicator &communicator)